Apps Script 프로젝트는 매니페스트 파일을 사용하여 스크립트 및 작업에 대한 특정 세부정보를 구성합니다. 매니페스트를 보고 수정하는 방법을 알아보려면 매니페스트를 참조하세요.
이 문서에서는 Google Workspace 부가기능의 매니페스트 구성에 대해 자세히 설명합니다.
Google Workspace 부가기능의 매니페스트 구조
Google Workspace 부가기능은 Apps Script 프로젝트 매니페스트 파일을 사용하여 부가기능의 모양과 동작의 여러 측면을 정의합니다.
Google Workspace 부가기능의 매니페스트 속성은 매니페스트 객체 구조의 addOns
섹션 아래에 구성되어 있습니다.
Google Workspace 부가기능 매니페스트 구성 샘플
아래 매니페스트 샘플은 다음 측면을 포함하여 Google Workspace 부가기능을 정의하는 매니페스트 파일의 섹션을 보여줍니다.
- 매니페스트의
addOns.common
섹션에서는 부가기능의 이름, 로고 URL, 색상, 기타 호스트 독립적인 설정을 정의합니다. - 매니페스트는 일반적인 홈페이지를 정의하고 Calendar, Drive, Docs, Sheets, Slides 전용 홈페이지도 정의합니다. Gmail은 기본 홈페이지를 사용합니다.
- 샘플 매니페스트 설정은 다음을 사용 설정합니다.
- Calendar
eventOpen
및eventUpdated
트리거와 2개의 Calendar 회의 솔루션 - 두 가지 범용 작업
- 드라이브
onItemsSelectedTrigger
. - Gmail 편지쓰기 작업 및 컨텍스트 트리거
- Docs, Sheets, Slides의 파일별 인터페이스
- Calendar
oauthScopes
필드는 프로젝트의 승인 범위를 설정합니다 (일반적으로 부가기능에 필요).urlFetchWhitelist
필드는 가져온 엔드포인트가 지정된 HTTPS URL 프리픽스 목록과 일치하는지 확인하는 필드입니다. 이 필드는 테스트 배포에 선택사항이지만 배포에는 필수입니다. 자세한 내용은 허용 목록 URL을 참고하세요.
샘플의 링크는 매니페스트 참조 문서의 해당 필드 설명으로 연결됩니다.
// Sample configuration of the addOns section in a manifest file: { "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://en.wikipedia.org/wiki/", "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" } }, "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" ], "urlFetchWhitelist": [ "https://www.example.com/myendpoint/" ], }
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이 동일하거나 접두사의 하위 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
와일드 카드 사용
단일 와일드 카드 문자 (*
)를 사용하여 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
(하위 도메인이 하나 이상 있어야 함)
일부 프리픽스 규칙은 매니페스트를 저장하려고 할 때 시행됩니다. 예를 들어, 저장을 시도할 때 매니페스트에 다음 접두사가 있으면 오류가 발생합니다.
https://*.*.example.com/foo
(와일드 카드를 여러 개 사용하는 것은 금지됨)https://subdomain.*.example.com/foo
(와일드 카드를 선행 프리픽스로 사용해야 함)