Switch branches/tags
Nothing to show
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


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 webapp2 micro framework but can be ported to Flask if desired for App Engine or alternative hosting. It should look like this:

Vote bot (text-only)

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.

  1. Install the Google Cloud SDK if you haven't already and ensure the gcloud command works.
  2. Create a new Google Cloud Platform project or select an existing project.
  3. Create an App Engine app (or use an existing one) and note the _APP-ID_.appspot.com domain you get by default (customize as desired).
  4. Create a new folder and drop the files for this bot in it. From there, deploy your App Engine app.
  5. Now follow the instructions to publish your bot to Hangouts Chat
  6. On the Hangouts Chat Configuration tab, customize your bot by setting the following values:
  • Project name: "Vote bot"
  • Bot name: "Vote bot"
  • Avatar URL: https://www.gstatic.com/images/icons/material/system/2x/how_to_vote_black_48dp.png
  • 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
  1. Click Save changes to publish your bot
  2. 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!