Broadcasting API

Broadcasting API - V1

The Broadcasting API enables you to send any block from the bot’s structure or set user attributes via an API call.

All queries to the Broadcasting API must be served via POST, with the content type application/json and need to be presented in this form:

https://api.smax.bot/bots/<BOT_ID>/users/<USER_ID>/send?bot_token=<TOKEN>&block_name=<BLOCK_NAME>&<USER_ATTRIBUTE_1>=<VALUE_1>&<USER_ATTRIBUTE_2>=<VALUE_2>&messaging_tag="CONFIRMED_EVENT_UPDATE"
  • <TOKEN> — A unique secret token obtained for each bot. You are able to find and reset the token in Configure tab of the dashboard at any time.

  • <USER_ID> — {{messenger user id}} attribute that you should get from a JSON plugin call prior to sending a message. {{messenger user id}} and {{fb_id}} are accepted as well.

  • <BOT_ID> — ID of the bot you want to send the message from.

  • <BLOCK_NAME> [optional] — URL-encoded name of the block you want to send to a user. You can also use <BLOCK_ID> — ID of the block you want to send to a user, instead.

  • <USER_ATTRIBUTE>=<VALUE> [optional] — Name and value of a user attribute you want to set up before rendering the block.

  • messaging_tag — You can use 1 of the following tags: "CONFIRMED_EVENT_UPDATE"

    • " CONFIRMED_EVENT_UPDATE"

    • "POST_PURCHASE_UPDATE"

    • "ACCOUNT_UPDATE"

The response contains a JSON object, which always has a Boolean field success and may have an optional String field result with a human-readable description of the result. If success equals true, the request was successful. In the case of an unsuccessful request, success equals false and the error is explained in the result field. Note:

  • You can send up to 25 RPS per bot to the Broadcasting API.

  • All parameters starting with chatfuel_ are reserved and should not be used.

Broadcasting API - V2

Post API: https://api.smax.bot/public/bots/<botID>/send

Headers: 
	{"Authorization":"Bearer <Bot Token>"}
	
Body: 
	{
		"customer_id":"<Customer Id>", // Id khach hang
		"customer_email":"<Customer Email>", // Email khach hang
		"customer_phone":"<Customer Phone>", // Phone của khach hang
		"customer_fbid":"<Customer fbId>", // Id FV khach hang
		"block_id":"<BLock ID>", // nếu muốn gửi 1 block
		"messages":[  // nếu muốn gửi trực tiếp nội dung
			{"text":"Noi dung tin nhan"}
		],
		"notification_messages_token": "token NTN",
		"one_time_notif_token": "token OTN",
		"messaging_tag": "CONFIRMED_EVENT_UPDATE", // CONFIRMED_EVENT_UPDATE/POST_PURCHASE_UPDATE/ACCOUNT_UPDATE/HUMAN_AGENT
		"priority": ["fbid","phone","email"]
	}
	
Note: 
- customer_id/email/phone/fbid: Bắt buộc phải có 1 trường, nếu có thêm thì hệ thống sẽ tự cập nhật

Last updated