AI-generated Key Takeaways
- 
          This documentation outlines the schema for Gmail add-ons, including triggers and actions. 
- 
          It covers several trigger types like ComposeTrigger,ContextualTrigger, andUnconditionalTriggerwhich define when the add-on activates.
- 
          GmailAddOnManifestdescribes the add-on's overall configuration, including triggers, homepage behavior, and universal actions.
- 
          Universal actions, defined by UniversalAction, are always available in the add-on toolbar, allowing users to perform actions like opening links or running functions.
- 
          Developers can control data access levels and customize user interface elements through various fields and properties within these schemas. 
Index
- ComposeTrigger(message)
- ComposeTrigger.DraftAccess(enum)
- ContextualTrigger(message)
- GmailAddOnManifest(message)
- UnconditionalTrigger(message)
- UniversalAction(message)
ComposeTrigger
A trigger that activates when user is composing an email.
| Fields | |
|---|---|
| actions[] | Defines the set of actions for a compose time add-on. These are actions that users can trigger on a compose time add-on. | 
| draftAccess | Defines the level of data access when a compose time add-on is triggered. | 
DraftAccess
An enum that defines the level of data access the compose trigger requires.
| Enums | |
|---|---|
| UNSPECIFIED | Default value when nothing is set for draftAccess. | 
| NONE | The compose trigger can't access any data of the draft when a compose add-on is triggered. | 
| METADATA | Gives the compose trigger the permission to access the metadata of the draft when a compose add-on is triggered. This includes the audience list, such as the To and Cc list of a draft message. | 
ContextualTrigger
Defines a trigger that fires when the open email meets a specific criteria. When the trigger fires, it executes a specific endpoint, usually in order to create new cards and update the UI.
| Fields | |
|---|---|
| onTriggerFunction | 
 Required. The name of the endpoint to call when a message matches the trigger. | 
| Union field trigger. The type of trigger determines the conditions Gmail uses to show the add-on.triggercan be only one of the following: | |
| unconditional | Unconditional triggers are executed when any mail message is opened. | 
GmailAddOnManifest
Properties customizing the appearance and execution of a Gmail add-on.
| Fields | |
|---|---|
| homepageTrigger | Defines an endpoint that will be executed in contexts that don't match a declared contextual trigger. Any cards generated by this function will always be available to the user, but may be eclipsed by contextual content when this add-on declares more targeted triggers. If present, this overrides the configuration from  | 
| contextualTriggers[] | Defines the set of conditions that trigger the add-on. | 
| universalActions[] | Defines a set of universal actions for the add-on. The user triggers universal actions from the add-on toolbar menu. | 
| composeTrigger | Defines the compose time trigger for a compose time add-on. This is the trigger that causes an add-on to take action when the user is composing an email. All compose time add-ons must have the  | 
| authorizationCheckFunction | 
 The name of an endpoint that verifies that the add-on has all the required third-party authorizations, by probing the third-party APIs. If the probe fails, the function should throw an exception to initiate the authorization flow. This function is called before each invocation of the add-on in order to ensure a smooth user experience. | 
UnconditionalTrigger
This type has no fields.
A trigger that fires when any email message is opened.
UniversalAction
An action that is always available in the add-on toolbar menu regardless of message context.
| Fields | |
|---|---|
| text | 
 Required. User-visible text describing the action, for example, "Add a new contact." | 
| Union field action_type. The type of the action determines the behavior of Gmail when the user invokes the action.action_typecan be only one of the following: | |
| openLink | 
 A link that is opened by Gmail when the user triggers the action. | 
| runFunction | 
 An endpoint that is called when the user triggers the action. See the universal actions guide for details. |