API 參考
接收事件

conversation.history

WhatsApp 在啟動或重連後同步了某個會話的近期歷史訊息。

事件載荷

{
  "id": "evt_wa_history_10001_8613912345678@s.whatsapp.net",
  "type": "conversation.history",
  "provider": "whatsapp",
  "account_id": "acc_8c21d0",
  "occurred_at": "2026-06-08T12:46:00Z",
  "data": {
    "conversation": { "id": "8613912345678@s.whatsapp.net", "type": "user" },
    "messages": [
      {
        "id": "3EB0A1",
        "type": "text",
        "text": "Previous order question",
        "direction": "inbound",
        "sent_at": "2026-06-08T11:58:12Z",
        "sender": { "id": "8613912345678@s.whatsapp.net" },
        "reply_to_message_id": "3EB09F",
        "mentions": [
          { "id": "8613900001111@lid" }
        ]
      },
      {
        "id": "3EB0A2",
        "type": "image",
        "direction": "inbound",
        "sent_at": "2026-06-08T11:59:20Z",
        "sender": { "id": "8613912345678@s.whatsapp.net" },
        "attachments": [
          {
            "type": "image",
            "mimetype": "image/jpeg",
            "expired": true
          }
        ]
      },
      {
        "id": "3EB0A3",
        "type": "location",
        "text": "Shibuya Scramble Square",
        "direction": "inbound",
        "sent_at": "2026-06-08T12:00:10Z",
        "sender": { "id": "8613912345678@s.whatsapp.net" },
        "location": {
          "longitude": 139.7020,
          "latitude": 35.6580
        }
      }
    ]
  }
}

備註

  • 某個 WhatsApp 會話的一批 HistorySync 資料。data.messages[] 依時間正序,可帶 id、type、direction、sent_at、sender、text、location、mentions、reply_to_message_id 與 attachments;歷史訊息不含 reply_token。
  • 這是 best-effort 的近期連續性,不是完整歸檔或保證重放。一次同步最多處理最近 100 個活躍會話、每會話最近 100 則訊息;僅最近 20 則保留訊息進入媒體 URL 預取,較舊、不可用或過期媒體使用 attachments[].expired=true 且不帶 url。