From 76f5d4d5510dc9acfddee454c206b9182d10d177 Mon Sep 17 00:00:00 2001 From: danielmarcianodo Date: Wed, 12 Aug 2026 17:28:52 -0300 Subject: [PATCH] create on message received and delivery and update on message received --- docs.json | 4 +- .../on-message-received-and-delivery.mdx | 72 +++++++++++++++++++ en/webhooks/on-message-received.mdx | 26 ++++--- webhooks/on-message-received-and-delivery.mdx | 72 +++++++++++++++++++ webhooks/on-message-received.mdx | 10 +++ 5 files changed, 174 insertions(+), 10 deletions(-) create mode 100644 en/webhooks/on-message-received-and-delivery.mdx create mode 100644 webhooks/on-message-received-and-delivery.mdx diff --git a/docs.json b/docs.json index 4eecfcc..e540691 100644 --- a/docs.json +++ b/docs.json @@ -133,7 +133,7 @@ { "group": "Status", "pages": ["status/introduction", "status/send-text-status", "status/send-image-status", "status/send-video-status", "status/reply-status-text", "status/reply-status-gif", "status/reply-status-sticker"] }, { "group": "Message Queue", "pages": ["queue/introduction", "queue/get-queue", "queue/post-queue", "queue/delete-queue", "queue/delete-queue-id", "queue/update-queue-settings"] }, { "group": "WhatsApp Business", "pages": ["business/introduction", "business/edit-product", "business/get-products", "business/get-products-phone", "business/get-products-v2", "business/get-products-phone-v2", "business/get-product-id", "business/delete-product", "business/tags", "business/tags-colors", "business/create-tag", "business/edit-tag", "business/delete-tag", "business/tags-add", "business/tags-remove", "business/chats-notes", "business/save-catalog-config", "business/create-collection", "business/list-collections", "business/delete-collection", "business/edit-collection", "business/list-collection-products", "business/add-product-to-collection", "business/remove-product-from-collection", "business/company-description", "business/company-email", "business/company-address", "business/company-websites", "business/business-hours", "business/available-categories", "business/company-categories", "business/profile"] }, - { "group": "Webhooks", "pages": ["webhooks/introduction", "webhooks/on-message-send", "webhooks/on-message-send-examples", "webhooks/on-message-received", "webhooks/on-message-received-examples", "webhooks/on-whatsapp-disconnected", "webhooks/on-whatsapp-message-status-changes", "webhooks/on-chat-presence", "webhooks/on-chat-presence-examples", "webhooks/on-webhook-connected", "webhooks/update-every-webhooks", "webhooks/update-notify-sent-by-me", "webhooks/update-filters"] }, + { "group": "Webhooks", "pages": ["webhooks/introduction", "webhooks/on-message-send", "webhooks/on-message-send-examples", "webhooks/on-message-received", "webhooks/on-message-received-and-delivery", "webhooks/on-message-received-examples", "webhooks/on-whatsapp-disconnected", "webhooks/on-whatsapp-message-status-changes", "webhooks/on-chat-presence", "webhooks/on-chat-presence-examples", "webhooks/on-webhook-connected", "webhooks/update-every-webhooks", "webhooks/update-notify-sent-by-me", "webhooks/update-filters"] }, { "group": "Partners", "pages": ["partner/introduction", "partner/create-instance", "partner/sign-instance", "partner/unsubscribe-instance", "partner/list-instances", "partner/update-instance", "partner/configure-proxy", "partner/update-proxy-webhook", "partner/extension-token", "partner/sdk-connector-token"] }, { "group": "Integrators", "pages": ["integrators/introduction"] } ] @@ -227,7 +227,7 @@ { "group": "Status", "pages": ["en/status/introduction", "en/status/send-text-status", "en/status/send-image-status", "en/status/send-video-status", "en/status/reply-status-text", "en/status/reply-status-gif", "en/status/reply-status-sticker"] }, { "group": "Message Queue", "pages": ["en/queue/introduction", "en/queue/get-queue", "en/queue/post-queue", "en/queue/delete-queue", "en/queue/delete-queue-id", "en/queue/update-queue-settings"] }, { "group": "WhatsApp Business", "pages": ["en/business/introduction", "en/business/edit-product", "en/business/get-products", "en/business/get-products-phone", "en/business/get-products-v2", "en/business/get-products-phone-v2", "en/business/get-product-id", "en/business/delete-product", "en/business/tags", "en/business/tags-colors", "en/business/create-tag", "en/business/edit-tag", "en/business/delete-tag", "en/business/tags-add", "en/business/tags-remove", "en/business/chats-notes", "en/business/save-catalog-config", "en/business/create-collection", "en/business/list-collections", "en/business/delete-collection", "en/business/edit-collection", "en/business/list-collection-products", "en/business/add-product-to-collection", "en/business/remove-product-from-collection", "en/business/company-description", "en/business/company-email", "en/business/company-address", "en/business/company-websites", "en/business/business-hours", "en/business/available-categories", "en/business/company-categories", "en/business/profile"] }, - { "group": "Webhooks", "pages": ["en/webhooks/introduction", "en/webhooks/on-message-send", "/en/webhooks/on-message-send-examples","en/webhooks/on-message-received", "en/webhooks/on-message-received-examples", "en/webhooks/on-whatsapp-disconnected", "en/webhooks/on-whatsapp-message-status-changes", "en/webhooks/on-chat-presence", "en/webhooks/on-chat-presence-examples", "en/webhooks/on-webhook-connected", "en/webhooks/update-every-webhooks", "en/webhooks/update-notify-sent-by-me", "en/webhooks/update-filters"] }, + { "group": "Webhooks", "pages": ["en/webhooks/introduction", "en/webhooks/on-message-send", "/en/webhooks/on-message-send-examples","en/webhooks/on-message-received", "en/webhooks/on-message-received-and-delivery", "en/webhooks/on-message-received-examples", "en/webhooks/on-whatsapp-disconnected", "en/webhooks/on-whatsapp-message-status-changes", "en/webhooks/on-chat-presence", "en/webhooks/on-chat-presence-examples", "en/webhooks/on-webhook-connected", "en/webhooks/update-every-webhooks", "en/webhooks/update-notify-sent-by-me", "en/webhooks/update-filters"] }, { "group": "Partners", "pages": ["en/partner/introduction", "en/partner/create-instance", "en/partner/sign-instance", "en/partner/unsubscribe-instance", "en/partner/list-instances", "en/partner/update-instance", "en/partner/configure-proxy", "en/partner/update-proxy-webhook", "en/partner/extension-token", "en/partner/sdk-connector-token"] }, { "group": "Integrators", "pages": ["en/integrators/introduction"] } ] diff --git a/en/webhooks/on-message-received-and-delivery.mdx b/en/webhooks/on-message-received-and-delivery.mdx new file mode 100644 index 0000000..4b19928 --- /dev/null +++ b/en/webhooks/on-message-received-and-delivery.mdx @@ -0,0 +1,72 @@ +--- +title: "On Message Received - Sent by Me" +api: "PUT /instances/{instanceId}/token/{token}/update-webhook-received-delivery" +description: "Webhook callback for received messages" +--- +import InstanceId from '/snippets/en/params/instance-id.mdx' +import Token from '/snippets/en/params/token.mdx' + + + +The `ReceivedCallback` webhook can be configured in two ways: receiving only messages sent by other users, or also receiving messages sent by you. + + + +When you configure the webhook through the `On Message Received - Sent by Me` endpoint, the API automatically starts giving priority to the URL configured there. This means that even if you already have a webhook configured on the **[On Message Received](/en/webhooks/on-message-received)** endpoint, it remains saved, but stops being used while this one is active. + +To go back to using the URL configured on the **[On Message Received](/en//webhooks/on-message-received)** endpoint and stop receiving messages sent by you, you need to disable the `Notify Sent by Me` option through the **[Update Notify Sent by Me](/en/webhooks/update-notify-sent-by-me)** endpoint. + + +## Overview + +This webhook works like the standard callback for received messages, with one difference from the regular **On Message Received**: when configured, it updates the receiving webhook URL so that messages sent by you are also notified. + + +Z-API only accepts **HTTPS** webhooks. + + + +Media files remain available for **30 days** in Z-API storage. To see all callback examples by message type, check the [Callback Examples](/en/webhooks/on-message-received-examples) page. + + +--- + +## Update webhook + +### Header + + + +### Body + + + Receiving webhook URL + + +### Request Body + +```json +{ + "value": "https://your-system-address.com/instance/YOUR_INSTANCE/receive-delivery" +} +``` + +--- + +## Response + +### 200 + +```json +{ + "value": true +} +``` + +### 405 + +In this case, make sure you're sending the correct method specification — that is, check whether you sent a POST or PUT as specified at the beginning of this topic. + +### 415 + +If you receive a 415 error, make sure to add the "Content-Type" of the object you're sending in the request headers, most commonly "application/json". \ No newline at end of file diff --git a/en/webhooks/on-message-received.mdx b/en/webhooks/on-message-received.mdx index a83540f..32bd2c6 100644 --- a/en/webhooks/on-message-received.mdx +++ b/en/webhooks/on-message-received.mdx @@ -1,22 +1,32 @@ --- -title: "On receive" +title: "On Message Received" api: "PUT /instances/{instanceId}/token/{token}/update-webhook-received" -description: "Webhook for received message callbacks" +description: "Webhook callback for received messages" --- import InstanceId from '/snippets/en/params/instance-id.mdx' import Token from '/snippets/en/params/token.mdx' + +The `ReceivedCallback` webhook can be configured in two ways: receiving only messages sent by other users, or also receiving messages sent by you. + + + +When you configure the webhook through the **[On Message Received - Sent by Me](/en/webhooks/on-message-received-and-delivery)** endpoint, the API automatically starts giving priority to the URL configured there. This means that even if you already have a webhook configured on the `On Message Received` endpoint, it remains saved, but stops being used while this one is active. + +To go back to using the URL configured on the `On Message Received` endpoint and stop receiving messages sent by you, you need to disable the **Notify Sent by Me** option through the **[Update Notify Sent by Me](/en/webhooks/update-notify-sent-by-me)** endpoint. + + ## Overview -This is the webhook for received message callbacks, also triggered when your instance is configured to notify messages sent by yourself. +This is the callback webhook for received messages. It's also triggered when your instance is configured to notify messages sent by you as well. -Z-API does not accept webhooks that are not **HTTPS**. +Z-API only accepts **HTTPS** webhooks. -Media files are available for **30 days** in Z-API storage. To see all callback examples by message type, check the [Callback examples](/en/webhooks/on-message-received-examples) page. +Media files remain available for **30 days** in Z-API storage. To see all callback examples by message type, check the [Callback Examples](/en/webhooks/on-message-received-examples) page. --- @@ -30,7 +40,7 @@ Media files are available for **30 days** in Z-API storage. To see all callback ### Body - Receive webhook URL + Receiving webhook URL ### Request Body @@ -55,8 +65,8 @@ Media files are available for **30 days** in Z-API storage. To see all callback ### 405 -Make sure you are correctly sending the method specification, that is, verify that you sent POST or PUT as specified at the beginning of this topic. +In this case, make sure you're sending the correct method specification — that is, check whether you sent a POST or PUT as specified at the beginning of this topic. ### 415 -If you receive a 415 error, make sure to add the "Content-Type" header to your request, which in most cases is "application/json". +If you receive a 415 error, make sure to add the "Content-Type" of the object you're sending in the request headers, most commonly "application/json". \ No newline at end of file diff --git a/webhooks/on-message-received-and-delivery.mdx b/webhooks/on-message-received-and-delivery.mdx new file mode 100644 index 0000000..a67bf2c --- /dev/null +++ b/webhooks/on-message-received-and-delivery.mdx @@ -0,0 +1,72 @@ +--- +title: "Ao receber - enviadas por mim" +api: "PUT /instances/{instanceId}/token/{token}/update-webhook-received-delivery" +description: "Webhook de retorno de mensagens recebidas" +--- +import InstanceId from '/snippets/pt/params/instance-id.mdx' +import Token from '/snippets/pt/params/token.mdx' + + + +O webhook `ReceivedCallback` pode ser configurado de duas formas: recebendo apenas as mensagens enviadas por outros usuários, ou recebendo também as mensagens enviadas por você mesmo. + + + +Ao configurar o webhook através do endpoint `Ao receber - enviadas por mim`, a API passa a dar prioridade automaticamente à URL configurada nesse endpoint. Ou seja, mesmo que você já tenha um webhook configurado no endpoint **[Ao receber](/webhooks/on-message-received)**, ele permanece salvo, porém deixa de ser utilizado enquanto o outro estiver ativo. + +Para voltar a utilizar a URL configurada no endpoint **[Ao receber](/webhooks/on-message-received)** e deixar de receber as mensagens enviadas por você mesmo, é necessário desativar a opção `Notificar as enviadas por mim também` através do endpoint **[Atualizar notificar enviadas por mim](/webhooks/update-notify-sent-by-me)**. + + +## Conceituação + +Este webhook funciona como o retorno padrão de mensagens recebidas, porém com uma particularidade em relação ao **Ao receber** comum: ao configurá-lo, a URL do webhook de recebimento é atualizada para que as mensagens enviadas por você mesmo também sejam notificadas. + + +O Z-API não aceita webhooks que não sejam **HTTPS**. + + + +Os arquivos de mídia ficam disponíveis por **30 dias** no armazenamento da Z-API. Para ver todos os exemplos de retorno por tipo de mensagem, consulte a página [Exemplos de retorno](/webhooks/on-message-received-examples). + + +--- + +## Atualizar webhook + +### Header + + + +### Body + + + URL do webhook de recebimento + + +### Request Body + +```json +{ + "value": "https://endereco-do-seu-sistema.com.br/instancia/SUA_INSTANCIA/receive-delivery" +} +``` + +--- + +## Response + +### 200 + +```json +{ + "value": true +} +``` + +### 405 + +Neste caso certifique que esteja enviando corretamente a especificação do método, ou seja verifique se você enviou o POST ou PUT conforme especificado no início deste tópico. + +### 415 + +Caso você receba um erro 415, certifique de adicionar na headers da requisição o "Content-Type" do objeto que você está enviando, em sua grande maioria "application/json". \ No newline at end of file diff --git a/webhooks/on-message-received.mdx b/webhooks/on-message-received.mdx index 4293afd..e71307d 100644 --- a/webhooks/on-message-received.mdx +++ b/webhooks/on-message-received.mdx @@ -7,6 +7,16 @@ import InstanceId from '/snippets/pt/params/instance-id.mdx' import Token from '/snippets/pt/params/token.mdx' + +O webhook `ReceivedCallback` pode ser configurado de duas formas: recebendo apenas as mensagens enviadas por outros usuários, ou recebendo também as mensagens enviadas por você mesmo. + + + +Ao configurar o webhook através do endpoint **[Ao receber - enviadas por mim](/webhooks/on-message-received-and-delivery)**, a API passa a dar prioridade automaticamente à URL configurada nesse endpoint. Ou seja, mesmo que você já tenha um webhook configurado no endpoint `Ao receber`, ele permanece salvo, porém deixa de ser utilizado enquanto o outro estiver ativo. + +Para voltar a utilizar a URL configurada no endpoint `Ao receber` e deixar de receber as mensagens enviadas por você mesmo, é necessário desativar a opção **Notificar as enviadas por mim também** através do endpoint **[Atualizar notificar enviadas por mim](/webhooks/update-notify-sent-by-me)**. + + ## Conceituação Esse é o webhook de retorno de mensagens recebidas, também é executado quando a sua instância está configurada para notificar também mensagens enviadas por você mesmo.