# 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**"
  * &#x20;"**POST\_PURCHASE\_UPDATE"**
  * &#x20;"**ACCOUNT\_UPDATE"**

![](/files/-MLLEDfm26bihVm0XswC)

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

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tailieu.smax.bot/api/broadcasting-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
