# Cài đặt đẩy SMS nhận được từ điện thoại lên chatbot

Hướng dẫn này chỉ dành cho người đã có chatbot đang hoạt động bằng nền tảng Smax.Bot. Nếu bạn chưa biết chatbot là gì, hãy xem các bài hướng dẫn đầu tiên tại <https://bot.vn/hoc-chatbot/> hoặc 2 video ở phụ lục để tạo chatbot cho mình nhé!

{% content-ref url="/pages/-MjNVLfcmPL83am-SD6v" %}
[Phụ lục: Hướng dẫn tạo chatbot cơ bản](/ket-noi-sms-va-chatbot/phu-luc-huong-dan-tao-chatbot-co-ban.md)
{% endcontent-ref %}

Sau khi đã có chatbot, giờ mình sẽ tiến hành thao tác cài đặt để khi có tin nhắn SMS mới thì báo về Messenger theo các bước sau:

1\. **BƯỚC 1:** vào app đã cài trên điện thoại và bật mục **Read Received** lên.

![](/files/-MjNRwzN0eHX_uynlYKR)

2\. **BƯỚC 2:** Vào bot, tạo 1 block báo tin có SMS (ví dụ như bên dưới là thẻ Text).&#x20;

![](/files/-MjNWZOcGFmXQPZFjzTP)

> * Số điện thoại người gửi sẽ được lưu trong attribute **{{number}}** và toàn bộ nội dung sms sẽ được lưu trong attribute **{{message}}**.
> * Bạn sẽ dựa vào 2 attribute này để phát triển luồng chatbot xử lý như: báo về Telegram, Email, bắt từ khoá trong sms...

3\. **BƯỚC 3:** Tạo Broadcast API mới cho block, copy link broadcast và điền vào ô Webhook Broadcast API SmaxBot bên dưới rồi Lưu lại. (chú ý chỗ Messenger User ID là mã số của người phụ trách nhận tin báo từ chatbot, có thể tìm mã số này ở mục Customers)

![Tạo Broadcast API và copy link này](https://i.imgur.com/rzJWuL0.png)

4\. **BƯỚC 4:** Dán link Broadcast API đã tạo ở bước 2 vào rồi bấm Lưu webhook.

![](/files/-MjNWErSJsgFnNFbHhJE)

Như vậy, mỗi khi điện thoại Android của bạn nhận được SMS, chatbot sẽ gửi tin nhắn Messenger theo Messenger User ID đã khai báo, với nội dung của tin nhắn đã thực hiện ở bước 2.


---

# 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://hdsms.quanchatbot.com/ket-noi-sms-va-chatbot/cai-dat-day-sms-tu-dien-thoai-len-chatbot.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.
