View Source API Reference google_api_chat v0.34.3

Modules

API client metadata for GoogleApi.Chat.V1.

API calls for all endpoints tagged Media.

API calls for all endpoints tagged Spaces.

Handle Tesla connections for GoogleApi.Chat.V1.

One or more interactive widgets that appear at the bottom of a message. For details, see Add interactive widgets at the bottom of a message.

List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze one day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters.

Parameters that a Chat app can use to configure how its response is posted.

Represents the status for a request to either invoke or submit a dialog.

Output only. Annotations associated with the plain-text body of the message. To add basic formatting to a text message, see Format text messages. Example plain-text message body: Hello @FooBot how are you!" The corresponding annotations metadata: "annotations":[{ "type":"USER_MENTION", "startIndex":6, "length":7, "userMention": { "user": { "name":"users/{user}", "displayName":"FooBot", "avatarUrl":"https://goo.gl/aeDtrS", "type":"BOT" }, "type":"MENTION" } }]

A GIF image that's specified by a URL.

An attachment in Google Chat.

Attributes

  • attachmentUploadToken (type: String.t, default: nil) - Opaque token containing a reference to an uploaded attachment. Treated by clients as an opaque string and used to create or update Chat messages with attachments.
  • resourceName (type: String.t, default: nil) - The resource name of the attachment data. This field is used with the media API to download the attachment data.

A button. Can be a text button or an image button.

A card is a UI element that can contain UI widgets such as text and images.

A card action is the action associated with the card. For an invoice card, a typical action would be: delete invoice, email invoice or open the invoice in browser. Not supported by Google Chat apps.

Attributes

  • imageStyle (type: String.t, default: nil) - The image's type (for example, square border or circular border).
  • imageUrl (type: String.t, default: nil) - The URL of the image in the card header.
  • subtitle (type: String.t, default: nil) - The subtitle of the card header.
  • title (type: String.t, default: nil) - The title must be specified. The header has a fixed height: if both a title and subtitle is specified, each takes up one line. If only the title is specified, it takes up both lines.

A card in a Google Chat message. Only Chat apps can create cards. If your Chat app authenticates as a user, the message can't contain cards. Card builder

JSON payload of error messages. If the Cloud Logging API is enabled, these error messages are logged to Google Cloud Logging.

