Hangouts Chat Vote bot sample (text-only)
This code sample creates a Hangouts Chat simple text-only Vote bot that
allows a user to vote (+1 or -1) on a message. This implementation is
written in Python and hosted on Google App Engine. It uses the
micro framework but can be ported to Flask if desired for App Engine or
alternative hosting. It should look like this:
Run the sample
To run this sample, you must follow these directions to create an App Engine project, create the bot and publish it for yourself in your G Suite domain, pointing Hangouts Chat to your App Engine-based bot. Once it's published, you can find the bot and add it to a chat room or direct message.
- Install the Google Cloud SDK
if you haven't already and ensure the
- Create a new Google Cloud Platform project or select an existing project.
- Create an App Engine app (or use an existing one) and note the
_APP-ID_.appspot.comdomain you get by default (customize as desired).
- Create a new folder and drop the files for this bot in it. From there, deploy your App Engine app.
- Now follow the instructions to publish your bot to Hangouts Chat
- On the Hangouts Chat Configuration tab, customize your bot by setting the following values:
- Project name: "Vote bot"
- Bot name: "Vote bot"
- Avatar URL:
- Description: "Vote bot"
- Functionality: enable for (at least) chat rooms
- Connection settings: select Apps Script and add Deployment ID (per general directions above)
- Permissions: select Specific people and groups in your domain, and enter your G Suite email address
- Click Save changes to publish your bot
- Add the Vote bot to a chat room and see a new message from the bot with the vote card ready to accept its first vote!
- Creating Hangouts Chat interactive cards featuring the same vote bot that supports images and hosted on Google Cloud Functions
- Hangouts Chat bot concept page
- Creating new bots in Hangouts Chat
- Hangouts Chat developer documentation
- Google App Engine product documentation
- Python App Engine (standard) documentation