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。