Upon receiving
Concept#
This is the incoming message return webhook
Attention
Z-API does not accept webhooks that aren’t HTTPS
Updating the webhook#
To update the webhook route, you can do it through the API or through the admin panel.
API#
/update-webhook-received#
PUT
https://api.z-api.io/instances/YOUR_INSTANCE/token/YOUR_TOKEN/update-webhook-received
Or#
You can also update the route with the "sent by me" option enabled.
/update-webhook-received-delivery#
PUT
https://api.z-api.io/instances/YOUR_INSTANCE/token/YOUR_TOKEN/update-webhook-received-delivery
Header#
Key | Value |
---|---|
Client-Token | ACCOUNT SECURITY TOKEN |
Request Body#
Administrative panel#
Returns from webhooks#
The possible returns of the on-message-received webhook are registered below:
Response#
Attributes | Type | Description |
---|---|---|
isStatusReply | boolean | Identifies if the received message is a status reply |
senderLid | string | WhatsApp contact ID |
connectedPhone | string | Phone number connected to the API |
waitingMessage | boolean | Identifies if your message is in the "Waiting for message" status |
isEdit | boolean | Identifies if the received message was edited |
isGroup | boolean | Indicates if the chat is a group |
isNewsletter | boolean | Indicates if the chat is a channel |
phone | string | Phone number or group that sent the message |
fromMe | boolean | Indicates if the message was sent from the number connected to the API |
participantPhone | string | Phone number of the group member who sent the message |
participantLid | string | WhatsApp contact ID of the group participant who sent the message |
messageId | string | Message identifier in the conversation |
status | string | Status of the message at the time of sending (PENDING, SENT, RECEIVED, READ, or PLAYED) |
referenceMessageId | string | References the message if the received message is a reply to a previous message in the conversation |
momment | integer | Moment when the message was received or the error occurred |
messageExpirationSeconds | integer | Time for temporary messages |
requestMethod | string | Identifier for the incoming request method (invite_link OR non_admin_add ) |
type | string | Type of instance event, in this case "ReceivedCallBack" |
photo | string | URL of the user's photo who sent the message |
text.message | string | Message text |
image.caption | string | Photo caption |
image.imageUrl | string | URL of the photo |
image.thumbnailUrl | string | URL of the photo thumbnail |
image.mimeType | string | MimeType of the image |
audio.mimeType | string | MimeType of the audio |
audio.audioUrl | string | URL of the audio |
video.caption | string | Video caption |
video.videoUrl | string | URL of the video |
video.mimeType | string | MimeType of the video |
contact.displayName | string | Contact name |
contact.vCard | string | VCard containing contact information |
document.mimeType | string | MimeType of the document |
document.fileName | string | Document name |
document.title | string | Document title |
document.pageCount | string | Number of pages in the document |
document.thumbnailUrl | string | URL of the document thumbnail |
document.documentUrl | string | URL of the document |
location.thumbnailUrl | string | URL of the location thumbnail |
location.longitude | float | Longitude of the location |
location.latitude | float | Latitude of the location |
location.url | string | URL of the location |
location.name | string | Location name |
location.address | string | Location address |
sticker.mimeType | string | MimeType of the sticker |
sticker.stickerUrl | string | URL of the sticker |
200#
Text return example#
Template text return example#
Reaction return example#
Example return text (Button List)#
Example return text (Picklist)#
Image return example#
Template image return example#
Audio feedback example#
Video return example#
Template video return example#
Contact feedback example#
Document return example#
Template document return example#
Example of a group join request via an invitation link#
Example of a group join request added by a participant#
Localization’s feedback example#
Template localization return example#
Template OTP button return example#
Pix key button return example#
Button with image return example#
Button with video return example#
Sticker feedback example#
Example of return of payment made#
Payment request return example#
Example of an admin promoted to newsletter#
Example of an admin demoted of newsletter#
Example of payment receipt return#
Product return example#
Cart return example#
Example of Poll Response#
Example of Poll Response Message#
Send order return example#
Update order return example#
Newsletter admin invitation return example#
Pin message return example#
Event return example#
Event response return example#
405#
In this case certify that you are sending the correct specification of the method. This means, verify if you sent a POST or PUT as specified at the beginning of this topic.
415#
In case you receive 415 error, make sure to add the “Content-Type” of the object you are sending in the request headers, mostly “application/json”
Notification Response#
Concept#
Notifications are WhatsApp messages that are based on WhatsApp preview message templates.
This way, the notifications we receive are documented here, if you do not want to receive these notifications, you must ignore the message when it arrives with the notification attribute.