建立及管理 Google Chat 應用程式部署作業
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
本頁說明如何為 Google Chat 應用程式建立及管理部署作業。維護不同的部署作業,有助於妥善管理 Chat 應用程式生命週期的各個階段,並安全地將變更發布至正式環境。
為應用程式生命週期的每個階段建立部署作業
為在整個生命週期中管理 Chat 應用程式,建議您為下列每個環境建立及部署 Chat 應用程式:
您必須為部署的每個 Chat 應用程式建立 Google Cloud 專案。在每個 Cloud 專案中設定 Chat API 時,建議使用不同的應用程式名稱、虛擬人偶網址和說明,以便在 Google Chat 中區別 Chat 應用程式。
在下列範例中,名為 Task app
的即時通訊應用程式是以 HTTP 建構而成,並使用不同的端點部署至開發、測試和實際工作環境:
環境 |
Cloud 專案名稱 |
應用程式名稱 |
HTTP 端點網址 |
開發 |
task-chat-app-dev |
開發工作應用程式 |
http://example.com/api/myapp/head |
預備 |
task-chat-app-staging |
暫存工作應用程式 |
http://example.com/api/myapp/staging |
正式版 |
task-chat-app |
工作應用程式 |
http://example.com/api/myapp/ |
根據 Google Chat 應用程式架構管理部署作業
下表列出管理特定 Chat 應用程式架構部署作業時,需要額外考量的因素:
架構 |
部署格式 |
注意事項 |
HTTP |
HTTP 端點網址 |
- 在 Chat 應用程式的生命週期中,逐步將變更部署至每個端點。舉例來說,在測試完部署至預先發布端點
http://example.com/api/myapp/staging 的新功能後,將該功能部署至正式版端點 (例如 http://example.com/api/myapp ),即可將功能發布至正式版。
- 如要在部署前偵錯程式碼,可以將端點設為本機環境。如要瞭解如何在本地測試變更,請參閱「對 Google Chat 擴充應用程式偵錯」。
|
Google Apps Script |
部署作業 ID |
- Apps Script 專案只能有一個分支,且只能與一個 Cloud 專案建立關聯。如要測試變更及維護多個環境,您必須為每個環境建立不同的 Apps Script 專案。
- 您應該只在開發環境中使用 Apps Script 專案的即時版本部署作業。對於測試和正式環境,請使用特定版本部署作業。詳情請參閱 Apps Script 說明文件中的「建立及管理部署作業」。
|
Pub/Sub |
Pub/Sub 主題 |
每個部署作業都應使用不同的 Pub/Sub 主題。 |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-29 (世界標準時間)。
[null,null,["上次更新時間:2025-08-29 (世界標準時間)。"],[[["\u003cp\u003eManage your Google Chat app's lifecycle by creating separate deployments for development, staging, and production environments.\u003c/p\u003e\n"],["\u003cp\u003eCreate a distinct Google Cloud project for each deployment, using unique app names, avatar URLs, and descriptions for clarity.\u003c/p\u003e\n"],["\u003cp\u003eDeploy changes progressively through each environment, starting with development and moving to staging before releasing to production.\u003c/p\u003e\n"],["\u003cp\u003eFor Apps Script projects, maintain separate projects for each environment due to their single-branch limitation.\u003c/p\u003e\n"],["\u003cp\u003eUtilize different Pub/Sub topics for individual deployments to ensure environment isolation.\u003c/p\u003e\n"]]],["The document outlines creating and managing deployments for Google Chat apps across development, staging, and production environments. Each environment requires a separate Google Cloud project with a distinct app name and details. Deployment methods vary: HTTP uses endpoint URLs, Apps Script utilizes deployment IDs and separate projects, and Pub/Sub employs unique topics. Changes should be progressively deployed, starting from development, then staging, and finally production. Different app architectures require different consideration.\n"],null,["# Create and manage deployments for your Google Chat app\n\nThis page explains how to create and management deployments for your\nGoogle Chat app. By maintaining different deployments, you can\nbetter manage each phase of your Chat app's lifecycle\nand safely release changes to production.\n\nCreate deployments for each phase of the app lifecycle\n------------------------------------------------------\n\nTo manage your Chat app throughout its lifecycle, we\nrecommend that you create and deploy a Chat app for\neach of the following environments:\n\n- **Development:** The environment that you use to work on changes. If needed, you can use the head deployment or run this environment locally.\n- **Staging:** The environment that you deploy to trusted testers for end-to-end testing. This environment should be as close to production as possible.\n- **Production:** The environment that you deploy to end users by [publishing\n your Chat app to the\n Google Workspace Marketplace](/workspace/marketplace/how-to-publish).\n\nFor each Chat app that you deploy, you must create a\nGoogle Cloud project. When you configure the Chat API in each\nCloud project, consider using a distinct app name, avatar URL, and\ndescription so that you can better distinguish between the\nChat apps in Google Chat.\n\nIn the following example, the Chat app\ncalled `Task app` is built on HTTP and uses different endpoints to deploy to\ndevelopment, staging, and production:\n\n| Environment | Cloud project name | App name | HTTP endpoint URL |\n|-------------|-------------------------|------------------|----------------------------------------|\n| Development | `task-chat-app-dev` | Dev Task app | `http://example.com/api/myapp/head` |\n| Staging | `task-chat-app-staging` | Staging Task app | `http://example.com/api/myapp/staging` |\n| Production | `task-chat-app` | Task app | `http://example.com/api/myapp/` |\n\n### Manage deployments based on your Chat app architecture\n\nThe following table includes additional considerations when managing deployments\nfor specific [Chat app\narchitectures](/workspace/chat/structure):\n\n| Architecture | Deployment format | Considerations |\n|--------------------|-------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| HTTP | HTTP endpoint URL | - Deploy changes progressively to each endpoint in your Chat app's lifecycle. For example, after you've tested a new feature deployed in your staging endpoint `http://example.com/api/myapp/staging`, release the feature to production by deploying it to your production endpoint, such as `http://example.com/api/myapp`. - To debug code before deploying, you can set an endpoint to your local environment. To learn how to test changes locally, see [Debug Google Chat apps](/chat/troubleshoot/debug). |\n| Google Apps Script | Deployment ID | - Apps Script projects can only have a single branch and be associated with one Cloud project. To test changes and maintain multiple environments, you must create different Apps Script projects for each environment. - You should only use the Apps Script project's head deployment for the development environment. For staging and production environments, use versioned deployments. For details, see [Create and manage deployments](/apps-script/concepts/deployments) in the Apps Script documentation. |\n| Pub/Sub | Pub/Sub topic | You should use a different Pub/Sub topic for each deployment. |\n\nRelated topics\n--------------\n\n- [Test interactive features for Google Chat apps](/workspace/chat/test-interactive-features)\n- [Create and manage Apps Script deployments](/apps-script/concepts/deployments)\n- [Choose a Chat app architecture](/workspace/chat/structure)"]]