- JSON representation
- CommonEventObject
- TimeZone
- Inputs
- StringInputs
- DateTimeInput
- DateInput
- TimeInput
- AppCommandMetadata
A Google Chat app interaction event that represents and contains data about a user's interaction with a Chat app. To configure your Chat app to receive interaction events, see Receive and respond to user interactions.
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.
Note: This event is only used for Chat interaction events. If your Chat app is built as a Google Workspace add-on, see Chat event objects in the add-ons documentation.
JSON representation |
---|
{ "type": enum ( |
Fields | |
---|---|
type |
The type of user interaction with the Chat app, such as |
eventTime |
The timestamp indicating when the interaction event occurred. |
token |
A secret value that legacy Chat apps can use to verify if a request is from Google. Google randomly generates the token, and its value remains static. You can obtain, revoke, or regenerate the token from the Chat API configuration page in the Google Cloud Console. Modern Chat apps don't use this field. It is absent from API responses and the Chat API configuration page. |
threadKey |
The Chat app-defined key for the thread related to the interaction event. See |
message |
For |
user |
The user that interacted with the Chat app. |
thread |
The thread in which the user interacted with the Chat app. This could be in a new thread created by a newly sent message. This field is populated if the interaction event is associated with a specific message or thread. |
space |
The space in which the user interacted with the Chat app. |
action |
For |
configCompleteRedirectUrl |
This URL is populated for |
isDialogEvent |
For |
dialogEventType |
The type of dialog interaction event received. |
common |
Represents information about the user's client, such as locale, host app, and platform. For Chat apps, |
appCommandMetadata |
Metadata about a Chat app command. |
CommonEventObject
The common event object is the portion of the overall event object that carries general, host-independent information to the add-on from the user's client. This information includes details such as the user's locale, host app, and platform.
In addition to homepage and contextual triggers, add-ons construct and pass event objects to action callback functions when the user interacts with widgets. Your add-on's callback function can query the common event object to determine the contents of open widgets in the user's client. For example, your add-on can locate the text a user has entered into a TextInput widget in the eventObject.commentEventObject.formInputs
object.
For Chat apps, the name of the function that the user invoked when interacting with a widget.
JSON representation |
---|
{ "userLocale": string, "hostApp": enum ( |
Fields | |
---|---|
userLocale |
Disabled by default. The user's language and country/region identifier in the format of ISO 639 language code-ISO 3166 country/region code. For example, To turn on this field, you must set |
hostApp |
Indicates the host app the add-on is active in when the event object is generated. Possible values include the following:
|
platform |
The platform enum which indicates the platform where the event originates ( |
timeZone |
Disabled by default. The timezone ID and offset from Coordinated Universal Time (UTC). To turn on this field, you must set Only supported for the event types |
formInputs |
A map containing the current values of the widgets in the displayed card. The map keys are the string IDs assigned with each widget. The structure of the map value object is dependent on the widget type: Note: The following examples are formatted for Apps Script's V8 runtime. If you're using Rhino runtime, you must add
Example: for a text input widget with
Example: for a multi-value widget with
Example: For a picker with an ID of
Example: For a picker with an ID of
Example: For a picker with an ID of |
parameters |
Any additional parameters you supply to an action using Developer Preview: For add-ons that extend Google Chat, to suggest items based on what the users type in multiselect menus, use the value of the |
invokedFunction |
Name of the function to invoke. This field doesn't populate for Google Workspace Add-ons that extend Google Chat. Instead, to receive function data like identifiers, add-ons that extend Chat should use the |
TimeZone
The timezone ID and offset from Coordinated Universal Time (UTC). Only supported for the event types CARD_CLICKED
and SUBMIT_DIALOG
.
JSON representation |
---|
{ "id": string, "offset": integer } |
Fields | |
---|---|
id |
The IANA TZ time zone database code, such as "America/Toronto". |
offset |
The user timezone offset, in milliseconds, from Coordinated Universal Time (UTC). |
Inputs
Types of data that users can input on cards or dialogs. The input type depends on the type of values that the widget accepts.
JSON representation |
---|
{ // Union field |
Fields | |
---|---|
Union field
|
|
stringInputs |
A list of strings that represent the values that the user inputs in a widget. If the widget only accepts one value, such as a |
dateTimeInput |
Date and time input values from a |
dateInput |
Date input values from a |
timeInput |
Time input values from a |
StringInputs
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.
JSON representation |
---|
{ "value": [ string ] } |
Fields | |
---|---|
value[] |
An list of strings entered by the user. |
DateTimeInput
Date and time input values.
JSON representation |
---|
{ "msSinceEpoch": string, "hasDate": boolean, "hasTime": boolean } |
Fields | |
---|---|
msSinceEpoch |
Time since epoch time, in milliseconds. |
hasDate |
Whether the |
hasTime |
Whether the |
DateInput
Date input values.
JSON representation |
---|
{ "msSinceEpoch": string } |
Fields | |
---|---|
msSinceEpoch |
Time since epoch time, in milliseconds. |
TimeInput
Time input values.
JSON representation |
---|
{ "hours": integer, "minutes": integer } |
Fields | |
---|---|
hours |
The hour on a 24-hour clock. |
minutes |
The number of minutes past the hour. Valid values are 0 to 59. |
AppCommandMetadata
Metadata about a Chat app command.
JSON representation |
---|
{
"appCommandId": integer,
"appCommandType": enum ( |
Fields | |
---|---|
appCommandId |
The ID for the command specified in the Chat API configuration. |
appCommandType |
The type of Chat app command. |