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。