Class 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.
Implements
Inherited Members
Namespace: Google.Apis.HangoutsChat.v1.Data
Assembly: Google.Apis.HangoutsChat.v1.dll
Syntax
public class CommonEventObject : IDirectResponseSchema
Properties
ETag
The ETag of the item.
Declaration
public virtual string ETag { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
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 [""] after the value. For example, instead of
e.commonEventObject.formInputs.employeeName.stringInputs.value[0], format the event object as
e.commonEventObject.formInputs.employeeName[""].stringInputs.value[0]. To learn more about runtimes in
Apps Script, see the V8 Runtime Overview. *
Single-valued widgets (for example, a text box): a list of strings (only one element). Example: for a
text input widget with employeeName as its ID, access the text input value with:
e.commonEventObject.formInputs.employeeName.stringInputs.value[0]. * Multi-valued widgets (for example,
checkbox groups): a list of strings. Example: for a multi-value widget with participants as its ID,
access the value array with: e.commonEventObject.formInputs.participants.stringInputs.value. * A
date-time picker: a DateTimeInput object.
Example: For a picker with an ID of myDTPicker, access the
DateTimeInput
object using e.commonEventObject.formInputs.myDTPicker.dateTimeInput. * A date-only picker: a
DateInput object.
Example: For a picker with an ID of myDatePicker, access the
DateInput object
using e.commonEventObject.formInputs.myDatePicker.dateInput. * A time-only picker: a TimeInput object. Example:
For a picker with an ID of myTimePicker, access the
TimeInput object
using e.commonEventObject.formInputs.myTimePicker.timeInput.
Declaration
[JsonProperty("formInputs")]
public virtual IDictionary<string, Inputs> FormInputs { get; set; }
Property Value
| Type | Description |
|---|---|
| IDictionary<string, Inputs> |
HostApp
Indicates the host app the add-on is active in when the event object is generated. Possible values include
the following: * GMAIL * CALENDAR * DRIVE * DOCS * SHEETS * SLIDES * CHAT
Declaration
[JsonProperty("hostApp")]
public virtual string HostApp { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
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
parameters field. See Build interactive interfaces for Chat
apps.
Declaration
[JsonProperty("invokedFunction")]
public virtual string InvokedFunction { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Parameters
Any additional parameters you supply to an action using
actionParameters
or
Action.setParameters().
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 "autocomplete_widget_query" key
(event.commonEventObject.parameters["autocomplete_widget_query"]). You can use this value to query a
database and suggest selectable items to users as they type. For details, see Collect and process
information from Google Chat
users.
Declaration
[JsonProperty("parameters")]
public virtual IDictionary<string, string> Parameters { get; set; }
Property Value
| Type | Description |
|---|---|
| IDictionary<string, string> |
Platform
The platform enum which indicates the platform where the event originates (WEB, IOS, or ANDROID). Not
supported by Chat apps.
Declaration
[JsonProperty("platform")]
public virtual string Platform { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
TimeZone
Disabled by default. The timezone ID and offset from Coordinated Universal Time (UTC). To turn on this
field, you must set addOns.common.useLocaleFromApp to true in your add-on's manifest. Your add-on's
scope list must also include https://www.googleapis.com/auth/script.locale. See Accessing user locale and
timezone for more details. Only
supported for the event types
CARD_CLICKED
and
SUBMIT_DIALOG.
Declaration
[JsonProperty("timeZone")]
public virtual TimeZone TimeZone { get; set; }
Property Value
| Type | Description |
|---|---|
| TimeZone |
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, en-US. To turn on this field,
you must set addOns.common.useLocaleFromApp to true in your add-on's manifest. Your add-on's scope list
must also include https://www.googleapis.com/auth/script.locale. See Accessing user locale and
timezone for more details.
Declaration
[JsonProperty("userLocale")]
public virtual string UserLocale { get; set; }
Property Value
| Type | Description |
|---|---|
| string |