Manifests for Gmail add-ons

An Apps Script project uses a manifest file to configure certain details about the script and its operation. A manifest is a special JSON-formatted file that is hidden in your script project by default; in most cases, Apps Script automatically adjusts the manifest in response to actions you take in the Apps Script editor. For example, if you add a library to a script project, the relevant details of that library are added to the manifest behind the scenes for you. See Manifest structure for a list of properties an Apps Script project can define in its manifest.

Sometimes it is helpful or necessary to edit a manifest directly. For example, if you intend to publish an add-on you must configure your add-on's manifest to always use the narrowest scopes possible. See Setting explicit scopes for more details.

This documentation covers the details of configuring a manifest for a Gmail add-on.

Editing a manifest

The Apps Script editor hides manifest files by default in order to protect your Apps Script project settings. Follow these steps to make a hidden project manifest visible in the Apps Script editor:

  1. Open the script project in the Apps Script editor.
  2. Select View > Show project manifest.

The manifest file appears as a project file named appsscript.json. You can edit this file directly in the editor and save any changes you make. To hide the manifest file after you are finished, select View > Show project manifest again.

Manifest structure for Gmail add-ons

Gmail add-ons use a manifest file to define several aspects of the add-on's appearence and behavior. These manifest properties are organized under the gmail section of manifest object structure.

