Message Broadcast API Endpoint

In this article, we will 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"]
}
  1. filter_id: uuid of the filter
  2. message: Message to be sent to the user. This can be text, or one can add the tags: [audio]/[video]/[img]
  3. 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
  4. channels:
    platform: 0 is Facebook, 1 is webchat, 2 is zendesk
  5. message_tag: This is the platform-specific message tag
  6. 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\"}}"
    ]
}

 

Was this article helpful?

0 out of 0 found this helpful
Have more questions? Submit a request

Comments (0 comments)

Please sign in to leave a comment.