Google's Business Messages

Please note that Google Business Messages uses id's (more technically GUIDs) as a sender and recipient.
In the from: field, you will find the GUID of the sender. Due to technical limitations, when you receive an MO message, the id in the to: field will be formatted without the dashes (-).

Media message

See also receiving media messages

Suggestions

When the customer clicks on an item in a quick reply suggestion list, the reply will have the original action, and the original postbackData that was added to the suggestion when sending the message in the custom/suggestions item:

"custom: "{
  "suggestions": [
    {
      "action": "Reply",
      "postbackData": "EDIT_APPOINTMENT"
    }
  ]
}

Other types of suggestions return the same basic structure, but with a different "action". For example, a "dial" action, will look like this:

"custom": {
  "suggestions": [
    {
      "action": "Dial",
      "postbackData": "HQ_NUMBER"
    }
  ]
}

An "OpenUrl" action, will look like this:

"custom": {
  "suggestions": [
    {
      "action": "OpenUrl",
      "postbackData": "HQ_WEBSITE"
    }
  ]
}

Message Example

{
  "reference": "my-reference",
  "messageContext": "",
  "from": {
    "number": "00000000-0000-0000-0000-000000000000",
    "name": "John Doe"
  },
  "to": {
    "number": "11111111111111111111111111111111"
  },
  "message": {
    "text": "Edit appointment",
    "media": {
      "mediaUri": "",
      "contentType": "",
      "title": ""
    },
    "custom": {
      "suggestions": [
        {
          "action": "Reply",
          "postbackData": "EDIT_APPOINTMENT"
        }
      ]
    }
  },
  "groupings": ["", "", ""],
  "time": "2021-05-27 15:47:52",
  "timeUtc": "2021-05-27T13:47:52",
  "channel": "Google Business Messages"
}

Message Context

In addition, Google also returns metadata in a "context" item in messages from end-users. This metadata contains information such as the end-users locale, the entry point of the conversation and a Google specific place id. This is GBM specific data, and we return it in a "custom/rawPayload" item.

The contents of the "context" metadata can vary.
An overview of possible data can be found here: https://developers.google.com/business-communications/business-messages/reference/rest/v1/Context
Below is an example of the rawPayload containing "context" data.

"custom": {
  "rawPayload": {
    "context": {
      "entryPoint": string,
      "userInfo": {
        "displayName": string,
        "userDeviceLocale": string
      },
      "widget": {
        "url": string,
        "widgetContext": string
      },
      "resolvedLocale": string,
      "customContext": string,
      "placeId": string,
      "nearPlaceId": string
    }
  }
}

Message Example

{  
  "reference": "my-reference",
  "messageContext": "",
  "from": {
    "number": "00000000-0000-0000-0000-000000000000",
    "name": "John Doe"
  },
  "to": {
    "number": "11111111111111111111111111111111"
  },
  "message": {
    "text": "Where is your company located",
    "media": {
      "mediaUri": "",
      "contentType": "",
      "title": ""
    },
    "custom": {
      "rawPayload": {
        "context": {
          "entryPoint": "MAPS",
          "userInfo": {
            "displayName": "John Doe",
            "userDeviceLocale": "en-NL"
          },
          "resolvedLocale": "en"
        }
      }
    }
  },
  "groupings": ["", "", ""],
  "time": "2021-05-27 15:47:52",
  "timeUtc": "2021-05-27T13:47:52",
  "channel": "Google Business Messages"
}