Turning search queries into AI-powered conversations with Business Messages

Sean Falconer
9 min readNov 29, 2021

I’ve moved! Check out this article on my new site here.

Google’s Business Messages lets customers message a business directly from Google Search, Google Maps, and any brand-managed property. Developers on Business Messages can leverage tools like Dialogflow to create AI-powered conversational experiences, where customers can chat with lifelike virtual agents that understand, interact, and talk in natural ways. Meanwhile the business can leverage real life agents when needed.

In this article, I’ll give a brief overview of Business Messages, how to get started developing with the platform, and then walkthrough how to set up an AI-powered conversion using the Bot-in-a-Box feature from Business Messages.

Let’s get started!

What is Google’s Business Messages?

Business Messages is a mobile conversational channel that combines entry points from Google Maps, Search, and brand websites to create rich, asynchronous messaging experiences.

As shown in the example image below, I’ve searched “Bridgepoint Runners” and in the results I see my local Bridgepoint Runners store, which contains buttons to call, get directions, or go to their website. Since Bridgepoint Runners is enabled for Business Messages, I also see a Chat button, which when tapped opens a conversation with Bridgepoint Runners. In the conversation, the business can automatically answer my questions using AI-powered bots as well as live agents.

Example of Business Messages chat entry point for Bridgepoint Runners

In this simple example, Bridgepoint Runners represents a local business, but Business Messages also works for web-based businesses. Business Messages supports rich conversational features like suggested replies, suggested actions, rich cards, carousels, and images so that you can create complex and feature-rich conversational experiences to support a wide range of customer user journeys.

How do I get started?

To get started with Business Messages, you can register as a development partner on our developer website. You can also get up and running quickly by following our quickstart guide.

Once you’ve worked your way through the quickstart, you’ll have registered a Google Cloud Project and that project will have two APIs enabled, the Business Communications API and Business Messages API.

The Business Communications API is an API for creating and managing business experiences for the Business Messages platform while the Business Messages API is an API for sending and receiving messages to and from users on behalf of a business. Additionally, you’ll have access to the Business Communications Developer Console, which is a web-based tool for creating and managing business experiences on the Business Messages platform. It provides the same functionality as the Business Communications API, but is a faster and more convenient way to get started.

Additionally, after the quickstart, you’ll have configured a webhook and created your first Business Messages agent. An agent is a conversational representation of a brand. Agents include properties like the brand’s logo, the agent’s display name, the welcome message that greets a user, and more that define how the conversation will look and where the chat button will show up once launched.

The quickstart will have you deploy code to Google App Engine and the life of a message for your Echo Bot sample will look something like the image below.

Life of a Business Messages message

After creating an agent on behalf of a business, the chat button isn’t immediately available to Google Search and Maps users. All agents must go through a verification and launch process before the chat button will be shown for businesses in Search and Maps. You can see the full lifecycle from creation to launch of an agent here.

Even without launching an agent, you can test the message flow by using the test URLs from a mobile device that are autogenerated when you create the agent. The test URLs for an agent can be copied or sent to your email from within the Business Communications Developer Console and are also available as a property of the agent if you’re using the API.

When you navigate to the test URL, the conversation with your agent will automatically open. This mimics the experience that a user would see when tapping on a chat button for a launched Business Messages agent.

Example of where to copy an agent test URL

AI-powered conversation with Bot-in-a-Box

Business Messages’s Bot-in-a-Box makes getting started with conversational AI easy. Bot-in-a-Box takes advantage of Google AI tools like Dialogflow to easily convert an existing FAQ into an automated Business Messages solution. Within minutes, you could launch a lifelike virtual agent that provides relevant responses to the most common questions a business receives from customers.

FAQ-powered automated conversations

Additionally, you can use Dialogflow’s intents to create and support complex automated user journeys, like appointment booking, shopping, order lookup, and lead capture while taking advantage of Business Messages’s rich features.

Let’s take a look at an example.

Creating a Business Messages Helper bot

Create an agent dialog

For this example, I’m going to create a helper bot that can answer questions about Business Messages. I’m going to create a new Business Messages agent using the Business Communications Developer Console, use the native Bot-in-a-Box feature to automate the conversation powered by an FAQ and Dialogflow, and finally add a custom intent to support an about this bot input.

To get started, since I’m already registered for Business Messages, I’m going to go to the Business Communications Developer Console and create a new agent.

Once the agent is created, I can select the agent to see additional details and access the various configuration options.

Overview of a newly created Business Messages agent

Before setting up my Bot-in-a-Box experience, I want to make sure my agent is properly configured to greet new users. I click on Agent Information and from here I can set a welcome message and up to 5 conversation starters that help the user understand how to interact with the automated agent.

