为 Google Chat 应用创建和管理部署
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
本页介绍了如何为 Google Chat 应用创建和管理部署。通过维护不同的部署,您可以更好地管理 Chat 应用生命周期的每个阶段,并安全地将更改发布到生产环境。
为应用生命周期的每个阶段创建部署
为了在整个生命周期内管理 Chat 应用,建议您为以下每个环境创建并部署 Chat 应用:
对于您部署的每个 Chat 应用,您都必须创建一个 Google Cloud 项目。在每个 Cloud 项目中配置 Chat API 时,请考虑使用不同的应用名称、头像网址和说明,以便更好地区分 Google Chat 中的 Chat 应用。
在以下示例中,名为 Task app
的 Chat 应用基于 HTTP 构建,并使用不同的端点部署到开发、预演和生产环境:
环境 |
Cloud 项目名称 |
应用名称 |
HTTP 端点网址 |
开发 |
task-chat-app-dev |
Dev Task 应用 |
http://example.com/api/myapp/head |
预演 |
task-chat-app-staging |
暂存任务应用 |
http://example.com/api/myapp/staging |
生产 |
task-chat-app |
任务应用 |
http://example.com/api/myapp/ |
根据 Chat 应用架构管理部署
下表列出了在管理特定聊天应用架构的部署时需要考虑的其他事项:
架构 |
部署格式 |
注意事项 |
HTTP |
HTTP 端点网址 |
- 在 Chat 应用的生命周期内,逐步将更改部署到每个端点。例如,在测试完部署在预演端点
http://example.com/api/myapp/staging 中的新功能后,通过将该功能部署到生产端点(例如 http://example.com/api/myapp )来将该功能发布到生产环境。
- 如需在部署之前调试代码,您可以将端点设置为本地环境。如需了解如何在本地测试更改,请参阅调试 Google Chat 应用。
|
Google Apps 脚本 |
部署 ID |
- Apps 脚本项目只能有一个分支,并且只能与一个 Cloud 项目相关联。如需测试更改并维护多个环境,您必须为每个环境创建不同的 Apps 脚本项目。
- 您应仅将 Apps 脚本项目的 Head 部署用于开发环境。对于预演环境和生产环境,请使用版本化部署。如需了解详情,请参阅 Apps 脚本文档中的创建和管理部署。
|
Pub/Sub |
Pub/Sub 主题 |
您应为每个部署使用不同的 Pub/Sub 主题。 |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-29。
[null,null,["最后更新时间 (UTC):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)"]]