Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
]
Expand Down Expand Up @@ -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"] }
]
Expand Down
72 changes: 72 additions & 0 deletions en/webhooks/on-message-received-and-delivery.mdx
Original file line number Diff line number Diff line change
@@ -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'


<Info>
The `ReceivedCallback` webhook can be configured in two ways: receiving only messages sent by other users, or also receiving messages sent by you.
</Info>

<Warning>
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.
</Warning>

## 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.

<Warning>
Z-API only accepts **HTTPS** webhooks.
</Warning>

<Info>
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.
</Info>

---

## Update webhook

### Header

<InstanceId />
<Token />
### Body

<ParamField body="value" type="string" required>
Receiving webhook URL
</ParamField>

### 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".
26 changes: 18 additions & 8 deletions en/webhooks/on-message-received.mdx
Original file line number Diff line number Diff line change
@@ -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'


<Info>
The `ReceivedCallback` webhook can be configured in two ways: receiving only messages sent by other users, or also receiving messages sent by you.
</Info>

<Warning>
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.
</Warning>

## 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.

<Warning>
Z-API does not accept webhooks that are not **HTTPS**.
Z-API only accepts **HTTPS** webhooks.
</Warning>

<Info>
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.
</Info>

---
Expand All @@ -30,7 +40,7 @@ Media files are available for **30 days** in Z-API storage. To see all callback
### Body

<ParamField body="value" type="string" required>
Receive webhook URL
Receiving webhook URL
</ParamField>

### Request Body
Expand All @@ -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 specificationthat 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".
72 changes: 72 additions & 0 deletions webhooks/on-message-received-and-delivery.mdx
Original file line number Diff line number Diff line change
@@ -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'


<Info>
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.
</Info>

<Warning>
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)**.
</Warning>

## 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.

<Warning>
O Z-API não aceita webhooks que não sejam **HTTPS**.
</Warning>

<Info>
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).
</Info>

---

## Atualizar webhook

### Header

<InstanceId />
<Token />
### Body

<ParamField body="value" type="string" required>
URL do webhook de recebimento
</ParamField>

### 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".
10 changes: 10 additions & 0 deletions webhooks/on-message-received.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ import InstanceId from '/snippets/pt/params/instance-id.mdx'
import Token from '/snippets/pt/params/token.mdx'


<Info>
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.
</Info>

<Warning>
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)**.
</Warning>

## 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.
Expand Down