The following manifest file example snippet shows the section of a manifest file that defines a Gmail add-on. The gmail section of the manifest defines the name, logo URL, colors, and other settings for a Gmail add-on.

  "oauthScopes": [
  "urlFetchWhitelist": [
  "gmail": {
    "name": "My Gmail Add-on",
    "logoUrl": "",
    "primaryColor": "#4285F4",
    "secondaryColor": "#00BCD4",
    "authorizationCheckFunction": "get3PAuthorizationUrls",
    "contextualTriggers": [{
      "unconditional": {},
      "onTriggerFunction": "buildAddOn"
    "composeTrigger": {
      "selectActions": [
          "text": "Add images to email",
          "runFunction": "getInsertImageComposeCards"
      "draftAccess": "METADATA"
    "openLinkUrlPrefixes": [
    "universalActions": [{
      "text": "Open settings",
      "runFunction": "getSettingsCard"
     }, {
      "text": "Open help page",
      "openLink": ""
    "useLocaleFromApp": true

The table below describes the manifest structure of fields under the gmail, oauthScopes, and urlFetchWhitelist sections. Gmail add-on manifests must have all the components marked as Required.

Property name Value Description
oauthScopes[] string Required. Defines the authorization scopes used by the add-on, some of which are required.
urlFetchWhitelist[] string Required if any URL is accessed via UrlFetch. A list of HTTPS URL prefixes. To protect user data, any URL endpoint fetched must match one of the prefixes in this list. This list must include any endpoint used in conjunction with authorizing third-party services.

See Whitelisting URLs for more details.

gmail object Required. Defines values specific to Gmail add-ons.
gmail.authorizationCheckFunction string The name of an Apps Script function that performs third-party authorization requirement checks. This function is called before each invocation of the add-on. You can use it to ensure that the add-on is authorized to use each third-party service prior to any other add-on activity.
gmail.composeTrigger object Required for compose actions. Defines the set of UIs available to the user while composing an email.

See Extending the compose UI with compose actions for details.

gmail.composeTrigger.draftAccess string Defines the level of data access available to a compose trigger function. Valid options are the following:
  • NONE, the default setting. This causes the event object passed to the compose trigger function to be mostly empty.
  • METADATA, which populates the event object passed to the compose trigger function with lists of recipients of the message. This setting requires that the add-on include the gmail.addons.current.message.metadata scope.
gmail.composeTrigger.selectActions[] list Required for compose actions. A list of compose actions that create compose UIs; however, this list is limited to a single action per add-on. The compose action has a corresponding icon presented in the Gmail compose window. The icon is specified by gmail.logoUrl.
gmail.composeTrigger.selectActions[].text string Required for compose actions. A short text description of this compose action.
gmail.composeTrigger.selectActions[].runFunction string Required for compose actions. The name of the Apps Script function that executes when this compose action is selected. This compose trigger function builds the add-on compose UI.

See Compose trigger function for details.

gmail.contextualTriggers[] list Required. Defines a trigger that fires when the open email meets a specific criteria. When the trigger fires, it executes a specific Apps Script function, usually in order to create new cards and update the UI.
gmail.contextualTriggers[].onTriggerFunction string Required for each contextual trigger. The name of the Apps Script function that to executes when the trigger fires.

See Contextual trigger function for details on how to define this function.

gmail.contextualTriggers[].unconditional object Required for each contextual trigger. Used to specify that the add-on is executed for all Gmail messages. This is currently the only option, so this should always be an empty object.
gmail.logoUrl string Required. The URL of the image shown in the toolbar. string Required. The name of the add-on shown in the toolbar.
gmail.openLinkUrlPrefixes[] list Required if the add-on displays any outbound links, whether within widgets using an OpenLink or text widget using HTML anchor tags. A list of HTTPS URL prefixes. To protect user data, any link rendered by the add-on must match one of the prefixes in this list.

See Whitelisting URLs for more details.

gmail.primaryColor string The color of toolbar. Defaults to grey (#424242).
gmail.secondaryColor string The color of buttons. Defaults to the primary color (if it is set); otherwise defaults to blue (#2196F3).
gmail.universalActions[] list List of universal actions that are always available in the add-on UI. Every add-on must define either a contextual trigger, a set of universal actions, or both.
gmail.universalActions[].openLink string Required for each universal action if runFunction is not present. If provided, the URL that is opened in a tab when the user selects this action.
gmail.universalActions[].runFunction string Required for each universal action if openLink is not present. If provided, the name of the Apps Script function that executes when the user selects this action.

See the Universal actions guide for details.

gmail.universalActions[].text string Required for each universal action. The text shown in the UI menu for this action.
gmail.useLocaleFromApp boolean If true, action event objects passed to action callback functions include the locale and timezone information of the user. Defaults to false.

See Accessing user locale and timezones for more details.

Whitelisting URLs

Sometimes you may want your Gmail add-on to open a URL in response to a user action. Other times you may want your add-on to retrieve information from an external location using the Apps Script UrlFetch service. In both cases you must whitelist the URLs you open or fetch from in the project manifest. Whitelisting is the process where you designate specific URLs that are pre-approved for access by your add-on. This requirement helps protect user data; add-ons can't access URLs that have not been whitelisted.

You can whitelist a URL for opening by adding it or a matching prefix to the manifest gmail.openLinkUrlPrefixes field. Similarly, you can whitelist a URL for fetching by adding it or a matching prefix to the manifest urlFetchWhitelist field.

The prefixes you add to the manifest must satisfy the following requirements:

  • Each prefix must be a valid URL.
  • Each prefix must use https://, not http://.
  • Each prefix must have a full domain.
  • Each prefix must have a non-empty path. For example, is valid but is not.
  • You can use wildcards to match URL subdomain prefixes.
  • A single * wildcard can be used in the gmail.openLinkUrlPrefixes field to match all links, but this is not recommended as it can expose a user's data to risk and can prolong the add-on review process. Only use a wildcard if your add-on functionality requires it.

When determining if a URL matches a whitelisted prefix, the following rules apply:

  • Path matching is case-sensitive.
  • If the prefix is identical to the URL, it is a match.
  • If the URL is the same or a child of the prefix, it is a match.

For example, the prefix matches the following URLs:


Using wildcards

You can use a single wildcard character (*) to match a subdomain for both the urlFetchWhitelist and gmail.openLinkUrlPrefixes fields. You can't use more than one wildcard to match multiple subdomains, and the wildcard must represent the leading prefix of the URL.

For example, the prefix https://* matches the following URLs:


The prefix https://* doesn't match the following URLs:

  • (suffix mismatch)
  • (at least one subdomain must be present)

Some of the prefix rules are enforced when you try to save your manifest. For example, the following prefixes cause an error if they are present in your manifest when you attempt to save:

  • https://*.* (multiple wildcards are forbidden)
  • https://subdomain.* (wildcards must be used as a leading prefix)