快速上手
回覆收到的訊息
使用入站對話作為目標。一般回覆省略 reply_to;引用回覆原樣複製入站 reply_token。
快速上手
- 1
呼叫前準備
呢一步要最先做:授權進度同即時入站訊息經 webhook 落,漏咗嘅投遞唔保證重播。用 ["*"] 可以訂閱全部公開標準事件;WhatsApp HistorySync 只提供有限嘅近期連續性,唔係持久歷史歸檔。
Webhook 投遞同簽章驗證 - 2
參數從哪裡取得
回覆時將 message.received 的 data.conversation.id、data.conversation.type 複製到 to.id、to.type。新收件方請依渠道標識規則處理。
message.received - 3
發送文字訊息
使用入站對話作為目標。一般回覆省略 reply_to;引用回覆原樣複製入站 reply_token。
發送文字訊息curl -X POST "https://api.unifyport.ai/v1/messages" \ -H "X-Api-Key: <YOUR_API_KEY>" \ -H "Content-Type: application/json" \ -d '{ "account_id": "acc_example", "to": { "id": "user_example", "type": "user" }, "message": { "type": "text", "text": "Hello from UnifyPort" } }' - 4
引用回覆訊息
使用入站對話作為目標。一般回覆省略 reply_to;引用回覆原樣複製入站 reply_token。
引用回覆訊息curl -X POST "https://api.unifyport.ai/v1/messages" \ -H "X-Api-Key: <YOUR_API_KEY>" \ -H "Content-Type: application/json" \ -d '{ "account_id": "acc_example", "to": { "id": "8600000000000@s.whatsapp.net", "type": "user" }, "message": { "type": "text", "text": "Sure - replying to your question above." }, "reply_to": { "reply_token": "<data.message.reply_token from the inbound event>" } }'