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
string
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. trigger can be only one of the following:
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 addOns.common.homepageTrigger.
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 gmail.addons.current.action.compose scope even though it might not edit the draft.
authorizationCheckFunction
string
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
string
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_type can be only one of the following:
openLink
string
A link that is opened by Gmail when the user triggers the action.
runFunction
string
An endpoint that is called when the user triggers the action. See the universal actions guide for details.
[[["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-04-22 UTC."],[[["\u003cp\u003eThis documentation outlines the schema for Gmail add-ons, including triggers and actions.\u003c/p\u003e\n"],["\u003cp\u003eIt covers several trigger types like \u003ccode\u003eComposeTrigger\u003c/code\u003e, \u003ccode\u003eContextualTrigger\u003c/code\u003e, and \u003ccode\u003eUnconditionalTrigger\u003c/code\u003e which define when the add-on activates.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eGmailAddOnManifest\u003c/code\u003e describes the add-on's overall configuration, including triggers, homepage behavior, and universal actions.\u003c/p\u003e\n"],["\u003cp\u003eUniversal actions, defined by \u003ccode\u003eUniversalAction\u003c/code\u003e, are always available in the add-on toolbar, allowing users to perform actions like opening links or running functions.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can control data access levels and customize user interface elements through various fields and properties within these schemas.\u003c/p\u003e\n"]]],["The content outlines triggers and actions for Gmail add-ons. `ComposeTrigger` activates during email composition, defining actions and draft data access levels (None, Metadata). `ContextualTrigger` fires based on email criteria, executing an endpoint, with `UnconditionalTrigger` firing on any opened email. `GmailAddOnManifest` customizes the add-on, specifying homepage and contextual triggers, universal actions, and compose triggers. `UniversalAction` provides actions accessible from the add-on's toolbar, either opening a link or running an endpoint.\n"],null,["Index\n\n- [ComposeTrigger](/workspace/add-ons/reference/rpc/google.apps.script.type/gmail#google.apps.script.type.gmail.ComposeTrigger) (message)\n- [ComposeTrigger.DraftAccess](/workspace/add-ons/reference/rpc/google.apps.script.type/gmail#google.apps.script.type.gmail.ComposeTrigger.DraftAccess) (enum)\n- [ContextualTrigger](/workspace/add-ons/reference/rpc/google.apps.script.type/gmail#google.apps.script.type.gmail.ContextualTrigger) (message)\n- [GmailAddOnManifest](/workspace/add-ons/reference/rpc/google.apps.script.type/gmail#google.apps.script.type.gmail.GmailAddOnManifest) (message)\n- [UnconditionalTrigger](/workspace/add-ons/reference/rpc/google.apps.script.type/gmail#google.apps.script.type.gmail.UnconditionalTrigger) (message)\n- [UniversalAction](/workspace/add-ons/reference/rpc/google.apps.script.type/gmail#google.apps.script.type.gmail.UniversalAction) (message)\n\nComposeTrigger A trigger that activates when user is composing an email.\n\n| Fields ||\n|---------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `actions[]` | [MenuItemExtensionPoint](/workspace/add-ons/reference/rpc/google.apps.script.type#google.apps.script.type.MenuItemExtensionPoint) Defines the set of actions for a compose time add-on. These are actions that users can trigger on a compose time add-on. |\n| `draftAccess` | [DraftAccess](/workspace/add-ons/reference/rpc/google.apps.script.type/gmail#google.apps.script.type.gmail.ComposeTrigger.DraftAccess) Defines the level of data access when a compose time add-on is triggered. |\n\nDraftAccess An enum that defines the level of data access the compose trigger requires.\n\n| Enums ||\n|---------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `UNSPECIFIED` | Default value when nothing is set for draftAccess. |\n| `NONE` | The compose trigger can't access any data of the draft when a compose add-on is triggered. |\n| `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. |\n\nContextualTrigger 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.\n\n| Fields ||\n|---------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `onTriggerFunction` | `string` Required. The name of the endpoint to call when a message matches the trigger. |\n| Union field `trigger`. The type of trigger determines the conditions Gmail uses to show the add-on. `trigger` can be only one of the following: ||\n| `unconditional` | [UnconditionalTrigger](/workspace/add-ons/reference/rpc/google.apps.script.type/gmail#google.apps.script.type.gmail.UnconditionalTrigger) Unconditional triggers are executed when any mail message is opened. |\n\nGmailAddOnManifest Properties customizing the appearance and execution of a Gmail add-on.\n\n| Fields ||\n|------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `homepageTrigger` | [HomepageExtensionPoint](/workspace/add-ons/reference/rpc/google.apps.script.type#google.apps.script.type.HomepageExtensionPoint) 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 `addOns.common.homepageTrigger`. |\n| `contextualTriggers[]` | [ContextualTrigger](/workspace/add-ons/reference/rpc/google.apps.script.type/gmail#google.apps.script.type.gmail.ContextualTrigger) Defines the set of conditions that trigger the add-on. |\n| `universalActions[]` | [UniversalAction](/workspace/add-ons/reference/rpc/google.apps.script.type/gmail#google.apps.script.type.gmail.UniversalAction) Defines a set of [universal actions](/gmail/add-ons/how-tos/universal-actions) for the add-on. The user triggers universal actions from the add-on toolbar menu. |\n| `composeTrigger` | [ComposeTrigger](/workspace/add-ons/reference/rpc/google.apps.script.type/gmail#google.apps.script.type.gmail.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 `gmail.addons.current.action.compose` scope even though it might not edit the draft. |\n| `authorizationCheckFunction` | `string` 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. |\n\nUnconditionalTrigger\n\nThis type has no fields.\nA trigger that fires when any email message is opened.\n\nUniversalAction An action that is always available in the add-on toolbar menu regardless of message context.\n\n| Fields ||\n|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `text` | `string` Required. User-visible text describing the action, for example, \"Add a new contact.\" |\n| Union field `action_type`. The type of the action determines the behavior of Gmail when the user invokes the action. `action_type` can be only one of the following: ||\n| `openLink` | `string` A link that is opened by Gmail when the user triggers the action. |\n| `runFunction` | `string` An endpoint that is called when the user triggers the action. See the [universal actions guide](/gmail/add-ons/how-tos/universal-actions) for details. |"]]