Google Workspace 부가기능 매니페스트

부가기능은 매니페스트 파일을 사용하여 앱 및 앱 작업에 관한 특정 세부정보를 구성합니다.

이 문서에서는 Google Workspace 부가기능의 매니페스트 구성에 대해 자세히 설명합니다.

Google Workspace 부가기능의 매니페스트 구조

Google Workspace 부가기능은 매니페스트 파일을 사용하여 부가기능의 모양과 동작의 여러 측면을 정의합니다.

Google Workspace 부가기능의 매니페스트 속성은 매니페스트 객체 구조의 addOns 섹션 아래에 구성됩니다.

Google Workspace 부가기능 매니페스트 구성 샘플

다음 매니페스트 샘플은 다음 측면을 포함하여 Google Workspace 부가기능을 정의하는 매니페스트 파일의 섹션을 보여줍니다.

  • 매니페스트의 addOns.common 섹션은 부가기능의 이름, 로고 URL, 색상 및 기타 일반적인 호스트 독립적 설정을 정의합니다.
  • 매니페스트는 공통 홈페이지를 정의하지만 캘린더, 드라이브, 문서, 스프레드시트, 프레젠테이션 관련 홈페이지도 정의합니다. Gmail은 기본 홈페이지를 사용합니다.
  • 샘플 매니페스트 설정은 다음을 사용 설정합니다.
    • 캘린더 eventOpeneventUpdated 트리거
    • (Apps Script만 해당) 두 가지 캘린더 컨퍼런스 솔루션.
    • 두 가지 범용 작업
    • 드라이브 onItemsSelectedTrigger.
    • Gmail 편지쓰기 작업 및 상황별 트리거
    • Docs linkPreviewTriggers 객체. 이 트리거에 관한 자세한 내용은 스마트 칩으로 링크 미리보기를 참고하세요.
    • Docs createActionTriggers 객체입니다. 이 트리거에 관한 자세한 내용은 @ 메뉴에서 서드 파티 리소스 만들기를 참조하세요.
    • Docs, Sheets, Slides용 파일 전용 인터페이스
  • oauthScopes 필드는 프로젝트의 승인 범위를 설정합니다 (일반적으로 부가기능에 필요).
  • (Apps Script만 해당) urlFetchWhitelist 필드는 가져온 엔드포인트가 지정된 HTTPS URL 프리픽스 목록과 일치하는지 확인하는 필드입니다. 자세한 내용은 URL 허용 목록을 참고하세요.

샘플의 링크는 Apps ScriptHTTP 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을 지정할 수 있습니다. 허용 목록을 사용하면 사용자 데이터를 보호할 수 있습니다. 허용 목록을 정의하면 스크립트 프로젝트는 허용 목록에 없는 URL에 액세스할 수 없습니다.

이 필드는 테스트 배포를 설치할 때는 선택사항이지만 버전이 지정된 배포를 만들 때는 필수입니다.

허용 목록은 스크립트 또는 부가기능에서 다음 작업을 수행할 때 사용합니다.

  • Apps Script UrlFetch 서비스를 사용하여 외부 위치 (예: HTTPS 엔드포인트)에서 정보를 검색하거나 가져옵니다. URL 가져오기를 허용하려면 매니페스트 파일에 urlFetchWhitelist 필드를 포함합니다.
  • 사용자 작업에 대한 응답으로 URL을 열거나 표시합니다 (Google 외부의 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이 허용 목록에 있는 프리픽스와 일치하는지 확인할 때는 다음 규칙이 적용됩니다.

  • 경로 일치는 대소문자를 구분합니다.
  • 접두사가 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

와일드 카드 사용

단일 와일드 카드 문자 (*)를 사용하여 urlFetchWhitelistaddOns.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 (하위 도메인이 하나 이상 있어야 함)

일부 접두사 규칙은 매니페스트를 저장하려고 할 때 적용됩니다. 예를 들어 저장하려고 할 때 다음 접두사가 매니페스트에 있으면 오류가 발생합니다.

  • https://*.*.example.com/foo (여러 개의 와일드 카드는 금지됨)
  • https://subdomain.*.example.com/foo(와일드 카드는 선행 프리픽스로 사용해야 함)