Google Workspace アドオンのマニフェスト

アドオンはマニフェスト ファイルを使用する アプリとその操作に関する特定の詳細を設定できます。

このドキュメントでは、Terraform 構成ファイルのマニフェストを Google Workspace アドオンです。

Google Workspace アドオンのマニフェストの構造

Google Workspace アドオンはマニフェスト ファイルを使用して、インフラストラクチャのさまざまな側面を定義します。 アドオンの 定義できます。

Google Workspace アドオンのマニフェスト プロパティは次のとおりです。 これはマニフェスト オブジェクト構造の addOns セクションにあり、

Google Workspace アドオン マニフェストの構成例

次のマニフェスト サンプルは、マニフェスト ファイルの中で、 次のような特長があります。

  • addOns.common セクションでは、名前、ロゴの URL、色、その他の値を ホストに依存しない一般的な設定です。
  • このマニフェストでは、共通のホームページを定義するだけでなく、 カレンダー、ドライブ、ドキュメント、 スプレッドシート、スライド専用のホームページを作成できます。 Gmail ではデフォルトのホームページが使用されます。
  • マニフェスト設定のサンプルでは、次のことができます。 <ph type="x-smartling-placeholder">
  • oauthScopes フィールド プロジェクトの認可スコープを設定します(通常、プロジェクト 。
  • (Apps Script のみ)urlFetchWhitelist フィールドは、取得されたエンドポイントが指定のエンドポイントと HTTPS URL 接頭辞のリストです。詳細については、次をご覧ください: URL を許可リストに登録する

サンプル内のリンクから説明に移動する 対応するフィールドの Apps Script のマニフェスト リファレンス ドキュメント および HTTP Google Workspace アドオン。

Apps Script

{
  "addOns": {
    "calendar": {
      "createSettingsUrlFunction": "getConferenceSettingsPageUrl",
      "conferenceSolution": [{
        "id": "my-video-conf",
        "logoUrl": "https://lh3.googleusercontent.com/...",
        "name": "My Video Conference",
        "onCreateFunction": "onCreateMyVideoConference"
      }, {
        "id": "my-streamed-conf",
        "logoUrl": "https://lh3.googleusercontent.com/...",
        "name": "My Streamed Conference",
        "onCreateFunction": "onCreateMyStreamedConference"
      }],
      "currentEventAccess": "READ_WRITE",
      "eventOpenTrigger": {
        "runFunction": "onCalendarEventOpen"
      },
      "eventUpdateTrigger": {
        "runFunction": "onCalendarEventUpdate"
      },
      "eventAttachmentTrigger": {
        "label": "My Event Attachment",
        "runFunction": "onCalendarEventAddAttachment"
      },
      "homepageTrigger": {
        "runFunction": "onCalendarHomePageOpen",
        "enabled": true
      }
    },
    "common": {
      "homepageTrigger": {
        "runFunction": "onDefaultHomePageOpen",
        "enabled": true
      },
      "layoutProperties": {
        "primaryColor": "#ff392b",
        "secondaryColor": "#d68617"
      },
      "logoUrl": "https://ssl.gstatic.com/docs/script/images/logo/script-64.png",
      "name": "Demo Google Workspace Add-on",
      "openLinkUrlPrefixes": [
        "https://mail.google.com/",
        "https://script.google.com/a/google.com/d/",
        "https://drive.google.com/a/google.com/file/d/",
        "https://www.example.com/"
      ],
      "universalActions": [{
        "label": "Open settings",
        "runFunction": "getSettingsCard"
      }, {
        "label": "Open Help URL",
        "openLink": "https://www.example.com/help"
      }],
      "useLocaleFromApp": true
    },
    "drive": {
      "homepageTrigger": {
        "runFunction": "onDriveHomePageOpen",
        "enabled": true
      },
      "onItemsSelectedTrigger": {
        "runFunction": "onDriveItemsSelected"
      }
    },
    "gmail": {
      "composeTrigger": {
        "selectActions": [
          {
            "text": "Add images to email",
            "runFunction": "getInsertImageComposeCards"
          }
        ],
        "draftAccess": "METADATA"
      },
      "contextualTriggers": [
        {
          "unconditional": {},
          "onTriggerFunction": "onGmailMessageOpen"
        }
      ]
    },
    "docs": {
      "homepageTrigger": {
        "runFunction": "onEditorsHomepage"
      },
      "onFileScopeGrantedTrigger": {
        "runFunction": "onFileScopeGrantedEditors"
      },
      "linkPreviewTriggers": [
        {
        "runFunction": "onLinkPreview",
        "patterns": [
            {
              "hostPattern": "example.com",
              "pathPrefix": "example-path"
            }
        ],
        "labelText": "Link preview",
        "localizedLabelText": {
          "es": "Link preview localized in Spanish"
        },
        "logoUrl": "https://www.example.com/images/smart-chip-icon.png"
        }
      ],
      "createActionTriggers": [
        {
          "id": "exampleId",
          "labelText": "Example label text",
          "localizedLabelText": {
            "es": "Label text localized in Spanish"
          },
          "runFunction": "exampleFunction",
          "logoUrl": "https://www.example.com/images/case.png"
        }
      ]
    },
    "sheets": {
      "homepageTrigger": {
        "runFunction": "onEditorsHomepage"
      },
      "onFileScopeGrantedTrigger": {
        "runFunction": "onFileScopeGrantedEditors"
      }
    },
    "slides": {
      "homepageTrigger": {
        "runFunction": "onEditorsHomepage"
      },
      "onFileScopeGrantedTrigger": {
        "runFunction": "onFileScopeGrantedEditors"
      }
    }
  },
  "oauthScopes": [
    "https://www.googleapis.com/auth/calendar.addons.execute",
    "https://www.googleapis.com/auth/calendar.addons.current.event.read",
    "https://www.googleapis.com/auth/calendar.addons.current.event.write",
    "https://www.googleapis.com/auth/drive.addons.metadata.readonly",
    "https://www.googleapis.com/auth/gmail.addons.current.action.compose",
    "https://www.googleapis.com/auth/gmail.addons.current.message.metadata",
    "https://www.googleapis.com/auth/userinfo.email",
    "https://www.googleapis.com/auth/script.external_request",
    "https://www.googleapis.com/auth/script.locale",
    "https://www.googleapis.com/auth/script.scriptapp",
    "https://www.googleapis.com/auth/drive.file",
    "https://www.googleapis.com/auth/documents.currentonly",
    "https://www.googleapis.com/auth/spreadsheets.currentonly",
    "https://www.googleapis.com/auth/presentations.currentonly",
    "https://www.googleapis.com/auth/workspace.linkpreview"
  ],
  "urlFetchWhitelist": [
    "https://www.example.com/myendpoint/"
  ]
}

HTTP

{
  "addOns": {
    "calendar": {
      "currentEventAccess": "READ_WRITE",
      "eventOpenTrigger": {
        "runFunction": "https://myownpersonaldomain.com/mypage?trigger=onCalendarEventOpen"
      },
      "eventUpdateTrigger": {
        "runFunction": "https://myownpersonaldomain.com/mypage?trigger=onCalendarEventUpdate"
      },
      "eventAttachmentTrigger": {
        "label": "My Event Attachment",
        "runFunction": "https://myownpersonaldomain.com/mypage?trigger=onCalendarEventAddAttachment"
      },
      "homepageTrigger": {
        "runFunction": "https://myownpersonaldomain.com/mypage?trigger=onCalendarHomePageOpen",
        "enabled": true
      }
    },
    "common": {
      "homepageTrigger": {
        "runFunction": "https://myownpersonaldomain.com/mypage?trigger=onDefaultHomePageOpen",
        "enabled": true
      },
      "layoutProperties": {
        "primaryColor": "#ff392b",
        "secondaryColor": "#d68617"
      },
      "logoUrl": "https://ssl.gstatic.com/docs/script/images/logo/script-64.png",
      "name": "Demo Google Workspace Add-on",
      "openLinkUrlPrefixes": [
        "https://mail.google.com/",
        "https://script.google.com/a/google.com/d/",
        "https://drive.google.com/a/google.com/file/d/",
        "https://www.example.com/"
      ],
      "universalActions": [{
        "label": "Open settings",
        "runFunction": "https://myownpersonaldomain.com/mypage?trigger=getSettingsCard"
      }, {
        "label": "Open Help URL",
        "openLink": "https://www.example.com/help"
      }],
      "useLocaleFromApp": true
    },
    "drive": {
      "homepageTrigger": {
        "runFunction": "https://myownpersonaldomain.com/mypage?trigger=onDriveHomePageOpen",
        "enabled": true
      },
      "onItemsSelectedTrigger": {
        "runFunction": "https://myownpersonaldomain.com/mypage?trigger=onDriveItemsSelected"
      }
    },
    "gmail": {
      "composeTrigger": {
        "actions": [
          {
            "label": "Add images to email",
            "runFunction": "https://myownpersonaldomain.com/mypage?trigger=getInsertImageComposeCards"
          }
        ],
        "draftAccess": "METADATA"
      },
      "contextualTriggers": [
        {
          "unconditional": {},
          "onTriggerFunction": "https://myownpersonaldomain.com/mypage?trigger=onGmailMessageOpen"
        }
      ]
    },
    "docs": {
      "homepageTrigger": {
        "runFunction": "https://myownpersonaldomain.com/mypage?trigger=onEditorsHomepage"
      },
      "onFileScopeGrantedTrigger": {
        "runFunction": "https://myownpersonaldomain.com/mypage?trigger=onFileScopeGrantedEditors"
      },
      "linkPreviewTriggers": [
        {
          "runFunction": "https://myownpersonaldomain.com/mypage?trigger=onLinkPreview",
          "patterns": [
              {
                "hostPattern": "example.com",
                "pathPrefix": "example-path"
              }
          ],
          "labelText": "Link preview",
          "localizedLabelText": {
            "es": "Link preview localized in Spanish"
          },
          "logoUrl": "https://www.example.com/images/smart-chip-icon.png"
        }
      ],
      "createActionTriggers": [
        {
          "id": "exampleId",
          "labelText": "Example label text",
          "localizedLabelText": {
            "es": "Label text localized in Spanish"
          },
          "runFunction": "https://myownpersonaldomain.com/mypage?trigger=onCreateAction",
          "logoUrl": "https://www.example.com/images/case.png"
        }
      ]
    },
    "sheets": {
      "homepageTrigger": {
        "runFunction": "https://myownpersonaldomain.com/mypage?trigger=onEditorsHomepage"
      },
      "onFileScopeGrantedTrigger": {
        "runFunction": "https://myownpersonaldomain.com/mypage?trigger=onFileScopeGrantedEditors"
      }
    },
    "slides": {
      "homepageTrigger": {
        "runFunction": "https://myownpersonaldomain.com/mypage?trigger=onEditorsHomepage"
      },
      "onFileScopeGrantedTrigger": {
        "runFunction": "https://myownpersonaldomain.com/mypage?trigger=onFileScopeGrantedEditors"
      }
    }
  },
  "oauthScopes": [
    "https://www.googleapis.com/auth/calendar.addons.execute",
    "https://www.googleapis.com/auth/calendar.addons.current.event.read",
    "https://www.googleapis.com/auth/calendar.addons.current.event.write",
    "https://www.googleapis.com/auth/drive.addons.metadata.readonly",
    "https://www.googleapis.com/auth/gmail.addons.current.action.compose",
    "https://www.googleapis.com/auth/gmail.addons.current.message.metadata",
    "https://www.googleapis.com/auth/userinfo.email",
    "https://www.googleapis.com/auth/script.external_request",
    "https://www.googleapis.com/auth/script.locale",
    "https://www.googleapis.com/auth/script.scriptapp",
    "https://www.googleapis.com/auth/drive.file",
    "https://www.googleapis.com/auth/documents.currentonly",
    "https://www.googleapis.com/auth/spreadsheets.currentonly",
    "https://www.googleapis.com/auth/presentations.currentonly",
    "https://www.googleapis.com/auth/workspace.linkpreview"
  ]
}

URL を許可リストに登録

許可リストを使用して、アクセスが事前に承認されている URL を指定する 編集することもできます。許可リストでユーザーを保護 data;許可リストを定義すると、スクリプト プロジェクトは許可リストに登録されている URL には 許可リストに登録されていません。

テストデプロイをインストールする場合、このフィールドは省略できますが、 バージョニングされた Deployment を作成します。

許可リストを使用するのは、スクリプトまたはアドオンが できます。

  • 外部の場所(HTTPS など)から情報を取得または取得 Apps Script UrlFetch を使用します。 あります。取得対象の URL を許可リストに登録するには、マニフェスト ファイルに urlFetchWhitelist フィールドを含めます。
  • ユーザーの操作に応じて URL を開くか表示する( 外部の URL を開く、または表示する Google Workspace アドオン 。URL を公開用に許可リストに登録するには、addOns.common.openLinkUrlPrefixes フィールドを 使用します。
で確認できます。

許可リストにプレフィックスを追加する

マニフェスト ファイルで許可リストを指定する( addOns.common.openLinkUrlPrefixes または urlFetchWhitelist フィールドなど)を使用する場合は、 URL プレフィックスのリストを含めることもできます。マニフェストに追加する接頭辞は、 次の要件を満たす必要があります。

  • 各接頭辞には有効な URL を指定する必要があります。
  • 各プレフィックスでは http:// ではなく https:// を使用する必要があります。
  • 各プレフィックスには完全なドメインが必要です。
  • 各接頭辞には空でないパスが必要です。例: https://www.google.com/ は有効ですが、https://www.google.com は無効です。
  • ワイルドカードを使用して、URL サブドメインの接頭辞と照合できます。
  • 単一の * ワイルドカードを addOns.common.openLinkUrlPrefixes フィールドをすべてのリンクに一致させることができますが、この方法では ユーザーのデータがリスクにさらされ、 アドオンの審査プロセスに進みます。単独 アドオン機能で必要な場合はワイルドカードを使用できます。

URL が許可リストに登録されたプレフィックスと一致するかどうかを判断する際は、次のルールが適用されます。 apply:

  • パス マッチングでは大文字と小文字が区別されます。
  • プレフィックスが URL と同一の場合は、一致とみなされます。
  • URL が接頭辞と同じ、または子である場合は一致とみなされます。

たとえば、接頭辞 https://example.com/foo は次の URL と一致します。

  • https://example.com/foo
  • https://example.com/foo/
  • https://example.com/foo/bar
  • https://example.com/foo?bar
  • https://example.com/foo#bar

ワイルドカードの使用

1 つのワイルドカード文字(*)を使用して、両方のサブドメインの urlFetchWhitelist および addOns.common.openLinkUrlPrefixes 表示されます。複数のサブドメインに一致させるために複数のワイルドカードを使用することはできません。 ワイルドカードは URL の先頭の接頭辞を表す必要があります。

たとえば、接頭辞 https://*.example.com/foo は次のように一致します。 URL:

  • https://subdomain.example.com/foo
  • https://any.number.of.subdomains.example.com/foo

接頭辞 https://*.example.com/foo が以下と一致していない URL:

  • https://subdomain.example.com/bar(接尾辞の不一致)
  • https://example.com/foo(サブドメインが 1 つ以上必要です)

マニフェストを保存しようとすると、一部の接頭辞ルールが適用されます。対象 たとえば、次の接頭辞が名前に含まれる場合、 保存しようとすると、次のことがわかります。

  • https://*.*.example.com/foo(複数のワイルドカードは禁止されています)
  • https://subdomain.*.example.com/foo (先頭の接頭辞としてワイルドカードを使用する必要があります)。