Agent information editor for a Business Messages agent

If I send myself the test URL and open the conversation on my phone, I’ll see that the Helper Bot has the greeting I configured and three conversation starters. Since I haven’t configured Bot-in-a-Box or a webhook to respond to user messages, if I send a message to the bot, nothing will happen.

Now that I have the basics setup, I’m going to click on the Integrations menu item in the developer console and configure Bot-in-a-Box via Dialogflow.

Setting up Bot-in-a-Box

The first step to setting up Bot-in-a-Box is to enable the Dialogflow integration. Currently, Bot-in-a-Box only supports the Dialogflow Essentials (ES) version of Dialogflow. However, you can integrate with Dialogflow Customer Experience (CX) by calling the CX APIs directly from a configured Business Messages webhook and programming the conversion to and from the Business Messages APIs.

From the Integrations section of the console, I click Enable integration. I am prompted to either create a new Dialogflow project or connect to an existing one. I’ve already created a Dialogflow project, so I choose to connect to an existing project and then I follow the prompts to set up the authentication between my Business Messages agent and the Dialogflow project.

Once the authentication is complete, I see an updated integration view like the one below. Next I want to Create knowledge base and add a FAQ document. Behind the scenes, Dialogflow will use machine learning to process the document and recognize questions similar to what exists in the FAQ.

Enabling the Dialogflow integration

The document can be a URL pointing to an existing FAQ for a business or if you don’t have one, you can create a FAQ using Google Sheets, download it as a CSV, and then upload the CSV to initialize Bot-in-a-Box. For the purposes of this example, I created an FAQ as shown in the document below and uploaded it to Bot-in-a-Box.

Example FAQ sheet created for Business Messages

I downloaded this Sheet as a CSV and uploaded it as the initial data set for Bot-in-a-Box to train with.

Upload an FAQ as training data for Bot-in-a-Box

Now that I have Bot-in-a-Box configured, I go back to the conversation I started with the Business Messages Helper Bot on my phone and try asking a question. The Business Messages agent is able to respond immediately with a matching answer pulled from the FAQ document I created.

Example conversation with Business Messages Helper Bot

With Bot-in-a-Box’s FAQ support, within just a few minutes, without writing any code, I was able to create a sophisticated digital agent that can answer common questions about Business Messages.

Adding in a custom intent

As a final step, we are going to add a custom intent to the Dialogflow project we setup that can respond with rich content when someone taps on the “About this bot” suggestion or enters a similar question in the conversation.

From the Integrations section of the Business Communications Developer Console, I click on View agent, which takes me into Dialogflow ES. I click on the Intents menu item, create a new intent called “About this bot”, enter a few training phrases that represent expressions that should match this intent, and a text response.

Creating a custom intent for responding to “about this experience” type inputs

Back in my conversation with the helper bot, I enter a message that should match this intent: “Who made this bot?”. Even though this phrase wasn’t explicitly part of the training phrases, my agent should match the intent and produce the response I configured.

Example text-based response from a custom intent

In this example, I’m responding with a simple text message, but what if I want to take advantage of Business Messages’s rich message support and respond with something like a rich card? I can do this by using Dialogflow’s custom payload option and use a valid Business Messages rich card payload in the response to create the card.

Example of creating a custom payload to respond with a Business Messages rich card

After creating the JSON structure for a card, I click Save and re-enter the chat on my phone asking “Who made this bot?” again and see the updated response.

Example rich card response form Helper Bot

Final thoughts

Google’s Business Messages is about enabling all businesses to welcome their customers and open a conversation, where and when they need it, as naturally as when a customer enters a store. Dialogflow is Google’s natural language understanding tool that processes user input, maps it to known intents, and responds with appropriate replies.

With Bot-in-a-Box, you can quickly combine the power of Business Messages that turns search queries into conversations, and Dialogflow to provide a turnkey solution to automate customer interactions with a business.

In this article, I showed how to use an FAQ to get up and running with Business Messages quickly and even create custom intents that can respond with rich responses to user inquiries, all without writing a single line of code. This no-code solution can easily be extended using Dialogflow’s fulfillment feature to pull in business information from a database or API, allowing you to support even more complex user journeys.

To learn more about Business Messages, check out our developer website and join our community. You can also check out the Business Messages Helper Bot powered by this technology available in our developer support section here.

I can’t wait to see what you build!

--

--

Sean Falconer

Head of Developer Relations and Marketing @ Skyflow | Engineer & Storyteller | 100% Canadian 🇨🇦 | Snowflake Data Superhero ❄️ | AWS Community Builder