Skip to main content

Google’s Business Messages

Start receiving and sending messages from Google Maps & Google Search.

Google's Business Messages source provides a channel of communication between your Google Business Location and your running instance of Airy Core.

What you will learn
  • The required steps to configure Google's Business Messages source
  • How to connect a Google Business Location to Airy Core
note

The Google's Business Messages source is not enabled by default.

You need to add configuration in your airy.yaml file and apply it to activate it.

Configuration#

Google's Business Messages requires the following configuration:

Let's proceed step by step.

Step 1: Registration#

You first need to be registered with Google's Business Messages before configuring this source. Refer to Google's Business Messages guides to find more information about this source and the registration process.

Step 2: Editing of the yaml file in Airy Core#

Once you are registered, head over to your Google Service Account and create a key in json format.

Facebook token page

Copy the Google Service Account key file provided by Google to your airy.yaml file as a one line string next to saFile: (below components/sources/google).

Step 3: Verification by Google#

As a security measure, every request sent by Google is signed and verified against your partner key. You must also set the value for partnerKey: to your partner key, in your airy.yaml file, below components/sources/google.

note

Refer to the Configuration Docs on how to input these values.

note

Your Google Webhook URL should have the following format:

https://your-public-fqdn/google

or if you are using Ngrok:

https://RANDOM_STRING.tunnel.airy.co/google

Once the verification process has been completed, Google's Business Messages will immediately start sending events to your Airy Core instance 🎉

Connecting Google's Business Messages to your Airy Core instance#

After the configuration, you can connect a Google's Business Messages source to your instance by sending a request to the Channels endpoint.

Channels endpoint

Connect Google's Business Messages source to your Airy Core instance through the Channels endpoint


Connects a Google Business Account to Airy Core.

POST /channels.google.connect
  • gbm_id is the ID of your Google Business Message agent
  • name is the custom name for the connected business
  • image_url is the custom image URL
{
"gbm_id": "gbm-id",
"name": "My custom name for this location",
"image_url": "https://example.com/custom-image.jpg" // optional
}

Sample response

{
"id": "channel-uuid-1",
"metadata": {"name": "My custom name for this location", "image_url": "https://example.com/custom-image.jpg"},
"source": "google",
"source_channel_id": "gbm-id"
}

Send messages from Google's Business Messages source#

After connecting the source to your instance, you will be able to send messages through the Messages endpoint.

POST /messages.send

Sends a message to a conversation from Google's Business Messages source and returns a payload.

Note that when you send a message from this source, you must specify a representative, the individual or automation that composed the message. Google's Business Messages supports "BOT" and "HUMAN" as the representativeType. Find more information on Google's Business Messages guide.

Whatever is put on the message field will be forwarded "as-is" to the source's message endpoint.

Sending a text message

{
conversation_id: 'a688d36c-a85e-44af-bc02-4248c2c97622',
message: {
text: 'Hello!',
representative: {
representativeType: 'HUMAN',
},
},
}

Sample response

{
"id": '{UUID}',
"content": {
"text": 'Hello!',
"representative": {
"representativeType": 'HUMAN',
},
},
"delivery_state": 'pending|failed|delivered',
"from_contact": 'true|false',
// See glossary
"sent_at": '{string}',
//'yyyy-MM-dd'T'HH:mm:ss.SSSZ' date in UTC form, to be localized by clients
"source": 'google',
"metadata": {
"sentFrom": 'iPhone',
},
// metadata object of the message
}
Last updated on