Tài liệu Smax.Bot
  • Tìm hiểu về ChatBot
  • Công cụ Smax.bot
  • 1. Bắt đầu với Smax.bot
    • Các thuật ngữ
    • Các Menu chính
    • _1.1 Tạo bot đầu tiên
    • _1.2 Kết nối bot với Fanpage
    • _1.3 Tạo kịch bản chatbot đầu tiên
  • 2. Giới thiệu các Element (card)
    • _2.1 Text
    • _2.2 Typing
    • _2.3 Image
    • _2.4 Quick Reply
    • _2.5 Gallery
    • _2.6 User Input
    • _2.7 Set Attribute
    • _2.8 Go to Block
    • _2.9 Sequence
    • _2.10 JsonAPI
    • _2.11 Attr to Sheet
    • _2.12 Sheet to Attr
    • _2.13 Note
    • _2.14 On/Off Bot
    • _2.15 Send Block
    • _2.16 A/B Testing
    • _2.17 Page Event
    • _2.18 Check Like
    • _2.19 Send Video
    • _2.20 Delay
    • _2.21 Audio
    • _2.22 Add Album
    • _2.23 SmaxChat Tags
    • _2.24 Media
    • _2.25 One-Time Notification
    • _2.27 Attach File
    • _2.29 Sub/UnSub
    • _2.30 Find Customer
    • _2.31 Split Attribute
    • _2.32 Comment
    • _2.33 Fb Audience
    • _2.34 Send Gmail
  • 3. Các tính năng chính
    • _3.1 Từ Khóa
    • _3.2 Bot Menu
    • _3.3 Bot Comment
    • _3.4 Khách hàng
    • _3.5 Kịch bản chăm sóc
    • _3.6 Gửi Broadcast
    • _3.7 Thống Kê
    • _3.8 Kết nối
    • Tin Nhắn Trả Phí
    • _3.9 Công cụ
      • __3.9.1 Json Ads
      • __3.9.2 Clone Code
      • __3.9.3 Messenger Plugin
    • _3.10 Cấu hình
      • __3.10.1 Connect Page
      • __3.10.2 Team
      • __3.10.3 Time Zone
      • __3.10.4 Broadcasting API Token
      • __3.10.5 Domain Whitelisting
  • 4. TÍNH NĂNG KHÁC
    • _4.1 Cách sử dụng Hàm
    • _4.2 Kết nối với Botplus
    • _4.3 Tải Khách Hàng
    • _4.4 Set Attribute hàng loạt
    • _4.5 Sử dụng công thức cho Attribute
    • 4.6 Cách sử dụng bộ lọc
  • 5. GÓI CƯỚC
    • 5.1 Đăng ký gói cước
    • 5.2 Nâng cấp gói cước
    • 5.3 Đổi page sang gói cước mới
  • 6. API
    • Broadcasting API
    • JSON API
  • 7. Thông Tin Khác
    • Chính sách Facebook Messenger năm 2020
Powered by GitBook
On this page
  • Broadcasting API - V1
  • Broadcasting API - V2

Was this helpful?

  1. 6. API

Broadcasting API

Previous5.3 Đổi page sang gói cước mớiNextJSON API

Last updated 1 year ago

Was this helpful?

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