Configure Google Chats

You can configure your bot to communicate with users through Google Chats. To do so,

  1. First, create a Google Project and generate the Google API key. 
  2. Enter the API key and the Google Chat Project number (App ID) in the Google Hangouts configuration section of the Luma Bot Builder.
  3. Later, specify the Bot URL (referred to as Message URL in the Luma Bot Builder) on the Google Chat API. 

Note

Google Chat Channel is currently not available for customers in mainland China.

Create a Google Chat Project

The following steps will walk you through generating the API key that you need to allow your Bot to communicate with your users over Google Chats.

  1. Generate the APIs for Google Chat by navigating to https://console.developers.google.com/project/_/apiui/apis/library page.
  2. Sign in to Google Cloud Platform using your login credentials. 
  3. Once you are signed in successfully, the following Google APIs page opens.
  4. If required, click Select to choose any of the existing projects or else define a new project, from the Library menu.
    1. Click Create to open New Project page and specify the following details:
    2. Enter the unique Project NameGoogle generates and displays the unique Project ID, which cannot be changed once the project is created. The Project ID is the globally unique identifier for your project.

    3. The system automatically displays the Organization details based on the login details.

    4. If there is a single Location, then the details are automatically displayed. In case multiple locations are available, then from the Location field, click Browse and select the Parent organization or folder.
    5. Click Create to create a new project, or else click Cancel.
  5. Once the new project is created, the following API Library page opens for the new project.
  6. On the Search bar, search for Google Chat API.
  7. Click Google Chat API to open in a separate tab.
  8. Click Enable to enable the Google Chat API.
  9. The Hangouts Chat API page appears. On the Overview tab, click Create Credentials to open it on a separate page.
  10. On Create Credential page, provide the Credential type information.
    1. Select Hangouts Chat API.
    2. Select Application data as the type of data you want to access
    3. Click on Done to create credentials.
  11. Once the Credentials are created, click API Key in the Create Credential menu to create a new API Key.

    Note

    The API key can be used in this project and with any API that supports it. API keys are used to identify the calling project (in this case the Bot) which makes a call to an API (in this case, Google Chat). It also verifies whether the calling Bot has been granted access to call the API and has enabled the API in their project. API keys are generated on the project making the call, and their use can be restricted to a specific environment such as an IP address range, or a specific Android or iOS app. 



    1. API Key is automatically created. Click on Restrict Key to update the key restrictions.
    2. Alternatively, on the API key list, click on edit, to view and update the key. 
    3. Specify the API Key Name. You can use the bot name as the API key in order to identify it easily.


    4. Select the required Application restrictions. Specify the required websites, apps, or IP addresses that can use this key. You can set the following restriction types for the key.
      1. None
      2. HTTP referrers (websites)
      3. IP addresses (web servers, cron jobs, etc.)
      4. Android apps
      5. iOS apps 

        Note

        It is recommended to use the option None for the application restriction. This is because you can access the bot irrespective of the website URL or the device being used (Android or iOS)

    5. Click Save to save the changes.

      Note

      It may take up to 5 minutes for the settings to take effect.

  12. Copy the API Key and retain it. You will use this later for the Luma Virtual Agent side of the configuration.

    Note

    The API Key is used in Step 4 of Enable Google Hangouts Channel within Bot Builder section below

  13. The next step is to create Service Account.
    On Create Credentials menu, select Service Account.
  14. On Create service account page, 
    1. Add Service Account Name and Description.
    2. Click on Create and Continue.

    3. Select Owner as Role and click Continue.
    4. Click on Done to complete Service Account creation.
    5. Once the account is created, the API Key and Service Account details are available on the Credentials page.
    6. Now click on Edit Service Account.
    7. Navigate to Keys tab on Service account details.
    8. Click on Add Key→ Create New Key.

    9. Select JSON as Key Type and Click on Create.
    10. The JSON is created and downloaded on your local machine. Retain the key as it is used in channel configuration on the Luma Bot Builder portal.
  15. On the Dashboard, open the Project.
    1. Copy the generated Project number (App ID) and retain it, it will be used later to authenticate the messages received from the bot.

      Note

      The Project number (App ID) is used in Step 4 of Enable Google Hangouts Channel within Bot Builder section below. Project number (App ID) is used to identify the user or person using Google Chat. Its purpose is to inform Google Chat that the bearer of this token has been authorized to access the API and perform the set actions.

    2. On API & Services, select Hangouts Chat API.

    3. Click on Configurations and add your application information.
    4. Specify the unique Bot Name with which you interact.
    5. Specify the Avatar URL.

      Note

      Avatar URL is an image URL used to identify the bot. Use an image that aligns to your brand and culture. This is the avatar uses will see when chatting with the bot.

    6. Specify the Description in a maximum of 40 characters and select the two checkboxes under Functionality.

  16. In the Connection Settings section, select Bot URL and then specify the Message URL that is copied from the Bot Builder. 

    Note

    Bot URL is used to pass data between your Bot and Google Chat. To know about the Message URL, refer Step 5 of Enable Google Hangouts Channel within Bot Builder section below. 

Enable Google Hangouts Channel within Bot Builder

To enable the Luma Virtual Agent side of the Google Chat integration, do the following in Bot Builder: 

  1. Click the Bots menu on the left navigation pane and then click Configuration.
    The bot Configuration page appears.
  2. On the Configuration page, click the Channels tab as shown below.
  3. Click the Google Hangouts tile from the list of channels. The Google Hangouts configuration page appears.
  4. Paste the Google Chat API KeyProject number (App ID) and Private JSON Key copied in Step 11, Step 14, and Step 15 of the Create Google Hangouts Project section above.
  5. Copy the Message URL and retain it in an easily accessible location such as a notepad or a text editor tool. This is used while configuring the Google Chat Project (Step 15 of Create Google Chat Project section). You can use the copy icon to simplify the operation. 

  6. On User Reconciliation for Channel Authentication, select the fields for user reconciliation in Field Name. Click on Set.
    This step is to configure fields to be used for the user's  Auto Authentication through the channel. You may select multiple fields, sorted in order of validation.
  7. Click Configure to configure the Google Chat channel. By default, the Google Chat channel is enabled when clicking Configure.
  8. The configured Google Chat is shown on the Channels page.
    1. If required, use the toggle button () to make the channel inactive. You can inactivate Google Chat if you do not want to use it. 
    2. If required, click the Google Hangouts tile to edit the details.

Chat with Luma

Once the service is running you can send messages to your Bot user and receive responses from your Luma Virtual Agent. To chat with the Bot user, navigate to https://chat.google.com/ and login to your Google Cloud Platform. If there are multiple bots, select the required Bot to start chatting as shown below. 

Email ID used in the Google platform is automatically passed Luma to auto-authenticate the users. This greatly improves the user experience as Luma recognizes the user, shows chat history, and allows triggering user-specific skills. 

Note

Note that the Bot may not be visible by default. You may need to search for the bot during the first chat instance. Once the conversation starts with the bot, the bot will be visible in the Bots list.

In case of any issues with the configuration, please contact the Serviceaide Support team.

© 2019 Serviceaide 1-650-206-8988 http://www.serviceaide.com info@serviceaide.com