API 參考

快速入門

回覆收到的訊息

使用入站對話作為目標。一般回覆省略 reply_to;引用回覆原樣複製入站 reply_token。

開始使用

  1. 1

    呼叫前準備

    請先做這一步:授權進度與即時入站訊息透過 webhook 送達,漏掉的投遞不保證重放。以 ["*"] 可訂閱全部公開標準事件;WhatsApp HistorySync 僅提供有限的近期連續性,不是持久歷史歸檔。

    Webhook 投遞與簽章驗證
  2. 2

    參數從哪裡取得

    回覆時將 message.received 的 data.conversation.id、data.conversation.type 複製到 to.id、to.type。新收件方請依渠道標識規則處理。

    message.received
  3. 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. 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>"
      }
    }'
    引用回覆訊息