With the Google Hangouts Chat integration, you can create chat bots to interact with people in Google Hangouts Chat.
You will need to enable the Hangouts Chat API and obtain credentials to use the API to set up this integration.
Enable hangouts chat API and obtain credentials
- Either select or create a project on Google Cloud Platform, then enable the API.
- Once enabled, click Credentials in the left-hand menu.
- Click Create Credentials and select Service account key.
- Give the service account a name and the role Owner (Project > Owner)
- Select JSON for the key type.
- Click Create.
The private key will be downloaded. The ID of this private key will also appear in APIs & Services > Credentials.
This is the only copy of the key.
Register the integration and configure the bot
Register the Bot:
- In Bridge, open the registration window for the integration from the Extensions section.
- In the settings tab, paste the contents of the private key JSON file into the field labeled Service Account JSON.
- Click Register.
- The Bot URL field will now be filled. Copy this URL.
Configure the bot:
- Give your bot a name and an image.
- Set Description to Bridge Chat Bot (or something similar).
- Check both boxes under Functionality.
- Select Bot URL under Connection settings.
- Paste in the copied URL.
- Specify who can call this bot.
- Click Save.
Use the bot
You will need to create a workflow for the bot to run. Follow the steps below to create a very simple workflow that responds Pong when you say Ping.
- Create a new workflow in Bridge called PingPong.
- Click on startstate and type Pong in the answer field.
- Click on the trigger element and expand the section Phrases in the panel. Add Ping as a phrase.
- Save the workflow.
In Google Hangouts Chat, send the Bridge bot the message Ping and the bot should respond back with Pong.
A space event is what happens when the bot is added to, or removed from, a space in Google Hangouts Chat. You can use each of these two events to trigger separate workflows, or trigger the same workflow with different state values.
Added To Space
A good use of the Added To Space event would be to trigger a workflow that will send a message to the space detailing what commands the bot can recognize.
Removed From Space
It's important to remember that a workflow triggered by the Removed From Space event will not be able to send a message to the space.