This article discusses best practices for managing releases of Google Chat bots. The specific recommendation depends on which kind of endpoint you are using for your bot:
- HTTP
- Apps Script
- Cloud Pub/Sub
Regardless of which endpoint type you use, each instance of a Google Chat bot is backed by a single Google Cloud project. We recommend the following practices:
- Create a different Cloud project for each type of release (such as dev, test, and production)
- Name your bot appropriately
- Point each bot to different endpoints, each representing a different release.
You may find it helpful to badge each bot icon with different symbols to quickly differentiate different releases of your bot.
HTTP bots
For an HTTP bot, you might create three Cloud projects: one pointing to
HEAD
, for quick iterative development testing,
and two more to represent test and production builds.
Project | Release | Bot name | Bot URL |
---|---|---|---|
1 | HEAD | Task Bot (HEAD) | http://example.com/api/mybot/head |
2 | Test | Task Bot (Test) | http://example.com/api/mybot/test |
3 | Production | Task Bot | http://example.com/api/mybot/ |
To move a bot down the release cycle, just push the previous release to the existing URL.
For example, suppose you have finished testing a bot at
http://example.com/api/mybot/test
. To release this bot to production,
just push it to http://example.com/api/mybot/
.
Cloud Pub/Sub bots
For Cloud Pub/Sub bots, we recommend the same deployment model as for HTTP bots, with the following addition:
- Each bot release should use its own Cloud Pub/Sub topic.
Apps Script bots
Each instance of an Apps Script bot has its own deployment ID and version number.
The HEAD
deployment always points to version 0. Each additional deployment ID
maps to a different version of your Apps Script bot. To manage releases of these
bots, create a different Cloud project for each release and then map each
deployment ID to the corresponding Cloud project. See the table below for
details.
Project | Release | Bot name | Deployment ID | Apps Script version |
---|---|---|---|---|
1 | HEAD | Task Bot (HEAD) | {Head deployment ID} | 0 |
2 | Test | Task Bot (Test) | {deployment ID 2} | 2 |
3 | Production | Task Bot | {deployment ID 3} | 3 |
To move an Apps Script bot down the release cycle, you can create a new version by creating a new deployment and choosing New as the version number. You can then update the production bot with this new deployment ID.