For a SelectionInput widget that uses a multiselect menu, a data source from Google Chat. The data source populates selection items for the multiselect menu. For example, a user can select Google Chat spaces that they're a member of. Google Chat apps

Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to and from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of java.awt.Color in Java; it can also be trivially provided to UIColor's +colorWithRed:green:blue:alpha method in iOS; and, with just a little work, it can be easily formatted into a CSS rgba() string in JavaScript. This reference page doesn't have information about the absolute color space that should be used to interpret the RGB value—for example, sRGB, Adobe RGB, DCI-P3, and BT.2020. By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor fromProto(Color protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color toProto(UIColor color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac 255); var green = Math.floor(greenFrac 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ...

Represents information about the user's client, such as locale, host app, and platform. For Chat apps, CommonEventObject includes data submitted by users interacting with cards, like data entered in dialogs.

Request message for completing the import process for a space.

Attributes

  • space (type: GoogleApi.Chat.V1.Model.Space.t, default: nil) - The import mode space.

Represents a custom emoji.

Date and time input values.

Information about a deleted message. A message is deleted when delete_time is set.

A Google Chat app interaction event. To learn about interaction events, see Receive and respond to interactions with your Google Chat app. To learn about event types and for example event payloads, see Types of Google Chat app interaction events. In addition to receiving events from user interactions, Chat apps can receive events about changes to spaces, such as when a new member is added to a space. To learn about space events, see Work with events from Google Chat.

Wrapper around the card body of the dialog.

Contains a dialog and request status code.

A reference to the data of a drive attachment.

Data for Google Drive links.

An emoji that is used as a reaction to a message.

The number of people who reacted to a message with a specific emoji.

A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }

A form action describes the behavior when the form is submitted. For example, you can invoke Apps Script to handle the form.

An action that describes the behavior when the form is submitted. For example, you can invoke an Apps Script script to handle the form. If the action is triggered, the form values are sent to the server. Google Workspace Add-ons and Chat apps

List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze one day, or snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters. To learn more, see CommonEventObject. Google Workspace Add-ons and Chat apps

The style options for the border of a card or widget, including the border type and color. Google Workspace Add-ons and Chat apps

A text, icon, or text and icon button that users can click. For an example in Google Chat apps, see Add a button. To make an image a clickable button, specify an Image (not an ImageComponent) and set an onClick action. Google Workspace Add-ons and Chat apps

A list of buttons layed out horizontally. For an example in Google Chat apps, see Add a button. Google Workspace Add-ons and Chat apps

A card interface displayed in a Google Chat message or Google Workspace Add-on. Cards support a defined layout, interactive UI elements like buttons, and rich media like images. Use cards to present detailed information, gather information from users, and guide users to take a next step. Card builder To learn how to build cards, see the following documentation: For Google Chat apps, see Design the components of a card or dialog. For Google Workspace Add-ons, see Card-based interfaces. Example: Card message for a Google Chat app Example contact card To create the sample card message in Google Chat, use the following JSON: { "cardsV2": [ { "cardId": "unique-card-id", "card": { "header": { "title": "Sasha", "subtitle": "Software Engineer", "imageUrl": "https://developers.google.com/workspace/chat/images/quickstart-app-avatar.png", "imageType": "CIRCLE", "imageAltText": "Avatar for Sasha" }, "sections": [ { "header": "Contact Info", "collapsible": true, "uncollapsibleWidgetsCount": 1, "widgets": [ { "decoratedText": { "startIcon": { "knownIcon": "EMAIL" }, "text": "sasha@example.com" } }, { "decoratedText": { "startIcon": { "knownIcon": "PERSON" }, "text": "Online" } }, { "decoratedText": { "startIcon": { "knownIcon": "PHONE" }, "text": "+1 (555) 555-1234" } }, { "buttonList": { "buttons": [ { "text": "Share", "onClick": { "openLink": { "url": "https://example.com/share" } } }, { "text": "Edit", "onClick": { "action": { "function": "goToView", "parameters": [ { "key": "viewType", "value": "EDIT" } ] } } } ] } } ] } ] } } ] }

A card action is the action associated with the card. For example, an invoice card might include actions such as delete invoice, email invoice, or open the invoice in a browser. Google Workspace Add-ons

A persistent (sticky) footer that that appears at the bottom of the card. Setting fixedFooter without specifying a primaryButton or a secondaryButton causes an error. For Chat apps, you can use fixed footers in dialogs, but not card messages. For an example in Google Chat apps, see Add a persistent footer. Google Workspace Add-ons and Chat apps

Represents a card header. For an example in Google Chat apps, see Add a header. Google Workspace Add-ons and Chat apps

A column. Google Workspace Add-ons and Chat apps: Columns for Google Workspace Add-ons are in Developer Preview.

The Columns widget displays up to 2 columns in a card or dialog. You can add widgets to each column; the widgets appear in the order that they are specified. For an example in Google Chat apps, see Display cards and dialogs in columns. The height of each column is determined by the taller column. For example, if the first column is taller than the second column, both columns have the height of the first column. Because each column can contain a different number of widgets, you can't define rows or align widgets between the columns. Columns are displayed side-by-side. You can customize the width of each column using the HorizontalSizeStyle field. If the user's screen width is too narrow, the second column wraps below the first: On web, the second column wraps if the screen width is less than or equal to 480 pixels. On iOS devices, the second column wraps if the screen width is less than or equal to 300 pt. * On Android devices, the second column wraps if the screen width is less than or equal to 320 dp. To include more than 2 columns, or to use rows, use the Grid widget. Google Workspace Add-ons and Chat apps: Columns for Google Workspace Add-ons are in Developer Preview.

Lets users input a date, a time, or both a date and a time. For an example in Google Chat apps, see Let a user pick a date and time. Users can input text or use the picker to select dates and times. If users input an invalid date or time, the picker shows an error that prompts users to input the information correctly. Google Workspace Add-ons and Chat apps

A widget that displays text with optional decorations such as a label above or below the text, an icon in front of the text, a selection widget, or a button after the text. For an example in Google Chat apps, see Display text with decorative text. Google Workspace Add-ons and Chat apps

Displays a divider between widgets as a horizontal line. For an example in Google Chat apps, see Add a horizontal divider between widgets. Google Workspace Add-ons and Chat apps: For example, the following JSON creates a divider: "divider": {}

Displays a grid with a collection of items. Items can only include text or images. For responsive columns, or to include more than text or images, use Columns. For an example in Google Chat apps, see Display a Grid with a collection of items. A grid supports any number of columns and items. The number of rows is determined by items divided by columns. A grid with 10 items and 2 columns has 5 rows. A grid with 11 items and 2 columns has 6 rows. Google Workspace Add-ons and Chat apps: For example, the following JSON creates a 2 column grid with a single item: "grid": { "title": "A fine collection of items", "columnCount": 2, "borderStyle": { "type": "STROKE", "cornerRadius": 4 }, "items": [ { "image": { "imageUri": "https://www.example.com/image.png", "cropStyle": { "type": "SQUARE" }, "borderStyle": { "type": "STROKE" } }, "title": "An item", "textAlignment": "CENTER" } ], "onClick": { "openLink": { "url": "https://www.example.com" } } }

Represents an item in a grid layout. Items can contain text, an image, or both text and an image. Google Workspace Add-ons and Chat apps

An icon displayed in a widget on a card. For an example in Google Chat apps, see Add an icon. Supports built-in and custom icons. Google Workspace Add-ons and Chat apps

An image that is specified by a URL and can have an onClick action. For an example, see Add an image. Google Workspace Add-ons and Chat apps

Represents the crop style applied to an image. Google Workspace Add-ons and Chat apps: For example, here's how to apply a 16:9 aspect ratio: cropStyle { "type": "RECTANGLE_CUSTOM", "aspectRatio": 16/9 }

A Google Material Icon, which includes over 2500+ options. For example, to display a checkbox icon with customized weight and grade, write the following: { "name": "check_box", "fill": true, "weight": 300, "grade": -25 } Google Chat apps

Represents how to respond when users click an interactive element on a card, such as a button. Google Workspace Add-ons and Chat apps

For a SelectionInput widget that uses a multiselect menu, a data source from Google Workspace. Used to populate items in a multiselect menu. Google Chat apps

A section contains a collection of widgets that are rendered vertically in the order that they're specified. Google Workspace Add-ons and Chat apps

A widget that creates one or more UI items that users can select. For example, a dropdown menu or checkboxes. You can use this widget to collect data that can be predicted or enumerated. For an example in Google Chat apps, see Add selectable UI elements. Chat apps can process the value of items that users select or input. For details about working with form inputs, see Receive form data. To collect undefined or abstract data from users, use the TextInput widget. Google Workspace Add-ons and Chat apps

An item that users can select in a selection input, such as a checkbox or switch. Google Workspace Add-ons and Chat apps

One suggested value that users can enter in a text input field. Google Workspace Add-ons and Chat apps

Suggested values that users can enter. These values appear when users click inside the text input field. As users type, the suggested values dynamically filter to match what the users have typed. For example, a text input field for programming language might suggest Java, JavaScript, Python, and C++. When users start typing Jav, the list of suggestions filters to show Java and JavaScript. Suggested values help guide users to enter values that your app can make sense of. When referring to JavaScript, some users might enter javascript and others java script. Suggesting JavaScript can standardize how users interact with your app. When specified, TextInput.type is always SINGLE_LINE, even if it's set to MULTIPLE_LINE. Google Workspace Add-ons and Chat apps

Either a toggle-style switch or a checkbox inside a decoratedText widget. Google Workspace Add-ons and Chat apps: Only supported in the decoratedText widget.

A field in which users can enter text. Supports suggestions and on-change actions. For an example in Google Chat apps, see Add a field in which a user can enter text. Chat apps receive and can process the value of entered text during form input events. For details about working with form inputs, see Receive form data. When you need to collect undefined or abstract data from users, use a text input. To collect defined or enumerated data from users, use the SelectionInput widget. Google Workspace Add-ons and Chat apps

A paragraph of text that supports formatting. For an example in Google Chat apps, see Add a paragraph of formatted text. For more information about formatting text, see Formatting text in Google Chat apps and Formatting text in Google Workspace Add-ons. Google Workspace Add-ons and Chat apps

Each card is made up of widgets. A widget is a composite object that can represent one of text, images, buttons, and other object types.

The supported widgets that you can include in a column. Google Workspace Add-ons and Chat apps: Columns for Google Workspace Add-ons are in Developer Preview.

A Google Group in Google Chat.

For a SelectionInput widget that uses a multiselect menu, a data source from a Google Workspace application. The data source populates selection items for the multiselect menu. Google Chat apps

An image that's specified by a URL and can have an onclick action.

An image button with an onclick action.

Types of data that users can input on cards or dialogs. The input type depends on the type of values that the widget accepts.

A UI element contains a key (label) and a value (content). This element can also contain some actions such as onclick button.

Attributes

  • memberships (type: list(GoogleApi.Chat.V1.Model.Membership.t), default: nil) - Unordered list. List of memberships in the requested (or first) page.
  • nextPageToken (type: String.t, default: nil) - A token that you can send as pageToken to retrieve the next page of results. If empty, there are no subsequent pages.

Attributes

  • messages (type: list(GoogleApi.Chat.V1.Model.Message.t), default: nil) - List of messages.
  • nextPageToken (type: String.t, default: nil) - You can send a token as pageToken to retrieve the next page of results. If empty, there are no subsequent pages.

Attributes

  • nextPageToken (type: String.t, default: nil) - Continuation token to retrieve the next page of results. It's empty for the last page of results.
  • reactions (type: list(GoogleApi.Chat.V1.Model.Reaction.t), default: nil) - List of reactions in the requested (or first) page.

Response message for listing space events.

Attributes

  • nextPageToken (type: String.t, default: nil) - You can send a token as pageToken to retrieve the next page of results. If empty, there are no subsequent pages.
  • spaces (type: list(GoogleApi.Chat.V1.Model.Space.t), default: nil) - List of spaces in the requested (or first) page.

A matched URL in a Chat message. Chat apps can preview matched URLs. For more information, see Preview links.

Represents a membership relation in Google Chat, such as whether a user or Chat app is invited to, part of, or absent from a space.

Event payload for multiple new memberships. Event type: google.workspace.chat.membership.v1.batchCreated

Event payload for multiple deleted memberships. Event type: google.workspace.chat.membership.v1.batchDeleted

Event payload for multiple updated memberships. Event type: google.workspace.chat.membership.v1.batchUpdated

Event payload for a new membership. Event type: google.workspace.chat.membership.v1.created.

Event payload for a deleted membership. Event type: google.workspace.chat.membership.v1.deleted

Event payload for an updated membership. Event type: google.workspace.chat.membership.v1.updated

A message in a Google Chat space.

Event payload for multiple new messages. Event type: google.workspace.chat.message.v1.batchCreated

Event payload for multiple deleted messages. Event type: google.workspace.chat.message.v1.batchDeleted

Event payload for multiple updated messages. Event type: google.workspace.chat.message.v1.batchUpdated

Event payload for a new message. Event type: google.workspace.chat.message.v1.created

Event payload for a deleted message. Event type: google.workspace.chat.message.v1.deleted

Event payload for an updated message. Event type: google.workspace.chat.message.v1.updated

An onclick action (for example, open a link).

A link that opens a new window.

Information about a quoted message.

A reaction to a message.

Event payload for multiple new reactions. Event type: google.workspace.chat.reaction.v1.batchCreated

Event payload for multiple deleted reactions. Event type: google.workspace.chat.reaction.v1.batchDeleted

Event payload for a new reaction. Event type: google.workspace.chat.reaction.v1.created

Event payload for a deleted reaction. Type: google.workspace.chat.reaction.v1.deleted

A rich link to a resource.

A section contains a collection of widgets that are rendered (vertically) in the order that they are specified. Across all platforms, cards have a narrow fixed width, so there's currently no need for layout properties (for example, float).

List of widget autocomplete results.

Attributes

  • memberships (type: list(GoogleApi.Chat.V1.Model.Membership.t), default: nil) - Optional. The Google Chat users to invite to join the space. Omit the calling user, as they are added automatically. The set currently allows up to 20 memberships (in addition to the caller). The Membership.member field must contain a user with name populated (format: users/{user}) and type set to User.Type.HUMAN. You can only add human users when setting up a space (adding Chat apps is only supported for direct message setup with the calling app). You can also add members using the user's email as an alias for {user}. For example, the user.name can be users/example@gmail.com." To invite Gmail users or users from external Google Workspace domains, user's email must be used for {user}. Optional when setting Space.spaceType to SPACE. Required when setting Space.spaceType to GROUP_CHAT, along with at least two memberships. Required when setting Space.spaceType to DIRECT_MESSAGE with a human user, along with exactly one membership. Must be empty when creating a 1:1 conversation between a human and the calling Chat app (when setting Space.spaceType to DIRECT_MESSAGE and Space.singleUserBotDm to true).
  • requestId (type: String.t, default: nil) - Optional. A unique identifier for this request. A random UUID is recommended. Specifying an existing request ID returns the space created with that ID instead of creating a new space. Specifying an existing request ID from the same Chat app with a different authenticated user returns an error.
  • space (type: GoogleApi.Chat.V1.Model.Space.t, default: nil) - Required. The Space.spaceType field is required. To create a space, set Space.spaceType to SPACE and set Space.displayName. If you receive the error message ALREADY_EXISTS when setting up a space, try a different displayName. An existing space within the Google Workspace organization might already use this display name. To create a group chat, set Space.spaceType to GROUP_CHAT. Don't set Space.displayName. To create a 1:1 conversation between humans, set Space.spaceType to DIRECT_MESSAGE and set Space.singleUserBotDm to false. Don't set Space.displayName or Space.spaceDetails. To create an 1:1 conversation between a human and the calling Chat app, set Space.spaceType to DIRECT_MESSAGE and Space.singleUserBotDm to true. Don't set Space.displayName or Space.spaceDetails. If a DIRECT_MESSAGE space already exists, that space is returned instead of creating a new space.

Annotation metadata for slash commands (/).

A space in Google Chat. Spaces are conversations between two or more users or 1:1 messages between a user and a Chat app.

Event payload for multiple updates to a space. Event type: google.workspace.chat.space.v1.batchUpdated

A data source that populates Google Chat spaces as selection items for a multiselect menu. Only populates spaces that the user is a member of. Google Chat apps

Details about the space including description and rules.

An event that represents a change or activity in a Google Chat space. To learn more, see Work with events from Google Chat.

Event payload for an updated space. Event type: google.workspace.chat.space.v1.updated

The Status type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by gRPC. Each Status message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the API Design Guide.

Input parameter for regular widgets. For single-valued widgets, it is a single value list. For multi-valued widgets, such as checkbox, all the values are presented.

A button with text and onclick action.

A paragraph of text. Formatted text supported. For more information about formatting text, see Formatting text in Google Chat apps and Formatting text in Google Workspace Add-ons.

A thread in a Google Chat space. For example usage, see Start or reply to a message thread. If you specify a thread when creating a message, you can set the messageReplyOption field to determine what happens if no matching thread is found.

The timezone ID and offset from Coordinated Universal Time (UTC). Only supported for the event types CARD_CLICKED and SUBMIT_DIALOG.

The response of the updated widget. Used to provide autocomplete options for a widget.

Attributes

  • filename (type: String.t, default: nil) - Required. The filename of the attachment, including the file extension.

Attributes

  • attachmentDataRef (type: GoogleApi.Chat.V1.Model.AttachmentDataRef.t, default: nil) - Reference to the uploaded attachment.

A user in Google Chat. When returned as an output from a request, if your Chat app authenticates as a user, the output for a User resource only populates the user's name and type.

Annotation metadata for user mentions (@).

A widget is a UI element that presents text and images.