Skip to main content

Google Business Manager Integration

Introduction

  • Introduction to GBM : Google Business Profile, previously known as Google My Business, is a free tool provided by Google that enables businesses and organizations to manage their online presence across various Google platforms, including Google Search and Google Maps. However, Google Business Manager is a different tool altogether and primarily focuses on managing access to Google services and resources within organizations. While both tools aim to facilitate better management and visibility for businesses online, Google Business Profile focuses on managing the public-facing business information visible to customers, while Google Business Manager is more about managing access and permissions within an organization for various Google services and resources.

  • Google Business Messages is a chat platform for businesses to connect with customers.

  • Google Business Messages integrates with Google Maps and Search, enabling customers to find and message businesses easily

  • Entry points to the chatbot can be from-:

    • Google Maps
    • Organic Google Search
    • Brand Websites

When a user clicks on a messaging button, they start a conversation with an entity representing the brand—the brand's agent.

The conversation takes place on a Google messaging surface available on iOS and Android. You receive and respond to customer messages, through the agent, using a webhook and the Business Messages API.

How to Create Agent

An agent is a conversational entity that users interact with. You create one agent for each brand you manage. You create and manage agents with the Business Communications API, and you control messaging for your agents with the Business Messages API.

  1. Open the Business Communications Developer Console and sign in with your Business Messages Google account (rbm@oriserve.com).
  2. Click Create agent.
  3. For Agent type, select Business Messages.
  4. Enter values for Brand name and Agent name.
  5. Do one of the following:
    • To experience a conversation with your agent where you can explore the available features, select Enable Business Messages Helper Bot.
    • To customize your agent and prepare it for message handling, deselect Enable the Business Messages Helper Bot.
  6. Click Create agent.
Note

💡 The agent is a representation of a brand, as created and managed by Oriserve.

Setting Up the Webhook

  1. Open the Account settings in the Business Communications Developer Console.(rbm@oriserve.com)
  2. Make sure the correct partner account is selected.
  3. For Business Messages webhook URL, click Configure.
  4. For Webhook endpoint URL, enter your application's URL + "/callback".
  5. In the Developer Console, click Verify.
Note

💡 Oriserve manages the agent on behalf of a brand. Partners receive inbound messages at a specific webhook, route inbound messages to automation or live agents to compose responses, and send outbound messages to the Business Messages API.

Request Handler of GBM

Toggle to helpers→gbm→requesthandler.js

router.post('/gbc', gbcReqHandler, async (req, res, next) => {
// return res.send();
return
});

Important Keys and IDs

  • Brand Id - Set by google once the brand is registered
  • Agent id - Set by google once the agent is registered
  • Conversation Id (PSID) - Sent by google when a user initiates the chat
  • Custom Agent id - A partner-specified identifier for the agent.
  • messageId - A unique identifier for the message
  • name - The full conversation and message identifier
  • Text - message
  • createTime - timestamp sent by google(message created time)
  • placeId - A unique identifier from the Google Places database for the location that the user messaged.
  • sendTime - The time that Business Messages sent the message to the agent.
  • Image- Include a signed URL for an image the user uploaded.

Sending messages

To send a message, you send an HTTP POST request to the Business Messages API that includes

  • a unique message ID
  • the conversation ID (PSID- unique)
  • the message content
Note

💡 Refer: helpers→gbm→gbmEmitter.js

