Once you’ve created a chatbot, you can publish it so that it’s available to selected people or groups, or to everyone in your domain. This lets users start a direct message with the bot or add it to a Room, by choosing it from the proposed recipient list as shown below.
Users can also narrow the proposed recipient list by @mentioning the bot by name. For example, if you publish a bot called “schedulerbot”, then when users in your domain type “@sch” then Hangouts chat will propose your bot as one of the autocomplete options.
Enabling the Hangouts Chat API
You need to set up a project for your bot in the Google API Console with the Hangouts Chat API enabled:
- Use the button below to create a new project (or select an existing one) and
add a service account to it. Give the service account the Project Owner
Enable the API
- Save the downloaded JSON key. Your bot can use this key to authenticate messages that it sends to spaces asynchronously.
- Open your project in the API Console. In the list of APIs, click Hangouts Chat API.
- Select the Configuration tab and enter the information for the bot, as described below.
After you save this bot definition in the API Console, your bot will become available to the specified users in your domain.
Configuring the bot
When you choose the configuration tab of the Hangouts Chat API, you will see a screen like the one shown below.
At the top of the screen there is a Bot Status field that appears only after you've published your bot. This field lets you control whether the bot is Live or Disabled.
The rest of the page lets you configure your bot using the following information:
|Bot name||This is the name that users can type to invoke your bot in autocomplete or in DMs.|
|Avatar URL||A square graphics image (e.g. PNG or JPEG), at least 128x128, that will appear as the avatar for your bot.|
|Description||Text that will appear below your bot's name.|
|Functionality||A set of fields that determine what events can trigger the bot:
|Connection settings||Defines the bot endpoint, which is one of the following:
|Configuration URL||Reserved for future feature.|
|Permissions||Controls whether the bot is visible to all members of your domain, or just to selected individuals or groups.|