Stay organized with collections Save and categorize content based on your preferences.
This page outlines the structure of Google Workspace add-ons event objects.
Event objects are JSON structures that are automatically constructed and passed as parameters to trigger or callback functions when a user interacts with an add-on. Event objects carry client-side information about the host app and the current context to the add-on's server-side callback function.
Google Workspace add-ons use event objects in the following places:
Homepage triggers. Every homepageTrigger
function you define is automatically passed an event object when the homepage trigger function fires. You can use this object in your homepage trigger function to identify the active host app, the client's platform, the user locale, and other information.
The event objects created when homepage triggers fire don't contain all the fields included in the other two cases; fields pertaining to widgets and contextual information are omitted.
Contextual triggers. Each host application provides a different set of contextual triggers that fire when the user enters a specific context. For example:
When a contextual trigger fires, the host application calls the corresponding runFunction
listed in the add-on manifest, passing it an event object as a parameter. The event objects created when contextual triggers fire contain all the fields included in homepage trigger event objects, plus fields containing contextual information.
Widget actions. Event objects are also used to provide widget interactivity, using the same action model that Gmail add-ons use. Google Workspace add-ons use all the same widget handler functions, Action
objects, and action responses. However, in Google Workspace add-ons the action event objects include even more information a callback function can act on.
The event objects created as the result of widget actions contain all the fields included in contextual trigger event objects, plus fields containing widget information.
Preview link triggers. In Google Docs, Sheets, and Slides, you can configure link previews for third-party services based on specific URL patterns. When users interact with a link that meets the pattern, the linkPreviewTriggers
fires and an event object that contains the link is passed to the trigger's callback function. Your add-on can use this event object to construct a smart chip and card that surfaces information about the link within the host application. You can also build widget actions to let users interact with the preview card and its contents.
Google Chat app triggers. In Google Chat, your add-on appears to users as a Chat app, and users can interact with it by adding it to spaces, sending messages, using slash commands, and more. To build interactive features, you set up and use various Chat app triggers. Each trigger sends a different event object payload that helps you process or respond to each type of interaction.
The following table describes the top-level structure of Google Workspace add-ons event objects. The event object structure includes a commonEventObject
top-level field for host-independent information. Each event object can also have one of the following host-specific top-level fields, determined by the active host app: gmailEventObject
, calendarEventObject
, or driveEventObject
.
For backward compatibility, Google Workspace add-ons event objects also include all the original fields used in Gmail add-on action event objects. These fields are listed in the table below under "Original Gmail add-on fields"; the information in these fields is reproduced in new object structure.
Note: The "Original Gmail add-on fields" described below are deprecated. When developing or migrating a Google Workspace add-on, prefer using the newer event object structure to the Gmail add-on fields. Eventually we will remove the older Gmail add-on event object fields. Event objecteventObject.commonEventObject
Common fields object
eventObject.calendar
Calendar event object
eventObject.chat
Chat event object
eventObject.drive
Drive event object
eventObject.gmail
Gmail event object
eventObject.docs
Docs event object
eventObject.sheets
Sheets event object
eventObject.slides
Slides event object
eventObject.messageMetadata.accessToken
string
For Google Workspace add-ons, find this information in the eventObject.gmail.accessToken
field.
eventObject.messageMetadata.messageId
string
For Google Workspace add-ons, find this information in the eventObject.gmail.messageId
field.
eventObject.clientPlatform
string
For Google Workspace add-ons, find this information in the eventObject.commonEventObject.platform
field.
eventObject.formInput
object
formInput
as a convenience for when you need to read data from multiple widgets with expected singular values, such as text inputs and switches. For multi-valued widgets such as checkboxes, you can read each value from formInputs
instead.
commonEventObject.formInputs
instead.
For Google Workspace add-ons, find this information in the eventObject.commonEventObject.formInputs
field instead; widgets with single values are represented as arrays with a single element.
eventObject.formInputs
object
commonEventObject.formInputs
instead.
For Google Workspace add-ons, find this information in the eventObject.commonEventObject.formInputs
field.
eventObject.parameters
object
Action
using Action.setParameters()
. The map keys and values are strings.
For Google Workspace add-ons, find this information in the eventObject.commonEventObject.parameters
field.
eventObject.userCountry
string
For Google Workspace add-ons, find this information in the eventObject.commonEventObject.userLocale
field.
eventObject.userLocale
string
For Google Workspace add-ons, find this information in the eventObject.commonEventObject.userLocale
field.
eventObject.userTimezone.id
string
America/New_York
, Europe/Vienna
, and Asia/Seoul
. See Accessing user locale and timezone for more details.
For Google Workspace add-ons, find this information in the eventObject.commonEventObject.timeZone.id
field.
eventObject.userTimezone.offset
string
For Google Workspace add-ons, find this information in the eventObject.commonEventObject.timeZone.offset
field.
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.
commonEventObject.platform
string
commonEventObject.formInputs
object
The structure of the map value object is dependent on the widget type:
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.
Example: for a text input widget with employeeName
as its ID, access the text input value with: e.commonEventObject.formInputs.employeeName.stringInputs.value[0]
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
.
commonEventObject.hostApp
string
GMAIL
CALENDAR
DRIVE
DOCS
SHEETS
SLIDES
commonEventObject.parameters
object
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.
commonEventObject.userLocale
string
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.
commonEventObject.timeZone
string
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. commonEventObject.timeZone.id
string
America/New_York
, Europe/Vienna
, and Asia/Seoul
. 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. commonEventObject.timeZone.offset
string
Action callback functions can receive current widget values in the commonEventObject.formInputs
field. This includes the user's selected date or time values in date or time picker widgets. However, the structure of the information differs depending on whether the widget was configured as a date-time picker, a date-only picker, or a time-only picker. The structural differences are described in the following table:
dateTimeInput.hasDate
boolean
true
if the input date time includes a date; if false
only a time is included. dateTimeInput.hasTime
boolean
true
if the input date time includes a time; if false
only a date is included. dateTimeInput.msSinceEpoch
string
dateInput.msSinceEpoch
string
timeInput.hours
number
timeInput.minutes
number
The Chat event object is the portion of the overall event object that carries information about a user's interactions with a Chat app. It's only present in an event object if the add-on extends Google Chat.
Chatchat.user
object (User)
chat.space
object (Space)
chat.eventTime
string (
Timestamp
format)
Union field payload
.
payload
can be only one of the following:
chat.messagePayload
object (
MessagePayload
)
The payload that Chat apps receive from a Message trigger.
chat.addedToSpacePayload
object (
AddedToSpacePayload
)
The payload that Chat apps receive from an Added to space trigger.
chat.removedFromSpacePayload
object (
RemovedFromSpacePayload
)
The payload that Chat apps receive from a Removed from space trigger.
chat.buttonClickedPayload
object (
ButtonClickedPayload
)
The payload that Chat apps receive when users click a button from a message or card. If a user clicks a button to submit information, the commonEventObject.formInputs
object contains the values collected from the user. For details, see Collect information from Google Chat users.
chat.widgetUpdatedPayload
object (
WidgetUpdatedPayload
)
The payload that Chat apps receive when users type text into the multiselect menu of a selectionInput
widget. Chat apps can use this event object to populate suggested items from a dynamic data source. For example, to populate support cases from an external data source, a Chat app can query the data source based on what the user types into the menu, and then return any matching support cases as selectable items.
The CommonEventObject.parameters['autocomplete_widget_query']
object contains the string value that the user types into the menu.
chat.appCommandPayload
object (
AppCommandPayload
)
The payload that Chat apps receive when a user uses a command from the Chat app.
PayloadDepending on the type of Chat app interaction, the event contains a payload with one or more Chat API resources.
Message payload MessagePayloadchat.messagePayload.message
object (Message)
chat.messagePayload.space
object (Space)
chat.messagePayload.configCompleteRedirectUri
string
chat.addedToSpacePayload.space
object (Space)
When administrators install Chat apps, the space.adminInstalled
field is set to true
.
chat.addedToSpacePayload.interactionAdd
boolean
true
, Chat sends another event object with a messagePayload
that contains information about the message. chat.addedToSpacePayload.configCompleteRedirectUri
string
chat.removedFromSpacePayload.space
object (Space)
When administrators uninstall Chat apps, the space.adminInstalled
field is set to false
.
chat.buttonClickedPayload.message
object (Message)
chat.buttonClickedPayload.space
object (Space)
chat.buttonClickedPayload.isDialogEvent
boolean
chat.buttonClickedPayload.dialogEventType
enum (DialogEventType)
isDialogEvent
is true
, the type of interaction in a dialog.
Enum DialogEventType
.
Value of dialogEventType
can be only one of the following:
TYPE_UNSPECIFIED
Default value. Unspecified. REQUEST_DIALOG
A user requests a dialog. For example, they use a command or click a button from a message. SUBMIT_DIALOG
A user clicks an interactive element within a dialog. For example, a user fills out information in a dialog and clicks a button to submit the information. Widget updated payload WidgetUpdatedPayload chat.widgetUpdatedPayload.space
object (Space)
chat.appCommandPayload.appCommandMetadata
object (AppCommandMetadata)
chat.appCommandPayload.space
object (Space)
chat.appCommandPayload.thread
object (Thread)
chat.appCommandPayload.message
object (Message)
chat.appCommandPayload.configCompleteRedirectUri
string
chat.appCommandPayload.isDialogEvent
boolean
chat.appCommandPayload.dialogEventType
enum (DialogEventType)
Enum DialogEventType
.
Value of dialogEventType
can be only one of the following:
TYPE_UNSPECIFIED
Default value. Unspecified. REQUEST_DIALOG
A user requests a dialog. For example, they use a command or click a button from a message. SUBMIT_DIALOG
A user clicks an interactive element within a dialog. For example, a user fills out information in a dialog and clicks a button to submit the information. App Command Metadata AppCommandMetadata chat.appCommandPayload.appCommandMetadata.appCommandId
string (int64 format)
The command ID.
chat.appCommandPayload.appCommandMetadata.appCommandType
enum (AppCommandType)
Enum AppCommandType
.
Value of AppCommandType
can be only one of the following:
APP_COMMAND_TYPE_UNSPECIFIED
Default value. Unspecified. SLASH_COMMAND
A user uses the command by sending a message that begins with a slash /
. QUICK_COMMAND
The user selects the command from the Chat menu in the message reply area. Calendar event object
The Calendar event object is the portion of the overall event object that carries information about a user's calendar and calendar events. It's only present in an event object if the add-on extends Google Calendar.
The following table lists the fields present in the calendarEventObject
field of an event object. Fields marked as User-generated data are present in the event object if and only if the data is present in the Calendar event and the add-on sets its addOns.calendar.currentEventAccess
manifest field to READ
or READ_WRITE
.
calendar.attendees[]
list of attendee objects
calendar.calendarId
string
calendar.capabilities
object
calendar.capabilities.canAddAttendees
boolean
true
if the add-on can add new attendees to the event attendee list; false
otherwise. calendar.capabilities.canSeeAttendees
boolean
true
if the add-on can read the event attendee list; false
otherwise. calendar.capabilities.canSeeConferenceData
boolean
true
if the add-on can read the event conference data; false
otherwise. calendar.capabilities.canSetConferenceData
boolean
true
if the add-on can update the event conference data; false
otherwise. calendar.capabilities.canAddAttachments
boolean
true
if the add-on can add new attachments to the event; false
otherwise. calendar.conferenceData
Conference data object
calendar.id
string
calendar.organizer
object
calendar.organizer.email
string
calendar.recurringEventId
string
Attendee objects carry information about individual attendees to Google Calendar events. This information is present in the event object if and only if the data is present in the Calendar event and the add-on sets its addOns.calendar.currentEventAccess
manifest field to READ
or READ_WRITE
.
attendee.additionalGuests
number
attendee.comment
string
attendee.displayName
string
attendee.email
string
attendee.optional
boolean
true
if the attendance for this attendee is marked as optional; false
otherwise. attendee.organizer
boolean
true
if the attendee is an organizer for this event. attendee.resource
boolean
true
if the attendee represents a resource, such as room or piece of equipment; false
otherwise. attendee.responseStatus
string
accepted
: The attendee has accepted the event invitation.declined
: The attendee has declined the event invitation.needsAction
: The attendee has not responded to the event invitation.tentative
: The attendee has tentatively accepted the event invitation.attendee.self
boolean
true
if this attendee represents the calendar in which this event appears; false
otherwise. Conference data
Conference data objects carry information about conferences that are attached to Google Calendar events. These can be Google conference solutions, such as Google Meet, or third-party conferences. This information is present in the event object if and only if the data is present in the Calendar event and the add-on sets its addOns.calendar.currentEventAccess
manifest field to READ
or READ_WRITE
.
conferenceData.conferenceId
string
conferenceData.conferenceSolution
object
conferenceData.conferenceSolution.iconUri
string
conferenceData.conferenceSolution.key
object
conferenceData.conferenceSolution.key.type
string
eventHangout
for Hangouts for consumers (http://hangouts.google.com).eventNamedHangout
for classic Hangouts for Google Workspace users (http://hangouts.google.com).hangoutsMeet
for Google Meet (http://meet.google.com).conferenceData.conferenceSolution.name
string
conferenceData.entryPoints[]
list of entry point objects
conferenceData.notes
string
conferenceData.parameters
object
conferenceData.parameters.addOnParameters
object
Entry point objects carry information about the established means of accessing a given conference, such as by phone or video. This information is present in the event object if and only if the data is present in the Calendar event and the add-on sets its addOns.calendar.currentEventAccess
manifest field to READ
or READ_WRITE
.
entryPoint.accessCode
string
accessCode
, meetingCode
, passcode
, password
, pin
} to provide access to conferences. Match and only ever display the fields the conference provider uses. entryPoint.entryPointFeatures
list
phone
entry points:
toll
: The entry point is a toll phone call.toll_free
: The entry point is a toll-free phone call.entryPoint.entryPointType
string
more
: Additional conference joining instructions, such as alternate phone numbers. A conference can only have one more
entry point; if present at least one other type of entry point is also required.phone
: Join the conference via a phone number. A conference can have zero or more phone
entry points. Google Calendar only displays the first two phone entry points, after formatting and sorting alphabetically.sip
: Join the conference over SIP. A conference can have at most one sip
entry point.video
: Join the conference over HTTP. A conference can have at most one video
entry point.entryPoint.label
string
entryPoint.meetingCode
string
accessCode
, meetingCode
, passcode
, password
, pin
} to provide access to conferences. Match and only ever display the fields the conference provider uses. entryPoint.passcode
string
accessCode
, meetingCode
, passcode
, password
, pin
} to provide access to conferences. Match and only ever display the fields the conference provider uses. entryPoint.password
string
accessCode
, meetingCode
, passcode
, password
, pin
} to provide access to conferences. Match and only ever display the fields the conference provider uses. entryPoint.pin
string
accessCode
, meetingCode
, passcode
, password
, pin
} to provide access to conferences. Match and only ever display the fields the conference provider uses. entryPoint.regionCode
string
entryPoint.uri
string
more
: A http:
or https:
schema is required.phone
: A tel:
schema is required. The URI should include the entire dial sequence (for example, "tel:+12345678900,,,12345678;1234").sip
: A sip:
or sips:
schema is required. For example "sip:12345678@myprovider.com".video
: A http:
or https:
schema is required.The Drive event object is the portion of the overall event object that carries information about a user's Google Drive and its contents. It's only present in an event object if the add-on extends Google Drive.
Drive event objectdrive.activeCursorItem
Drive item object
drive.selectedItems[]
list of Drive item objects
Drive item objects carry information about specific Drive items, such as files or folders.
Drive item objectitem.addonHasFileScopePermission
boolean
true
, the add-on has requested and received https://www.googleapis.com/auth/drive.file
scope authorization for this item; otherwise this field is false
. If the add-on uses a more permissive scope such as https://www.googleapis.com/auth/drive
or https://www.googleapis.com/auth/drive.readonly
, this field isn't relevant.
item.id
string
item.iconUrl
string
item.mimeType
string
item.title
string
The Gmail event object is the portion of the overall event object that carries information about a user's Gmail messages. It's only present in an event object if the host application is Gmail.
Gmail event objectgmail.accessToken
string
GmailApp.setCurrentMessageAccessToken(accessToken)
method to grant your add-on temporary access to a user's currently open Gmail message or let your add-on compose new drafts. gmail.bccRecipients[]
list of strings
addOns.gmail.composeTrigger.draftAccess
field in your manifest to METADATA
. gmail.ccRecipients[]
list of strings
addOns.gmail.composeTrigger.draftAccess
field in your manifest to METADATA
. gmail.messageId
string
gmail.threadId
string
gmail.toRecipients[]
list of strings
addOns.gmail.composeTrigger.draftAccess
field in your manifest to METADATA
. Docs event object
The Docs event object is the portion of the overall event object that carries information about a user's document and its contents. It's only present in an event object if the add-on extends Google Docs.
Docs event objectdocs.id
string
https://www.googleapis.com/auth/drive.file
scope has been authorized by the user.
docs.title
string
https://www.googleapis.com/auth/drive.file
scope has been authorized by the user.
docs.addonHasFileScopePermission
boolean
true
, the add-on has requested and received https://www.googleapis.com/auth/drive.file
scope authorization for the document open in the Docs UI; otherwise this field is false
. docs.matchedUrl.url
string
https://www.googleapis.com/auth/workspace.linkpreview
has been authorized by the user.LinkPreviewTriggers
trigger.LinkPreviewTriggers
in your add-on’s manifest. See Preview links with smart chips for more details.
Example payload for when a user previews the link https://www.example.com/12345
:
"docs" : { "matchedUrl" : { "url" : "https://www.example.com/12345" } }Sheets event object
The Sheets event object is the portion of the overall event object that carries information about a user's document and its contents. It's only present in an event object if the add-on extends Google Sheets.
Sheets event objectsheets.id
string
https://www.googleapis.com/auth/drive.file
scope has been authorized by the user. The ID of the spreadsheet open in the Sheets UI. sheets.title
string
https://www.googleapis.com/auth/drive.file
scope has been authorized by the user. The title of the spreadsheet open in the Sheets UI. sheets.addonHasFileScopePermission
boolean
true
, the add-on has requested and received https://www.googleapis.com/auth/drive.file
scope authorization for the spreadsheet open in the Sheets UI; otherwise this field is false
. sheets.matchedUrl.url
string
https://www.googleapis.com/auth/workspace.linkpreview
has been authorized by the user.LinkPreviewTriggers
trigger.LinkPreviewTriggers
in your add-on’s manifest. See Preview links with smart chips for more details.
Example payload for when a user previews the link https://www.example.com/12345
:
"sheets" : { "matchedUrl" : { "url" : "https://www.example.com/12345" } }Slides event object
The Slides event object is the portion of the overall event object that carries information about a user's document and its contents. It's only present in an event object if the add-on extends Google Slides.
Slides event objectslides.id
string
https://www.googleapis.com/auth/drive.file
scope has been authorized by the user. The ID of the presentation open in the Slides UI. slides.title
string
https://www.googleapis.com/auth/drive.file
scope has been authorized by the user. The title of the presentation open in the Slides UI. slides.addonHasFileScopePermission
boolean
true
, the add-on has requested and received https://www.googleapis.com/auth/drive.file
scope authorization for the presentation open in the Slides UI; otherwise this field is false
. slides.matchedUrl.url
string
https://www.googleapis.com/auth/workspace.linkpreview
has been authorized by the user.LinkPreviewTriggers
trigger.LinkPreviewTriggers
in your add-on’s manifest. See Preview links with smart chips for more details.
Example payload for when a user previews the link https://www.example.com/12345
:
"slides" : { "matchedUrl" : { "url" : "https://www.example.com/12345" } }
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-06 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-06 UTC."],[[["Event objects are JSON structures that provide context and user interaction data to Google Workspace add-ons."],["They consist of a `commonEventObject` for general information and host-specific objects like `calendarEventObject` or `driveEventObject`."],["Developers should prioritize the new event structure and avoid deprecated Gmail add-on fields."],["Accessing event object data depends on widget type, host app, and required permissions defined in the manifest."],["Understanding the structure of `formInputs`, calendar event details, attendee information, and Drive item data is crucial for effective add-on functionality."]]],["Google Workspace add-ons use JSON event objects passed to trigger functions upon user interaction. These objects carry client-side data about the host app, context, and user locale. Event objects are generated during homepage, contextual, widget actions, and link preview triggers, and Google Chat app interactions. They include common fields like `platform`, `formInputs`, and `hostApp`, along with host-specific data. Calendar events carry attendees and conference information, Drive events include selected item details, Gmail includes message data, and Docs, Sheets, and Slides include document metadata.\n"]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4