接收事件
message.received
帳號收到一則入站訊息。
依訊息類型的載荷
Text
{
"id": "evt_2f9c1a4b7e",
"type": "message.received",
"provider": "whatsapp",
"account_id": "acc_8c21d0",
"occurred_at": "2026-06-08T12:34:56Z",
"data": {
"conversation": { "id": "8613912345678", "type": "user" },
"sender": { "id": "8613912345678", "type": "user", "name": "Jordan Lee" },
"message": {
"id": "wamid.HBgM",
"type": "text",
"text": "Hi - is my order shipped yet?",
"direction": "inbound",
"sent_at": "2026-06-08T12:34:55Z"
},
"event": { "kind": "message_received" }
}
}Image (with caption)
{
"id": "evt_4a1c7b9e2f",
"type": "message.received",
"provider": "whatsapp",
"account_id": "acc_8c21d0",
"occurred_at": "2026-06-08T12:35:02Z",
"data": {
"conversation": { "id": "8613912345678", "type": "user" },
"sender": { "id": "8613912345678", "type": "user", "name": "Jordan Lee" },
"message": {
"id": "wamid.HBgN",
"type": "image",
"text": "Here's the unboxing photo",
"direction": "inbound",
"sent_at": "2026-06-08T12:35:02Z",
"attachments": [
{
"type": "image",
"url": "https://unifyport-media.oss-cn-hongkong.aliyuncs.com/pro/1/whatsapp/10001/2a1f.jpg?Expires=1749384902&Signature=...",
"mimetype": "image/jpeg"
}
]
},
"event": { "kind": "message_received" }
}
}Voice / Audio
{
"id": "evt_6b2d8c0f3a",
"type": "message.received",
"provider": "whatsapp",
"account_id": "acc_8c21d0",
"occurred_at": "2026-06-08T12:35:20Z",
"data": {
"conversation": { "id": "8613912345678", "type": "user" },
"sender": { "id": "8613912345678", "type": "user", "name": "Jordan Lee" },
"message": {
"id": "wamid.HBgO",
"type": "audio",
"direction": "inbound",
"sent_at": "2026-06-08T12:35:20Z",
"attachments": [
{
"type": "audio",
"url": "https://unifyport-media.oss-cn-hongkong.aliyuncs.com/pro/1/whatsapp/10001/9c3e.ogg?Expires=1749384920&Signature=...",
"mimetype": "audio/ogg; codecs=opus",
"duration_ms": 8000
}
]
},
"event": { "kind": "message_received" }
}
}Document (large file — url omitted)
{
"id": "evt_7c3e9d1a4b",
"type": "message.received",
"provider": "whatsapp",
"account_id": "acc_8c21d0",
"occurred_at": "2026-06-08T12:35:45Z",
"data": {
"conversation": { "id": "8613912345678", "type": "user" },
"sender": { "id": "8613912345678", "type": "user", "name": "Jordan Lee" },
"message": {
"id": "wamid.HBgP",
"type": "document",
"direction": "inbound",
"sent_at": "2026-06-08T12:35:45Z",
"attachments": [
{
"type": "document",
"mimetype": "application/pdf",
"title": "invoice-A1234.pdf",
"metadata": { "is_big_file": true, "size": 87421133 }
}
]
},
"event": { "kind": "message_received" }
}
}Location
{
"id": "evt_8d4f0e2b5c",
"type": "message.received",
"provider": "whatsapp",
"account_id": "acc_8c21d0",
"occurred_at": "2026-06-08T12:36:10Z",
"data": {
"conversation": { "id": "8613912345678", "type": "user" },
"sender": { "id": "8613912345678", "type": "user", "name": "Jordan Lee" },
"message": {
"id": "wamid.HBgQ",
"type": "location",
"text": "Shibuya Scramble Square, 2-24-12 Shibuya, Tokyo",
"direction": "inbound",
"sent_at": "2026-06-08T12:36:10Z"
},
"event": { "kind": "message_received" }
}
}備註
- data.conversation 是會話,data.sender 是傳送者,data.message 是訊息內容——id、type、text、direction(這裡恆為 inbound)與 sent_at。Telegram 還會帶 conversation.title、sender.username 以及 account 區塊;實際欄位依 provider 而異。
- data.message.type 取值為 text / image / video / audio / document / sticker / location / contact 之一(或 unknown)。媒體類型(image / video / audio / document / sticker)帶 data.message.attachments[];video 與 audio 多一個 duration_ms,document 帶檔名 title,超大檔案會設 attachments[].metadata.is_big_file 並省略 url。location 與 contact 沒有附件——內容在 data.message.text 裡(contact 是 vCard)。