Facebook Messenger

The main difference to other channels is the fact that Facebook Messenger uses numeric identifier for a sender and recipient. So called "Page Scoped User ID (PSID)" for the sender and a "Page ID" for the recipient of the MO message. A person is assigned a unique PSID for each Facebook Page they start a conversation with.

These identifiers are visible in the CM.com platform as the userid under channels...Facebook Messenger.

Media message

See also receiving media messages

The support and restrictions for media files are the same as for sending Facebook Messenger messages.

Media files send by Facebook users will be hosted behind CM authentication as it may contain sensitive information of the user.

In order to download these media files, your request towards the provided media url should contain the X-CM-PRODUCTTOKEN header with your product token as its value.
As a registered user, you can find your product token on our platform in the Channels app or for older SMS accounts in the Gateway app.

❗️

Warning

Your product token is private information and should never be incorporated into webpages and/or mobile applications where it can be exposed to 3rd parties.

Suggestions

Quick reply

When the customer clicks on an item in a quick reply suggestion list, the reply will have the original action and the original postbackData in the custom/suggestions item:

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

Example message

{
  "reference": "my-reference",
  "messageContext": "",
  "from": {
    "number": "87654321",
    "name": "John Doe"
  },
  "to": {
    "number": "12345678"
  },
  "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": "Facebook Messenger"
}

Chosen product

🚧

Note

This feature is in beta and not publicly available yet

There are two scenarios in which you will receive this type of message:

  • When the end-user reacts to a sent product template (mobile only)
    • The end-user will be redirected to your Facebook shop when reacting via browser
  • When the end-user chooses a product in your Facebook shop

For both scenarios, the reply will have the referenced product id in the custom/suggestions item:

"custom: "{
  "suggestions": [
    {
      "action": "ViewProduct",
      "postbackData": "PRODUCT_ID"
    }
  ]
}

Example message

{
  "reference": "my-reference",
  "messageContext": "",
  "from": {
    "number": "87654321",
    "name": "John Doe"
  },
  "to": {
    "number": "12345678"
  },
  "message": {
    "text": "Chosen product",
    "media": {
      "mediaUri": "",
      "contentType": "",
      "title": ""
    },
    "custom": {
      "suggestions": [
        {
          "action": "ViewProduct",
          "postbackData": "PRODUCT_ID"
        }
      ]
    }
  },
  "groupings": ["", "", ""],
  "time": "2021-05-27 15:47:52",
  "timeUtc": "2021-05-27T13:47:52",
  "channel": "Facebook Messenger"
}