Google Business Messages Platform Integration
Learn how to build your Google Business Messages bot with the Jovo Framework.
Getting Started
Google Business Messages allows the user to chat with a business within Google Maps and Search. It is an asynchronous chat platform where businesses can either let a bot answer or a customer service worker. The platform doesn't provide a built-in NLU, so you are free to choose one of the many integrations in the Jovo Marketplace.
Installation
Install the module:
Make sure, that you have a database-integration enabled because this platform needs User-Session Data. You do not have to change the config because
GoogleBusiness
will enable the feature when it is installed.
Import the installed module, initialize and add it to the app
object:
After that, you have to add JSON key of a service account that has access to the Google Business Messages API:
Basics
All of the Google Business specific objects and functions are accessed using the $googleBusinessBot
object:
The object will only be defined if the incoming request is from Google Business Messages. Because of that, you should first check whether it's defined or not before accessing it:
LAUNCH and END Intent
Sadly, the Google Business Messages don't provide a separate request to mark the start and end of a session. Therefore, both the LAUNCH and END intent are not usable.
Requests
The integration currently supports two different request types. First, the standard text request:
followed by the suggestion request, triggered when a user clicks on one of the provided suggestion chips:
You can find a detailed explanation for each attribute in the official documentation by Google here
$request
Besides the default request helpers, like getTimestamp()
, the integration provides the following ones:
Name | Description | Return Value |
---|---|---|
getAgent() |
returns agent's ID | string |
getCustomAgentId() |
returns the agent's custom ID | string |
getRequestId() |
returns the request's ID | string |
getRawText() |
returns either the value of the message.text or suggestionResponse.text attribute |
string |
getEntryPoint() |
returns the entry point that the user clicked to initiate the conversation | either ENTRY_POINT_UNSPECIFIED , PLACESHEET , or MAPS |
getPlaceId() |
returns the ID from the Google Places database for the location the user messaged. | string or undefined |
getUserDisplayName() |
returns the user's display name | string or undefined |
Responses
Besides the generic text response using ask()
, you can also add cards to your responses.
First, the standalone card using the showStandaloneCard(card)
method:
The card's object structure is equal to the one described in the official Google documentation here
Second, the carousel card using showCarousel(carousel)
:
The card's object structure is equal to the one described in the official Google documentation here