이 페이지에서는 Google Chat 외부의 서비스 또는 도구와 Google Chat 앱을 연결하는 방법을 설명합니다. Chat 앱은 자체적으로도 강력하지만 다른 시스템과 함께 작동하는 경우가 많으며 계정을 연결하거나, 데이터 액세스를 승인하거나, 추가 데이터를 표시하거나, 사용자 환경설정을 구성하려면 동반 애플리케이션이 필요합니다.
기본 요건
상호작용 이벤트를 수신하고 이에 응답하도록 구성된 Google Chat 앱 대화형 Chat 앱을 만들려면 사용하려는 앱 아키텍처에 따라 다음 빠른 시작 중 하나를 완료하세요.
이렇게 하면 Google Chat에 사용자에게 비공개 메시지를 표시하도록 지시합니다. 여기서 CONFIGURATION_URL는 사용자가 추가 인증, 승인 또는 구성을 위해 방문할 링크입니다. REQUEST_CONFIG 응답은 일반 응답 메시지와 상호 배타적입니다. 텍스트, 카드 또는 기타 속성은 무시됩니다.
구성 요청 완료
Chat 앱이 수신하는 모든 MESSAGE, ADDED_TO_SPACE, APP_COMMAND 상호작용 이벤트에는 configCompleteRedirectUrl 필드도 포함됩니다. 프로세스가 완료될 때 사용할 수 있도록 구성 URL에서 이 URL을 인코딩해야 합니다. 이 URL로 리디렉션하면 Google Chat에 구성 요청이 처리되었음을 알립니다.
Chat 앱이 시작되면 흐름은 수신된 특정 메시지에 따라 달라집니다. @app help와 같은 메시지에 대한 응답으로 Chat 앱은 추가 구성이 필요하지 않은 메시지로 응답해야 합니다.
사용자가 원본 메시지에 제공된 configCompleteRedirectUrl로 리디렉션되면 Google Chat은 다음 단계를 실행합니다.
시작 사용자에게 표시된 프롬프트를 지웁니다.
원본 메시지를 공개로 변환하여 스페이스의 다른 구성원에게 표시합니다.
원래 메시지를 동일한 Chat 앱에 두 번째로 보냅니다.
configCompleteRedirectUrl를 방문하면 단일 사용자 메시지에만 영향을 미칩니다.
사용자가 채팅 앱에 여러 번 메시지를 보내려고 시도하여 여러 메시지가 표시된 경우 특정 메시지를 클릭하고 인증 및 구성 프로세스를 완료하면 해당 메시지에만 영향을 미칩니다. 다른 메시지는 변경되지 않습니다.
이러한 방식으로 MESSAGE 상호작용 이벤트가 다시 전송되면 원래 이벤트와 동일해야 합니다. 하지만 MESSAGE 상호작용 이벤트가 다를 수 있는 상황도 있습니다. 예를 들어 메시지에서 채팅 앱 A와 채팅 앱 B를 모두 언급하는 경우, 채팅 앱 B로 인증하기 전에 채팅 앱 A가 일반 메시지로 응답하면 사용자가 메시지를 수정할 수 있습니다. 이 경우 사용자가 인증 및 구성을 완료한 후 채팅 앱 B가 수정된 메시지 텍스트를 수신합니다.
Chat 외부에서 Chat 사용자 인증
API의 OAuth 승인을 요청하는 경우와 같이 앱이 사용자 ID를 유지하면서 Chat 외부의 URL에 연결해야 하는 경우가 있습니다. 이러한 경우 사용자를 식별하는 가장 좋은 방법은 Google 로그인으로 대상 앱을 보호하는 것입니다.
로그인 중에 발급된 ID 토큰을 사용하여 사용자 ID를 가져옵니다. sub 클레임에는 사용자의 고유 ID가 포함되어 있으며 Google Chat의 사용자 ID와 상관관계를 설정할 수 있습니다.
두 ID가 정확히 동일하지는 않지만 강제 변환할 수 있습니다. sub 클레임 값을 Google Chat users/{user}으로 강제하려면 값 앞에 users/을 추가합니다. 예를 들어 123의 클레임 값은 채팅 앱에 전송되는 메시지의 사용자 이름 users/123과 동일합니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-08-29(UTC)"],[[["\u003cp\u003eGoogle Chat apps can connect with external services for enhanced functionality, such as account linking and data access.\u003c/p\u003e\n"],["\u003cp\u003eTo enable external connections, Chat apps use a configuration URL that prompts users to complete setup outside of Chat.\u003c/p\u003e\n"],["\u003cp\u003eUpon successful configuration, the original message in Chat becomes public and is resent to the app for processing.\u003c/p\u003e\n"],["\u003cp\u003eGoogle Sign-in is recommended for authenticating Chat users in external systems by using the identity token's \u003ccode\u003esub\u003c/code\u003e claim.\u003c/p\u003e\n"],["\u003cp\u003eEnsure the identity token's integrity is validated before using the user ID for any operations.\u003c/p\u003e\n"]]],["To connect a Google Chat app with external services, use a configuration URL returned in a `REQUEST_CONFIG` response, prompting users for authentication or configuration. This URL should include the `configCompleteRedirectUrl` provided by Chat, redirecting users back upon completion. Successful redirection erases the prompt, makes the original message public, and resends the original message to the Chat app. To maintain user identity outside Chat, use Google Sign-in and validate the integrity of the `sub` token.\n"],null,["# Connect a Chat app with other services and tools\n\n| **Note:** This guide explains how to build an interactive Chat app\n| using *Chat API interaction events* . You can also build your\n| Chat app as a Google Workspace add-on. To learn about which framework\n| to use, see [Build an interactive\n| Google Chat app](/workspace/chat/interact-users-overview).\n\n\u003cbr /\u003e\n\nThis page describes how to connect a Google Chat app with a service\nor tool that is outside of Google Chat. While Chat apps are\npowerful on their own, they often work in concert with other systems and require\ncompanion applications to connect accounts, authorize data access, display\nadditional data, or configure user preferences.\n\nPrerequisites\n-------------\n\n\u003cbr /\u003e\n\nA Google Chat app that's configured to receive and respond to [interaction events](/workspace/chat/receive-respond-interactions). To create an interactive Chat app, complete one of the following quickstarts based on the [app architecture](/workspace/chat/structure) that you want to use:\n\n- [HTTP service](/workspace/chat/quickstart/gcf-app) with Google Cloud Functions\n- [Google Apps Script](/workspace/chat/quickstart/apps-script-app)\n- [Google Cloud Dialogflow CX](/workspace/chat/build-dialogflow-chat-app-natural-language)\n- [Google Cloud Pub/Sub](/workspace/chat/quickstart/pub-sub)\n\nRequest Chat app configuration from a user\n------------------------------------------\n\nIf completing a request requires additional configuration that can't be\ncompleted directly in the Chat app, return a\nconfiguration URL to the user as part of a normal reply, or present it privately,\nin the following form: \n\n```\n{\n \"actionResponse\": {\n \"type\": \"REQUEST_CONFIG\",\n \"url\": \"CONFIGURATION_URL\"\n }\n}\n```\n\nThis tells Google Chat to present the user with a private prompt, where\n\u003cvar translate=\"no\"\u003eCONFIGURATION_URL\u003c/var\u003e is a link\nfor the user to visit for additional authentication, authorization, or\nconfiguration. A `REQUEST_CONFIG` response is mutually exclusive with a regular\nresponse message. Any text, cards, or other attributes are ignored.\n\nComplete the configuration request\n----------------------------------\n\nEvery\n[`MESSAGE`, `ADDED_TO_SPACE`, and `APP_COMMAND` interaction event](/workspace/chat/api/reference/rest/v1/EventType)\nthat your Chat app receives also includes the field\n`configCompleteRedirectUrl`. You must encode this URL in your\nconfiguration URL to be used on completion of the process. Redirecting to this\nURL signals to Google Chat that the configuration request was fulfilled.\n\nWhen your Chat app starts, the flow depends on the\nspecific message received. In response to a message like `@app help`, a\nChat app should respond with a message without\nrequiring additional configuration.\n\nWhen a user is successfully redirected to the `configCompleteRedirectUrl`\nprovided in the original message, Google Chat performs the following steps:\n\n1. Erase the prompt that was displayed to the initiating user.\n2. Convert the original message to public, making it visible to other members of the space.\n3. Send the original message to the same Chat app a second time.\n\nVisiting a `configCompleteRedirectUrl` only affects a single user message.\nIf a user has tried to message a Chat app multiple\ntimes and as a result received multiple prompts, clicking through a particular\nprompt and completing the authentication and configuration process only affects\nthat particular message. Other messages aren't changed.\n\nWhen a `MESSAGE` interaction event is resent in this way, it should be identical\nto the original event; however, there are some situations where `MESSAGE`\ninteraction events can differ. For example, when a message mentions both\nChat app A and Chat app B,\nthe user is able to edit the message if Chat app A\nresponds with a regular message before authenticating with\nChat app B. In this case,\nChat app B receives the edited message text after the\nuser completes authentication and configuration.\n\nAuthenticate the Chat user outside of Chat\n------------------------------------------\n\nIn some cases, such as requesting OAuth authorization for an API, your app needs\nto link to a URL outside of Chat while maintaining the user\nidentity. The best way to identify the user in these cases is to guard the\ndestination app with [Google Sign-in](/identity).\n\nUse the\n[identity token](/identity/sign-in/web/backend-auth)\nissued during sign-in to get the user ID. The `sub` claim contains the user's\nunique ID and can be correlated with the user ID from Google Chat.\n| **Caution:** Always [validate the integrity](/identity/sign-in/web/backend-auth#verify-the-integrity-of-the-id-token) of the token before accepting the asserted user ID.\n\nWhile the two IDs aren't exactly identical, they can be coerced. To\ncoerce the value of the `sub` claim to a Google Chat `users/{user}`, prepend\nthe value with `users/`. For example, the claim value of `123` is equivalent\nto the username `users/123` in messages to your\nChat app.\n\nRelated topics\n--------------\n\n- [Receive and respond to user interaction](/workspace/chat/receive-respond-interactions#receive)\n- The [MyProfile app example](https://github.com/googleworkspace/google-chat-samples/tree/main/python/auth-app) uses the identity token from the Google Sign-in response to identify the user."]]