API 參考

快速上手

傳送圖片和檔案

先確認渠道能力,準備可存取的媒體 URL,並選擇支援的訊息類型。

快速上手

  1. 1

    呼叫前準備

    先確認渠道能力,準備可存取的媒體 URL,並選擇支援的訊息類型。

    統一訊息發送能力
  2. 2

    參數從哪裡取得

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

    發送文字訊息
  3. 3

    發送媒體訊息

    先確認渠道能力,準備可存取的媒體 URL,並選擇支援的訊息類型。

    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": "video",
        "url": "https://cdn.example.com/video/demo.mp4",
        "caption": "hello video"
      },
      "provider_data": {
        "seconds": 12
      }
    }'
    發送媒體訊息
  4. 4

    如何理解結果

    保留回傳的 message_id 與 provider_ref,用於關聯後續事件或排查。accepted 不表示已送達;僅在管道支援回執時,透過對應事件確認送達。識別碼格式因管道而異。

    Webhook 投遞同簽章驗證