Message Broadcast API endpoint

In this article, we'll cover the following regarding the Message Broadcast API endpoint:

Message Broadcast

POST /api/broadcast/

Accessible for

  • All Users

Sample POST body

{
  "filter_id": "b83c6c08-621d-425d-9282-add6a9fb77c1",
  "message": [
		{
			"type": "text",
			"text": "Example message!"
		},
		{
			"type": "wait",
			"wait": 1000
		},
		{
			"type": "text",
			"text": "[audio]http://www.sshhtt.com/images/sampledata/christmas/tinkerbell.mp3[/audio]"
		}
	],
  "next_module_id": 27,
  "channels": [
    {
      "platform": 0,
      "message_tag": "BUSINESS_PRODUCTIVITY"
    },
    {
      "platform": 1,
      "message_tag": ""
    }
  ],
  "suggested_replies": ["yes", "no"]
}
  • filter_id: uuid of the filter
  • message: Message to be sent to the user. This can be text, or one can add the tags: [audio]/[video]/[img]
  • next_module_id: User will be treated as if they have landed on this module. Hence, user's response will be evaluated as per the connections mentioned inside this module
  • channels: Platform. 0 is Facebook, 1 is webchat, 2 is zendesk
  • message_tag: This is the platform-specific message tag
  • suggested_replies: Options (quick replies)

Example of use

curl 'https://app.certainly.io/api/frontend/reports/messages/?fromDate={startDate}&toDate={endDate}&botId={botUUID}'
\ -H 'authorization: JWT {userToken}' -H 'content-type: application/json'

Sample response

{
    "id": 16,
    "filter_id": "b83c6c08-621d-425d-9282-add6a9fb77c1",
    "total_matching_count": 1,
    "next_module_id": 47,
    "suggested_replies": ["yes", "no"],
    "created_date": "27.12.2018",
    "message": "[audio]http://www.sshhtt.com/images/sampledata/christmas/tinkerbell.mp3[/audio]",
    "fb_matching_users": 1,
    "fb_broadcast_success_count": 0,
    "webchat_matching_users": 0,
    "webchat_broadcast_success_count": 0,
    "zendesk_matching_users": 0,
    "zendesk_broadcast_success_count": 0,
    "channels": [
        {
            "platform": 0,
            "message_tag": "BUSINESS_PRODUCTIVITY"
        },
        {
            "platform": 1,
            "message_tag": "WRONG TAG"
        }
    ],
    "fb_broadcast_error_list": [
        "{\"error\":{\"message\":\"(#100) Invalid tag.\",\"type\":\"OAuthException\",\"code\":100,\"fbtrace_id\":\"Fr5g6aj1Oit\"}}"
    ]
}