Event

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.

JSON representation
{
  "type": enum (EventType),
  "eventTime": string,
  "token": string,
  "threadKey": string,
  "message": {
    object (Message)
  },
  "user": {
    object (User)
  },
  "space": {
    object (Space)
  },
  "action": {
    object (FormAction)
  },
  "configCompleteRedirectUrl": string,
  "isDialogEvent": boolean,
  "dialogEventType": enum (DialogEventType),
  "common": {
    object (CommonEventObject)
  }
}
Fields
type

enum (EventType)

The type of user interaction with the Chat app, such as MESSAGE or ADDED_TO_SPACE.

eventTime

string (Timestamp format)

The timestamp indicating when the interaction event occurred.

token

string

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

string

The Chat app-defined key for the thread related to the interaction event. See spaces.messages.thread.threadKey for more information.

message

object (Message)

For ADDED_TO_SPACE, CARD_CLICKED, and MESSAGE interaction events, the message that triggered the interaction event, if applicable.

user

object (User)

The user that interacted with the Chat app.

space

object (Space)

The space in which the user interacted with the Chat app.

action

object (FormAction)

For CARD_CLICKED interaction events, the form action data associated when a user clicks a card or dialog. To learn more, see Read form data input by users on cards.

configCompleteRedirectUrl

string

For MESSAGE interaction events, the URL that users must be redirected to after they complete an authorization or configuration flow outside of Google Chat. For more information, see Connect a Chat app with other services and tools.

isDialogEvent

boolean

For CARD_CLICKED and MESSAGE interaction events, whether the user is interacting with or about to interact with a dialog.

dialogEventType

enum (DialogEventType)

The type of dialog interaction event received.

common

object (CommonEventObject)

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

CommonEventObject

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.

JSON representation
{
  "userLocale": string,
  "hostApp": enum (HostApp),
  "platform": enum (Platform),
  "timeZone": {
    object (TimeZone)
  },
  "formInputs": {
    string: {
      object (Inputs)
    },
    ...
  },
  "parameters": {
    string: string,
    ...
  },
  "invokedFunction": string
}
Fields
userLocale

string

The full locale.displayName in the format of [ISO 639 language code]-[ISO 3166 country/region code] such as "en-US".

hostApp

enum (HostApp)

The hostApp enum which indicates the app the add-on is invoked from. Always CHAT for Chat apps.

platform

enum (Platform)

The platform enum which indicates the platform where the event originates (WEB, IOS, or ANDROID). Not supported by Chat apps.

timeZone

object (TimeZone)

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

formInputs

map (key: string, value: object (Inputs))

A map containing the values that a user inputs in a widget from a card or dialog. The map keys are the string IDs assigned to each widget, and the values represent inputs to the widget.

For details, see Process information inputted by users.

parameters

map (key: string, value: string)

Custom parameters passed to the invoked function. Both keys and values must be strings.

invokedFunction

string

Name of the invoked function associated with the widget. Only set for Chat apps.

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

string

The IANA TZ time zone database code, such as "America/Toronto".

offset

integer

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 inputs can be only one of the following:
  "stringInputs": {
    object (StringInputs)
  },
  "dateTimeInput": {
    object (DateTimeInput)
  },
  "dateInput": {
    object (DateInput)
  },
  "timeInput": {
    object (TimeInput)
  }
  // End of list of possible types for union field inputs.
}
Fields

Union field inputs.

inputs can be only one of the following:

stringInputs

object (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 TextInput widget, the list contains one string object. If the widget accepts multiple values, such as a SelectionInput widget of checkboxes, the list contains a string object for each value that the user inputs or selects.

dateTimeInput

object (DateTimeInput)

Date and time input values from a DateTimePicker widget that accepts both a date and time.

dateInput

object (DateInput)

Date input values from a DateTimePicker widget that only accepts date values.

timeInput

object (TimeInput)

Time input values from a DateTimePicker widget that only accepts time values.

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[]

string

An list of strings entered by the user.

DateTimeInput

Date and time input values.

JSON representation
{
  "msSinceEpoch": string,
  "hasDate": boolean,
  "hasTime": boolean
}
Fields
msSinceEpoch

string (int64 format)

Time since epoch time, in milliseconds.

hasDate

boolean

Whether the datetime input includes a calendar date.

hasTime

boolean

Whether the datetime input includes a timestamp.

DateInput

Date input values.

JSON representation
{
  "msSinceEpoch": string
}
Fields
msSinceEpoch

string (int64 format)

Time since epoch time, in milliseconds.

TimeInput

Time input values.

JSON representation
{
  "hours": integer,
  "minutes": integer
}
Fields
hours

integer

The hour on a 24-hour clock.

minutes

integer

The number of minutes past the hour. Valid values are 0 to 59.