Eventos Disponíveis
Lista de eventos suportados e exemplos
Estamos em processo de melhorias da nossa documentação, em breve estaremos incluindo mais eventos com seus devidos exemplos.
instance.connected
A instância foi conectada com sucesso e está pronta para envio e recebimento de mensagens.
{
"created_at": "2024-03-14T23:33:13.623Z",
"data": {
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/..."
},
"id": "so9lv3u3pu81he8gumfa4", // ID da notificação
"type": "instance.connected"
}
instance.disconnected
A instância foi desconectada com sucesso.
Algumas vezes a desconexão pode acontecer devido a falhas internas do Whatsapp, internamente temos estrategias de recuperação, nestes casos o evento instance.connected
pode ser emitido alguns segundos depois do evento de desconexão.
{
"created_at": "2024-09-14T13:51:49.224Z",
"data": {
"name": "Account Name",
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/..."
"reason": {
"code": "logout",
"message": "The instance has been logged out."
}
},
"id": "682jcucv557qt0yarqivh",
"type": "instance.disconnected"
}
message.received
Uma mensagem foi recebida na instância. Para detalhamento completo de como é o formato do objeto mensagem verifique na página Estrutura dos eventos > Mensagem
{
"created_at": "2024-09-14T13:55:46.420Z",
"data": {
"content": {
"text": "Oi"
},
"id": "3AAB4DA4297176B74E38",
"recipient": {
"name": "Recipient Name",
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/...",
"type": "chat"
},
"sender": {
"name": "Sender Name",
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/..."
},
"sent_at": "2024-09-14T13:55:46.000Z",
"type": "text"
},
"id": "y66lhiw5la6z3r8f1urm0",
"type": "message.received"
}
{
"created_at": "2025-01-30T13:28:15.771Z",
"data": {
"content": {
"view_once": false,
"media": {
"url": "https://zapsterapi.s3.us-east-1.amazonaws.com/..."
},
"text": "My image caption"
},
"id": "3EB0AA6B4A8B13C4CA44E4",
"recipient": {
"name": "Recipient Name",
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/...",
"type": "chat"
},
"sender": {
"name": "Sender Name",
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/..."
},
"sent_at": "2025-01-30T13:28:15.000Z",
"type": "image"
},
"id": "sepu74f9o9c3y8gq0ikbl",
"type": "message.received"
}
{
"created_at": "2025-01-30T13:28:15.771Z",
"data": {
"content": {
"view_once": false,
"media": {
// URL para arquivo de áudio MP3
"url": "https://zapsterapi.s3.us-east-1.amazonaws.com/..."
},
"text": ""
},
"id": "3EB0AA6B4A8B13C4CA44E4",
"recipient": {
"name": "Recipient Name",
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/...",
"type": "chat"
},
"sender": {
"name": "Sender Name",
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/..."
},
"sent_at": "2025-01-30T13:28:15.000Z",
"type": "audio"
},
"id": "sepu74f9o9c3y8gq0ikbl",
"type": "message.received"
}
{
"created_at": "2025-01-30T13:31:56.534Z",
"data": {
"content": {
"location": {
"address": "São Paulo, SP",
"latitude": -9.123456789123456,
"longitude": -40.123456789123456,
"mode": "static",
"name": "Centro de Artes"
}
},
"id": "3A8A44190C6F468A1E90",
"recipient": {
"name": "Recipient Name",
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/...",
"type": "chat"
},
"sender": {
"name": "Sender Name",
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/..."
},
"sent_at": "2025-01-30T13:31:56.000Z",
"type": "location"
},
"id": "8qmaixneh95c4vb6xm89k",
"type": "message.received"
}
{
"created_at": "2025-01-30T13:36:41.856Z",
"data": {
"content": {
"media": {
"metadata": {
"animated": true
},
"url": "https://zapsterapi.s3.us-east-1.amazonaws.com/..."
}
},
"id": "3AB26376707099366558",
"recipient": {
"name": "Recipient Name",
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/...",
"type": "chat"
},
"sender": {
"name": "Sender Name",
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/..."
},
"sent_at": "2025-01-30T13:36:41.000Z",
"type": "sticker"
},
"id": "3niukssdl9ca2qktbv9u6",
"type": "message.received"
}
{
"created_at": "2025-01-30T13:39:37.156Z",
"data": {
"content": {
"view_once": false,
"media": {
"metadata": {
"duration": 1,
"playback": true
},
"url": "https://zapsterapi.s3.us-east-1.amazonaws.com/..."
},
"text": "My video/gif caption"
},
"id": "3AB703F9740E34B5E110",
"recipient": {
"name": "Recipient Name",
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/...",
"type": "chat"
},
"sender": {
"name": "Sender Name",
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/..."
},
"sent_at": "2025-01-30T13:39:36.000Z",
"type": "video"
},
"id": "jlmnxdp63p03wrv2ynepn",
"type": "message.received"
}
Observe a propriedade data.content.quoted
, ela representa a citação ou marcação de quem está respondendo e tem o mesmo formato de uma message.received
.
{
"created_at": "2025-02-02T21:18:28.437Z",
"data": {
"content": {
"view_once": false,
"quoted": {
"content": {
"text": "🙏"
},
"id": "3EB0E8FE1559DADE848EF5",
"recipient": {
"name": "Recipient Name",
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/...",
"type": "chat"
},
"sender": {
"name": "Sender Name",
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/..."
},
"type": "text"
},
"text": "My reply to quoted message"
},
"id": "3EB090C9F062EF62F1D924",
"recipient": {
"name": "Recipient Name",
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/...",
"type": "chat"
},
"sender": {
"name": "Sender Name",
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/..."
},
"sent_at": "2025-02-02T21:18:28.000Z",
"type": "text"
},
"id": "wy43uruj26ylse1cs38ps",
"type": "message.received"
}
Observe que o status respondido ficará dentro de data.content.quoted
que terá o mesmo formato de uma message.received
, a grande diferença aqui é que você verá uma nova propriedade data.content.quoted.origin
sendo o seu valor igual à status
.
Em alguns casos você pode encontrar uma variação do payload contendo uma propriedade para status que são postado em formato de texto, seu valor representará a cor do fundo (background), contendo no formato decimal, hexadecimal com e sem o canal alfa (transparência).
{
"background_color": {
"decimal": 4283864831,
"hex_argb": "#FF5696FF", // com o canal alfa
"hex_rgb": "#5696FF" // sem o canal alfa
}
}
{
"created_at": "2025-02-02T21:14:47.330Z",
"data": {
"content": {
"view_once": false,
"quoted": {
"content": {
"view_once": false,
"origin": "status",
"media": {
"url": "https://zapsterapi.s3.us-east-1.amazonaws.com/..."
},
"text": "My status caption"
},
"id": "E7531155884C68EAC1F3F1774E2CABD2",
"recipient": {
"name": "Recipient Name",
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/...",
"type": "chat"
},
"sender": {
"name": "Sender Name",
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/..."
},
"type": "image"
},
"text": "Answering to the posted status XYZ"
},
"id": "3EB02ADDF16B28F7CA3753",
"recipient": {
"name": "Recipient Name",
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/...",
"type": "chat"
},
"sender": {
"name": "Sender Name",
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/..."
},
"sent_at": "2025-02-02T21:14:46.000Z",
"type": "text"
},
"id": "p7ly4vp5jrlsw3yfm7pt2",
"type": "message.received"
}
Se a propriedade waid
(ela pode ser ausente) estiver presente dentro de data.content.contacts.phones
isso pode siginificar que o telefone / contato recebido tem um whatsapp válido.
{
"created_at": "2025-02-02T21:33:48.334Z",
"data": {
"content": {
"contacts": [
{
"vcard": "BEGIN:VCARD\nVERSION:3.0\nN:Test;Contato;;;\nFN:Contato Test\nTEL;type=CELL;waid=5511123451234:+55 11 12345-1234\nEND:VCARD",
"display_name": "Contato Test",
"first_name": "Contato",
"last_name": "Test",
"phones": [
{
"formatted_value": "+55 11 12345-1234",
"waid": "5511123451234"
}
]
}
]
},
"id": "3EB0B2B79F42613ACE4E",
"recipient": {
"name": "Recipient Name",
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/...",
"type": "chat"
},
"sender": {
"name": "Sender Name",
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/..."
},
"sent_at": "2025-02-02T21:33:47.000Z",
"type": "vcard"
},
"id": "u0hyeyfkiwfmjdwf937cs",
"type": "message.received"
}
As mensagens com botões poderão chegar com os tipos text, image ou video e sempre acompanhada da propriedade buttons em seu conteudo (data.content
).
{
"created_at": "2025-03-08T13:18:10.215Z",
"data": {
"content": {
"buttons": [
{
"id": "2ec4cf13-6c5c-48b3-af42-cc572d22c2b2",
"label": "Sim",
"type": "reply"
},
{
"id": "ccebc70b-aefd-492f-a19c-94b1384964be",
"label": "Não",
"type": "reply"
}
],
"text": "Você gostaria de informar seu endereço agora?"
},
"id": "3EB0303793FBDDACB97101",
"recipient": {
"name": "Recipient Name",
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/...",
"type": "chat"
},
"sender": {
"name": "Sender Name",
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/..."
},
"sent_at": "2025-03-08T13:18:08.000Z",
"type": "text"
},
"id": "n0co5zard1myk7wx07cks",
"type": "message.received"
}
Assim como o exemplo acima, o tipo de mensagem chegará como text, video ou image porém a propriedade button_reply (data.button_reply
) mostrará qual botão o usuário pressionou.
{
"created_at": "2025-03-08T13:43:34.060Z",
"data": {
"content": {
"text": "Sim",
"button_reply": {
"label": "Sim",
"type": "reply",
"id": "2ec4cf13-6c5c-48b3-af42-cc572d22c2b2"
},
"quoted": {
"content": {
"buttons": [
{
"label": "Sim",
"type": "reply",
"id": "2ec4cf13-6c5c-48b3-af42-cc572d22c2b2"
},
{
"label": "Não",
"type": "reply",
"id": "ccebc70b-aefd-492f-a19c-94b1384964be"
}
],
"text": "Você gostaria de informar seu endereço agora?"
},
"id": "3EB0303793FBDDACB97101",
"recipient": {
"name": "Recipient Name",
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/...",
"type": "chat"
},
"sender": {
"name": "Sender Name",
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/..."
},
"sent_at": "2025-03-08T13:18:08.000Z",
"type": "text"
}
},
"id": "A09627FC7D6444122AFF8AB0AB59BA6A",
"recipient": {
"name": "Recipient Name",
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/...",
"type": "chat"
},
"sender": {
"name": "Sender Name",
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/..."
},
"sent_at": "2025-03-08T13:43:31.000Z",
"type": "text"
},
"id": "kckozfp7fpn4cfxfbsglu",
"type": "message.received"
}
{
"created_at": "2025-03-08T17:54:47.475Z",
"data": {
"content": {
"list_options": {
"button_label": "Abrir lista de opções",
"sections": [
{
"description": null,
"options": [
{
"description": "Descrição, opção 1",
"id": "1",
"title": "Opção 1"
},
{
"description": "Descrição, opção 2",
"id": "2",
"title": "Opção 2"
}
],
"title": "Opções disponíveis"
}
]
},
"text": "Selecione a opção que melhor encaixa para você!"
},
"id": "3EB0D33E50E19D78A5A789",
"recipient": {
"name": "Recipient Name",
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/...",
"type": "chat"
},
"sender": {
"name": "Sender Name",
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/..."
},
"sent_at": "2025-03-08T17:54:46.000Z",
"type": "text"
},
"id": "f7wjjrkpd1d1nyjl3n5kl",
"type": "message.received"
}
Assim como o exemplo acima, o tipo de mensagem chegará como text porém a propriedade list_reply (data.list_reply
) mostrará qual opção o usuário selecionou.
{
"created_at": "2025-03-08T18:15:09.450Z",
"data": {
"content": {
"list_reply": {
"title": "Opção 2",
"description": "Descrição, opção 2",
"id": "2"
},
"text": "Descrição, opção 2",
"quoted": {
"content": {
"list_options": {
"button_label": "Abrir lista de opções",
"sections": [
{
"description": null,
"options": [
{
"description": "Descrição, opção 1",
"id": "1",
"title": "Opção 1"
},
{
"description": "Descrição, opção 2",
"id": "2",
"title": "Opção 2"
}
],
"title": "Opções disponíveis"
}
]
},
"text": "Selecione a opção que melhor encaixa para você!"
}
"id": "3EB0D33E50E19D78A5A789",
"recipient": {
"name": "Recipient Name",
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/...",
"type": "chat"
},
"sender": {
"name": "Sender Name",
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/..."
},
"sent_at": "2025-03-08T17:54:46.000Z",
"type": "text"
}
},
"id": "3EB081D5F40D11F1C39815",
"recipient": {
"name": "Recipient Name",
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/...",
"type": "chat"
},
"sender": {
"name": "Sender Name",
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/..."
},
"sent_at": "2025-03-08T18:15:08.000Z",
"type": "text"
},
"id": "9sj082811g9xm1bja68fp",
"type": "message.received"
}
message.sent
Uma mensagem foi enviada da instância mensagem pode ter sido enviada através do Whatsapp ou através da API da Zapster.
Você consegue identificar facilmente a origem do envio olhando para a propriedade data.origin
que tem 2 valores possíveis (zapsterapi
ou whatsapp
), que identificarão a origem do envio da mensagem.
Para detalhamento completo de como é o formato do objeto mensagem verifique na página Estrutura dos eventos > Mensagem
{
"created_at": "2024-09-14T13:55:46.420Z",
"data": {
"content": {
"text": "Oi"
},
"id": "3AAB4DA4297176B74E38",
"recipient": {
"name": "Recipient Name",
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/...",
"type": "chat"
},
"sender": {
"name": "Sender Name",
"id": "551112341234",
"profile_picture": "https://zapsterapi.s3.us-east-1.amazonaws.com/..."
},
"sent_at": "2024-09-14T13:55:46.000Z",
"origin": "zapsterapi",
"type": "text"
},
"id": "y66lhiw5la6z3r8f1urm0",
"type": "message.sent"
}