Types of Messages

  • Plain text
  • Rich text with limited Markdown formatting support
  • Suggested replies [*When a user taps a suggested reply, your agent receives a message that contains the reply's text and postback data.]*
  • Suggested actions (eg- Dial Action)
  • Suggestions to authenticate via OAuth
  • Suggestions to request a live agent
  • Rich cards (Carousels, image with buttons)

Limitations of Message and Media

Suggested replies have a maximum of 25 characters, and a message has a maximum of 13 suggestions.

Rich cards can contain the following items:

Media (JPG, JPEG, or PNG, maximum 5 MB)
Media thumbnail (JPG, JPEG or PNG, maximum 25 KB)
Title (maximum 200 characters)
Description (maximum 2000 characters)
A list of suggested_replies and suggested_actions (maximum 4)

Carousels may contain a minimum of two and a maximum of ten rich cards

Limitations on Timeouts

Bot-only -Feedbacks30 minutes after the last message
Human-only-Feedbacks12 hours after the last message
Bot and human -Feedbacks12 hours after the last message
After user last messageYou can send messages to a user up to 30 days

Integration with Website đź’ˇ

This includes creating and adding the business message widget on the website. Below three keys needs to be updated for inserting the widget-

ValueDescription
LAYOUTHow the button appears on your website. Can be button, floating, inline, or advanced. To use your own styles, use advanced, copy the stylesheet to your webpage, and modify as required.
AGENT_IDYour Agent ID.
BUTTON_TEXTThe text you'd like the button to display.

You can check how to set up the messaging widget on the website.

For enabling the widget we need to pass our webhook and some other attributes including agent id in the div element.

<!-- Example div element that converts into a Business Messages widget -->
<div
  data-bm-widget-agent-id="myagentid"
  data-bm-widget-context="eyJwcm9kdWN0IjoiZHJ5ZXIiLCJvZmZlci1jb2RlIjoiQVNEQURTQSJ9Cg==">
  Click for Business Messages
</div>

Verification for Agents and Locations

Pre-Requisites for Agent

  • Partner name (your organization's name)
  • Partner email (your email)
  • Website of the brand the agent represents, as a publicly available URL starting with "https://"
  • Contact name and email (usually shares a domain with the brand website) for the brand the agent represents who can verify your business relationship with the brand and your authority to represent the brand

Pre-Requisites for Location

  • Agent Verification
  • Place Id
  • Entry Points

All are the required fields

Keys Required for ENV

gbmKey={"type":"service_account","project_id":"vil-gbm-prod","private_key_id":"cbbdf444320c9d6da905c5898757cb22217d1c44","private_key":"-----BEGIN PRIVATE KEY-----\nMIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQC5Hk5Z4G0MnHkQ\nSQSbOYy/OQqqegTNe2bj8FTnytfZ+tJgTbLXOtU57Ns65Fa/27ZAp2uIQ8EEwTXG\ndvpX4/3V4hEZ5staQyya5gVayO5D0x0A53OkaexjgXRWQtk0Cit4oGQSsDen9E9I\naWOnoqa7qNKK2g46STS/0qMoXvlU7s8MKRR1amlpBZqc+BzHacAmCbXBQV8OTn+n\n+S6LvIQLR0hzri9L+4ZQtm6nZJD4cprZVaIuu33SICIE8Du7IN6JaYo8r0atq7ku\ny5lDtkPnLH0+xHKNzKl29tYWVdW/LqtiXeq2+d9mcr7WKg5h/tQnHjK0sUY/sKmL\nNP65POYJAgMBAAECggEADHqeBoU2yxhYBhoeABOUYnM6cSNYZCLmKZ+sYZNbeXuY\nJ45lUjv9kfH4SPm89u8DoLHu8X8iKZHKvO4m6+2kt81z096qi6zZx2r4WaMQG/nE\n/ttOmnrar04gcdlmYff9Is/d6+9kH308XcgsKlAWurGW2KEtco43ysyTKIGkGWHO\nsQFtiULXqou8WpdqvdR9/+g0Z1j1hvVNkDxZxpvXYTVHxLl2UCgjv75JScEkkcPB\nHboWig7qBZPtwKif4QxJm1VmUYfjsyjQTFRO56Sb4k4YZw76sTJL+mJYAN8JiIHv\nsWZ2Z08fvs7sRamsqCwpkEBAWpzFevazHtGdfTIG7wKBgQD0paNXEyTp/UGn/KDf\nfPPAIE97TKM/Ceehffmm3TuuJNfoRWfoG5BPE3VQsbMPgI4ZiQ5usfq96gYTJJnk\nUSqX4f5XOXICWc8c3rlGe6qJxLGJTvI6srde1VOo0wX0A7V/OwXSjbTj9c/DUyUa\nz2lovyqGyd5eD2P0xjJZ7vY6UwKBgQDBtXqH1Kt8r8PZaZPfTi3bAadR5cJyd7lw\nkv1nGFo1mGDSLYT6t3KQISp1UpuujkUep9oPxzvVhWBJeN1BUJtTkaXlSDHYDXBp\nC56XamR+PaWH/eFDi4ArM9n7oZl8EDWryhaZAwMJUPKhaA3opaQZ25aTOQbDa3sr\nEL/lKW2qswKBgF0Wvb0/OpeSVy49cVU4rWMYqEWpVqCA+1M2pQz6N2A/AqyN5Eis\nXE/KfqQyyYiHiQpsXUJ/lII5DxCvp6L5w3RBeM7lu9zrIWTB1svb+HstjcRKdt8g\n66c5Evk1Opmr457C7ac9ZmwrN2ACPicibuB9hQf+vg8aWhVkaPpRc/2jAoGAeGRu\nj1Vib9BeDRZNTZCtd1yDvabrP3Gh05HH5PeBuaXHJ1obOCgkD+hNFzYMhGTwGKmC\nIiRVz9NhkMiJ2zpaD4qKbQJ92CYiI2eRXdJGOx/dbbQg+XYOZsuHQ5mgZzc75FVp\nzhfNH1EsO50MZ/frEhckcsQSrAp1NsLmQWuKOXkCgYBLOXz4/CW3+N0xVtvyhXIJ\nWdh60bGW1RckgKRI7dWEVLrePnlSpbWD/fPlhyc7NpHzj8iISUVjf7TPst5Igpdd\nSVcjjYKpODT/Rk4yL5EeZCgHAZ1MG4qmXNRXD7lJ/AFg/29EnYS5Ubm4TBD3qnQ6\nFQbOOklYO+9gDgsoKwTXyg==\n-----END PRIVATE KEY-----\n","client_email":"vil-gbm-prod@vil-gbm-prod.iam.gserviceaccount.com","client_id":"106243177650533730516","auth_uri":"[https://accounts.google.com/o/oauth2/auth](https://accounts.google.com/o/oauth2/auth)","token_uri":"[https://oauth2.googleapis.com/token](https://oauth2.googleapis.com/token)","auth_provider_x509_cert_url":"[https://www.googleapis.com/oauth2/v1/certs](https://www.googleapis.com/oauth2/v1/certs)","client_x509_cert_url":"[https://www.googleapis.com/robot/v1/metadata/x509/vil-gbm-prod%40vil-gbm-prod.iam.gserviceaccount.com](https://www.googleapis.com/robot/v1/metadata/x509/vil-gbm-prod%40vil-gbm-prod.iam.gserviceaccount.com)"}

Need to know further-

Please Visit- HERE.