Webhook — Estrutura do Payload
O que a API entrega (POST application/json) na URL configurada em cada evento.
Envelope
{
"event": "message",
"instanceId": "af05f044",
"messageType": "text",
"timestamp": 1787844528,
"data": { ... }
}
data — evento message (texto)
{
"event": "message",
"instance": "af05f044",
"instancePhone": "18495054268",
"sender": { "number": "5537920009701", "jid": "5537920009701@s.whatsapp.net", "pushName": "Alberto Julio" },
"receiver": { "number": "5537920009701", "jid": "5537920009701@s.whatsapp.net" },
"messageId": "3EB040E5D70752FDE83B5E",
"messageType": "text",
"timestamp": 1787844527,
"datetime": "2026-08-27 15:28:47",
"isFromMe": false,
"isGroup": false,
"message": { "type": "text", "text": "hola" }
}
📱 Numero real (resolucao de LID):
o WhatsApp pode entregar a mensagem em modo LID (180590657695754@lid), que esconde o telefone.
A API resolve automaticamente: sender.number/sender.jid (e receiver) sempre trazem o
telefone real (5537920009701@s.whatsapp.net), em conversa direta e em grupo.
data.message por tipo
| type |
Campos adicionais em message |
| text | text |
| image / video | caption, mimetype, url, directPath, mediaKey, fileEncSha256, fileSha256, fileLength |
| audio | mimetype, ptt, url, directPath, mediaKey, fileEncSha256, fileSha256, fileLength |
| document | filename, mimetype, url, directPath, mediaKey, fileEncSha256, fileSha256, fileLength |
| sticker | mimetype, url, directPath, mediaKey, fileEncSha256, fileSha256, fileLength |
| location | latitude, longitude, name, address |
| button_reply | id, text, name (quick_reply / cta_url / cta_copy / cta_call), paramsJson, body |
| list_reply | id, text, description |
| contact | displayName, vcard |
Exemplo de midia (imagem)
{
"messageType": "image",
"data": {
"message": {
"type": "image",
"caption": "olha isso",
"mimetype": "image/jpeg",
"url": "https://mmg.whatsapp.net/o1/v/t62.7118-24/....enc",
"directPath": "/o1/v/t62.7118-24/....enc",
"mediaKey": "base64==",
"fileEncSha256": "base64==",
"fileSha256": "base64==",
"fileLength": 84213
}
}
}
🔐 Descriptografia de midia:
a CDN entrega o arquivo cifrado (AES-256-CBC) na url. Use mediaKey + fileEncSha256 para decifrar.
A url crua expira — use o directPath para re-solicitar uma URL fresca. O mediaKey so e enviado junto do fileEncSha256.