Google Chat
The DRUID ChatBot Portal allows you to create the bot once and deploy it in Google Chat.
Prerequisites
- You need to have an account with admin privileges on the Google Cloud Platform or a user account with privileges to create projects.
- You need to create a project in the Google Cloud project for your DRUID bot. For information on how to create a Google Cloud Project, see Google Cloud documentation.
-
For DRUID on premise deployments, make sure that you provide access to/from the necessary messaging endpoints as follows:
Outbound | *googleapis.com |
Inbound | DRUID.BotApp |
This section describes how to integrate a DRUID chatbot with Google Chat.
Step 1. Get Google Cloud Project details
Log in the Google Console, select the project you’ll be using for DRUID - Google Chat channel. On the project Dashboard, from the Project info card, copy the Project number as you will need it for DRUID channel setup.
Step 2. Add Service account for your Google Console project
A service account is an identity that Google Cloud can use to run API requests on your behalf.
- From the APIs & Services menu, select Credentials.
- In the Service Accounts section, click the Manage service accounts link.
- At the top of the page, click CREATE SERVICE ACCOUNT.
- Provide the service account details: a unique Service account name and the desired Service account ID.
- Click the CREATE AND CONTINUE button.
- Grant this service account Owner access to your Google Console project so that it has permission to complete specific actions on the resources in your project. From the Role drop-down, select Owner.
- Click DONE. The service account appears in the Service accounts page.
The Service accounts page appears.
The Create service account page appears.
You can also grand users access to this service account. For more information on the service account settings, see Google Cloud documentation.
Step 3. Get service account Email
In the Service accounts page, click on the service account your created for your Google Console project.
The Service account details appears. Copy the value from the Email field.
Now you have to add a service account key.
Step 4. Add service account key
In the Service account details page, click the KEYS tab.
You can easily add a service account key by either uploading it or by creating / generating a new one.
If you choose to create a new key, the key will be automatically downloaded in your default Download folder. You will need the file later during Google Chat channel configuration in DRUID.
For information about adding service account keys, see Google Chat API documentation.
Step 5. Activate the Google Chat channel
- In the DRUID ChatBot Portal go to your bot settings. Click the Channels tab, then click Google Chat. The Google Chat Channel Info section expands.
- Fill in the fields as follows:
- Click the Publish button. The channel activation might take up to 1 minute. When the channel activation completes, the Google Chat Inbound Url field is automatically filled in. Copy the value, you will need them at Step 6.
- [[ChatUser]].ChannelId = "googlechat"
- [[ChatUser]].UserId - Stores an unique identifier of the Google user account.
- Click Save & Close to save the Google Chat channel configuration.
DRUID Field | Google Console Field |
---|---|
Google Chat Project Number | The Google Console project number. |
Google Chat Service Account Email | The Email of the service account you granted access to your Google Console project. |
Google Chat Service Account Private Key |
The Key you added to the service account you granted access to your Google Console project. If you created a new one, open the key file and copy its value (the value between the “ ”). |
After the channel’s activation, the following fields are available in DRUID:
Step 6. Enable the Google Chat API for your Google Console project
New Google Console projects have by default a set of predefined Google APIs and services. For DRUID Google Chat, you need to add the Google Chat API to your project. This Google API enables you to create a bot for Google Chat:
- From the left menu, click APIs & Services and select Dashboard.
- At the top of the page, click ENABLE APIS AND SERVICES.
- Search for the "Google Chat API".
- Click Google Chat API. The API details page appears.
- Click Enable.
- From the main menu, click Configuration.
- Configure the Hangout Chat API as provided in the figure below:
- Click SAVE.
The list of Google APIs and Services available in your project appears.
Google API Library appears.
The search might return more results.
The Hangout Chat API is enabled and the Overview page appears.
Step 7. Talk to your bot
You have two options to talk to your bot:
From DRUID Portal, Google Chat channel
To open the chatbot in the Google Chat channel, in the DRUID Portal, go to the bot settings, click the Channels tab and click on the Google Chat channel icon. You can start talking to the bot.
From Gmail account, Google Chat
Log into your Gmail account and in the Chat section click Start a chat and search for the DRUID bot you previously integrated in Google Chat. Select the bot.
The chat appears and you can start chatting with your DRUID bot.
Google User Information
For DRUID version 1.55 or higher, the following Google user details are automatically available in the [[ChatUser]] entity:
- Google user's email in [[ChatUser]].Email.
- Google display name in [[Chatuser]].FirstName (automatically).
These details are useful to authenticate the user based on the Google email.