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.

  1. From the APIs & Services menu, select Credentials.
  2. In the Service Accounts section, click the Manage service accounts link.
  3. The Service accounts page appears.

  4. At the top of the page, click CREATE SERVICE ACCOUNT.
  5. The Create service account page appears.

  6. Provide the service account details: a unique Service account name and the desired Service account ID.
  7. Click the CREATE AND CONTINUE button.
  8. 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.
  9. You can also grand users access to this service account. For more information on the service account settings, see Google Cloud documentation.

  10. Click DONE. The service account appears in the Service accounts page.

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

  1. 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.
  2. Fill in the fields as follows:
  3. 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 “ ”).

  4. 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.
  5. After the channel’s activation, the following fields are available in DRUID:

    • [[ChatUser]].ChannelId = "googlechat"
    • [[ChatUser]].UserId - Stores an unique identifier of the Google user account.
  6. Click Save & Close to save the Google Chat channel configuration.

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:

  1. From the left menu, click APIs & Services and select Dashboard.
  2. The list of Google APIs and Services available in your project appears.

  3. At the top of the page, click ENABLE APIS AND SERVICES.
  4. Google API Library appears.

  5. Search for the "Google Chat API".
  6. The search might return more results.

  7. Click Google Chat API. The API details page appears.
  8. Click Enable.
  9. The Hangout Chat API is enabled and the Overview page appears.

  10. From the main menu, click Configuration.
  11. Configure the Hangout Chat API as provided in the figure below:
  12. Click SAVE.

Step 7. Talk to your bot

Note:  In DRUID 7.5 and higher, when a user initiates a conversation with the bot, the Welcome flow will be automatically triggered. Regardless of the user's subscription status to the bot channel, the welcome message will be promptly sent to the user, ensuring a seamless and engaging interaction experience.

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.