# Package google.apps.script.type.gmail

## Index

- `https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.script.type/gmail#google.apps.script.type.gmail.ComposeTrigger` (message)
- `https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.script.type/gmail#google.apps.script.type.gmail.ComposeTrigger.DraftAccess` (enum)
- `https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.script.type/gmail#google.apps.script.type.gmail.ContextualTrigger` (message)
- `https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.script.type/gmail#google.apps.script.type.gmail.GmailAddOnManifest` (message)
- `https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.script.type/gmail#google.apps.script.type.gmail.UnconditionalTrigger` (message)
- `https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.script.type/gmail#google.apps.script.type.gmail.UniversalAction` (message)

## ComposeTrigger

A trigger that activates when user is composing an email.

| Fields ||
|---|---|
| `actions[]` | `https://developers.google.com/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. |
| `draftAccess` | `https://developers.google.com/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. |

## 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: ||
| `unconditional` | `https://developers.google.com/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. |

## GmailAddOnManifest

Properties customizing the appearance and execution of a Gmail add-on.

| Fields ||
|---|---|
| `homepageTrigger` | `https://developers.google.com/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`. |
| `contextualTriggers[]` | `https://developers.google.com/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. |
| `universalActions[]` | `https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.script.type/gmail#google.apps.script.type.gmail.UniversalAction` Defines a set of [universal actions](https://developers.google.com/gmail/add-ons/how-tos/universal-actions) for the add-on. The user triggers universal actions from the add-on toolbar menu. |
| `composeTrigger` | `https://developers.google.com/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. |
| `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](https://developers.google.com/gmail/add-ons/how-tos/universal-actions) for details. |