Skip to main content

Event envelope

Every request sent to your webhook has the following top-level structure:

Common message fields

All payloads share the same fields in the message object, regardless of content type:

Group messages (WhatsApp Web)

On WhatsApp Web channels (metadata.middleware equal to "Z_API_WHATSAPP"), a message exchanged in a group carries the group identification in the internal_information of each item in contents and attachments: In a message received from a group, sender.identifier is the phone of whoever wrote it, not the group’s. Both group fields also appear when the message is sent to the group from the channel’s own number (metadata.from_me: true). Individual messages have no group_id or group_name.
In Z-API format webhooks, sent to Z-API Compatibility channels, a message received from a group follows the Z-API structure: phone and chatName identify the group, participantPhone and participantLid identify the sender, and the status callback carries isGroup: true.

Content types

The field that differentiates the message type is the @class inside each item of contents or attachments, combined with the type field.

TEXT — Text message

The content is in contents[0] with type: "TEXT".

IMAGE — Image with caption

The attachment is in attachments[0] with type: "IMAGE". The caption field is optional.

AUDIO — Voice message

The attachment is in attachments[0] with type: "AUDIO".

VIDEO — Video with caption

The attachment is in attachments[0] with type: "VIDEO". The caption field is optional.

STICKER — Sticker

The attachment is in attachments[0] with type: "STICKER". The URL points to a .webp file.

CONTACT_ARRAY — Contact(s)

The content is in contents[0] with type: "CONTACT_ARRAY". The contacts array can contain multiple contacts, each with first_name, last_name, name, and phones.

INTERACTIVE_BUTTON — Quick reply buttons (text)

The content is in contents[0] with type: "INTERACTIVE_BUTTON". The field internal_information.mediaButtonType indicates the attached media type: "TEXT" when there is no media.

INTERACTIVE_BUTTON — Quick reply buttons (with image)

When internal_information.mediaButtonType is "IMAGE", the thumbnail field contains the URL of the image displayed above the buttons.

INTERACTIVE_ACTION — Action buttons (URL and call)

The content is in contents[0] with type: "INTERACTIVE_ACTION". Each button in buttons has its own type: "URL" or "CALL". The header and footer fields are optional.

Type summary