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#
Attributos | Type | Description |
---|---|---|
waitingMessage | boolean | Identifies if your message is in "Waiting for message" status |
phone | string | Phone number, or number of the group that sent the message. |
participantPhone | string | Phone number of the group member who sent the message. |
messageId | string | Message identifier in the conversation. |
status | string | Status the message is in at the time of sending (PENDING, SENT, RECEIVED, READ or PLAYED). |
referenceMessageId | string | Reference the message that was replied to in case the message received is a reply to a message in the conversation. |
momment | integer | Time when the message was received or from the error. |
type | string | Instance event type, in this case it will be "ReceivedCallBack". |
photo | string | Photo url of the user who sent the message. |
text.message | string | Message text. |
image.caption | string | Photo’s caption |
image.imageUrl | string | Photo’s URL |
image.thumbnailUrl | string | Photo’s URL thumbnail |
image.mimeType | string | Image’s Mime Type |
audio.mimeType | string | Audio’s MimeType |
audio.audioUrl | string | Audio’s URL |
video.caption | string | Video’s caption |
video.videoUrl | string | Video’s URL |
video.mimeType | string | Video’s MimeType |
contact.displayName | string | Contact’s name |
contact.vCard | string | VCard containing the contact information. |
document.mimeType | string | Document’s MimeType |
document.fileName | string | Document’s name |
document.title | string | Document’s Title |
document.pageCount | string | Number of pages in the document |
document.thumbnailUrl | string | URL of the document's thumbnail. |
document.documentUrl | string | Document’s URL |
location.thumbnailUrl | string | Location thumbnail url. |
location.longitude | float | Location’s longitude |
location.latitude | float | Location's latitude |
location.url | string | Localization’s URL |
location.name | string | Localization’s name |
location.address | string | Localizations’s address |
sticker.mimeType | string | Sticker’s MimeType |
sticker.stickerUrl | string | Stickers URL |
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#
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.