# webhooks (POST)

Cria um novo web hook para eventos variados.

Importante! Reenviamos sem sucesso um evento webhook 3 vezes: em 10 secondos, em 5 minutos e em 2 horas. Para evitar sobrecarga, o webhook será desativado após 5 horas sem resposta de sucesso de recepção de dados. Você pode usar métodos Webhook (GET) e olha um seção de “erros” para mais detalhes.&#x20;

Request:

![](/files/dhGFlDk3zUolqGHIVSpK)

Body do Request:

![](/files/xhhgekSALWYSEOynA9mM)

Parâmetros:&#x20;

• name–nome do webhook criado. Até 5 webhooks são permitidos.&#x20;

• url – URL no seu servidor de onde os requests virão. Qualquer URL é permitida mas recomendamos https. Se o valor vazio (null) é definido, então o webhook é excluído&#x20;

• eventos – lista de eventos para os quais o webhook será engatilhado.&#x20;

o **inbox – mensagens recebidas do cliente.**&#x20;

Example of data: Array (\[message\_id] => 106773169 \[type] => from\_client \[text] => Text \[transport]=>telegram\[client\_id]=>100\[operator\_id]=> \[dialog\_id] => \[channel\_id] => 17 \[photo] => \[coordinates] => \[audio] => \[pdf]=> \[client]=> Array (\[id] => 17340089 \[phone] => \[tg] 807892 \[client\_phone] => \[name] => Peter \[assigned\_name] => \[external\_id]=>)\[hook\_type]=>inbox\[request\_id]=>8725057 \[attachments] => Array ( ) \[is\_new\_request] => 1 \[is\_new\_client] =>\[extra\_data] => Array ( ) \[event\_time] => 2019-07-28T23:01:40Z)&#x20;

o **outbox –mensagens sendo enviadas pelo sistema para um cliente.**&#x20;

Example of data: Array (\[message\_id] => 106773577 \[type] => to\_client \[text] => Bc\[ \[transport]=>telegram\[client\_id]=>17\[operator\_id]=>41164 \[dialog\_id] => 4324035 \[channel\_id] => 17404 \[photo] => \[coordinates]=>\[audio]=>\[pdf]=>\[client]=>Array (\[id]=> 17340089 \[phone] => \[tg] 807892 \[client\_phone] => \[name] => Peter \[assigned\_name] => \[external\_id] => ) \[hook\_type] => outbox \[request\_id] => 8725095 \[attachments] => Array ()\[is\_new\_request] => \[is\_new\_client] => \[event\_time] => 2019-07-28T23:01:40Z)

o **outbox\_status – envia erros, recebidos pela chat2desk pela API de mensageiros.**

&#x20;Example of event: MessagefromoperatorwasprocessedbyChat2Deskand senttoWhatsappBusinessAPI,butWABAresponded with error – «timeout error». Example of data: Array (\[id] => 106773577 \[external\_id] => 41164 \[dialog\_id] => 4324035 \[client\_id] => 17 \[channel\_id] => 17404 \[created] => 2019- 07-28T23:01:40Z \[gateway\_status] => failed \[error] => timeout error)&#x20;

o **new\_client –primeira mensagem recebida de um cliente.**&#x20;

Example of data: Array (\[id] => 18360561 \[phone] => \[tg] 1938691 \[name] => Peter \[avatar] => <https://storage.chat2desk.com/clients/avatars/2018-> 05/03-client2242811-5aeb3098bf2ec.jpg \[assigned\_name] => \[comment] => \[extra\_comment\_1] => \[client\_phone] => \[extra\_comment\_2] => \[extra\_comment\_3] => \[channels] => Array (\[id] => 17404 \[transports] => Array (\[0] => telegram ) ) \[region\_id] => \[country\_id] => \[custom\_fields] => \[hook\_type] => new\_client \[event\_time] => 2019-07-28T23:01:40Z)

o **add\_tag\_to\_client – uma tag é atribuída a um cliente.**

Example of data: Array (\[id] => 4835 \[name] => TestTag \[description] => This is test tag \[group\_id] => 1190 \[group\_name] => Tag test group \[client\_id] => 17340089 => \[all\_client\_channels] => 21288 => \[hook\_type] => add\_tag\_to\_client \[event\_time] => 2019-07-28T23:01:40Z)

o **add\_tag\_to\_request – uma tag é atribuída a um pedido.**

Example of data: Array (\[id] => 4835 \[name] => TestTag \[description] => This is test tag \[group\_id] => 1190 \[group\_name] => Tag test group \[client\_id] => 17340089 \[hook\_type] => add\_tag\_to\_request \[event\_time] => 2019-07-28T23:01:40Z)

o **delete\_tag\_from\_client – uma tag é excluída de um cliente.**

*Example of data:* Array (\[id] => 4835 \[name] => TestTag \[description] => This is test tag \[group\_id] => 1190 \[group\_name] => Tag test group \[client\_id] => 17340089 \[hook\_type] => delete\_tag\_to\_client \[event\_time] => 2019-07-28T23:01:40Z)

o **delete\_tag\_from\_request Novo –uma tag é excluída de um pedido.**

**Example of data**: Array (\[id] => 4835 \[name] => TestTag \[description] => This is test tag \[group\_id] => 1190 \[group\_name] => Tag test group \[client\_id] => 17340089 \[hook\_type] => delete\_tag\_from\_request \[event\_time] => 2019-07-28T23:01:40Z)

o **client\_updated  -informações do cadastro do cliente são modificadas.**

**Example of data:** Array (\[id] => 18360561 \[phone] => \[tg] 1938691 \[name] => Peter \[avatar] => <https://storage.chat2desk.com/clients/avatars/ava.jpg> \[assigned\_name] => \[comment] => \[extra\_comment\_1] => \[client\_phone] => \[extra\_comment\_2] => \[extra\_comment\_3] => \[channels]=>Array(\[id]=>17404\[transports]=>Array(\[0]=> telegram))\[region\_id]=>\[country\_id]=>\[custom\_fields]=> \[hook\_type] => client\_updated \[event\_time] => 2019-07- 28T23:01:40Z)

o **close\_dialog – uma conversa é fechada.**

**Example of data:** Array (\[dialog\_id] => 4324035 \[request\_id] => 8725057 \[created] => 1540282584 \[updated] => 1540464524 \[client\_id] => 1000 \[channel\_id] => 17404 \[operator\_id] => 41164 \[transport] => telegram \[hook\_type] => close\_dialog \[event\_time] => 2019-07- 28T23:01:40Z)

o **close\_request – um pedido é fechado.**

**Example of data:** Array (\[dialog\_id] => 3951761 \[request\_id] => 8086095 \[created] => 1550671015 \[updated] => 1550671015 \[channel\_id] => 126 \[client\_id] => 27129636 \[operator\_id] => 39538 \[transport] => telegram \[hook\_type] => close\_request \[event\_time] => 2019-07- 28T23:01:40Z)

o **dialog\_transferred–uma conversa é atribuída a um operador ou o operador responsável é alterado**

**Example of data:** Array (\[dialog\_id] => 3951761 \[request\_id] => 8086095 \[created] => 1550671015 \[updated] => 1550671015 \[channel\_id] => 126 \[client\_id] => 27129636 \[operator\_id] => 39538 \[current\_operator\_id] => 39538 \[transport] => telegram \[last\_operator\_id] => 8236 \[scenario\_id]=>124\[hook\_type]=>dialog\_transferred \[event\_time] => 2019-07-28T23:01:40Z)

o **new\_qr\_code – novo QR code para restaurar conexão com Whatsapp apareceu no site em Configurações/Contas. Significa que sua conexão com WhatsApp foi rompida e precisa ser reestabelecida.**

**Example of data:** Array (\[qrcode\_data] => 1\@OxrhCyoevcoool+z5GK+sBFL14vtAPH72jAl9eKQKO8VrSMSW3bsW zhx,Cf25AuQqLZmicHDNH9x3Og6gDMyXR9uVF16888S74g8=,BDVBT bHLr9gYB3LW52dNQQ== \[qrcode\_image] => data:image/png;base64,iVBORw0KG…= \[phone] => 339002538473 \[device\_owner] => service \[hook\_type] => new\_qr\_code \[event\_time] => 2019-07-28T23:01:40Z)

ai\_hints\_requested–este webhooké para provedores de IA(Inteligência artificial) e é usado de 2 formas:

1. Um operador ou sistema requisitou dicas de IA (sugestôes) no modo prompter. Dicas (sugestões) do provedor IA são esperadas em retorno. Para entender o context o provedor deve manter todas as mensagens usando eventos webhooks inbox e outbox (recomendado) ou messages (GET).

**Example of data:** {"client\_id":11910, "operator\_id":1, "dialog\_id":331, "request\_id": 2343, "channel\_id": 1, "message\_id": 8205 \[event\_time] => 2019- 07-28T23:01:40Z}

Em retorno, Provedor IA deve enviar dicas (sugestões) no seguinte formato:

"message\_id": 8205, "hints": \[{"id": 1, "text": "answer 1", "url": "", "relevance": 90, "link": ""},{"id": 2, "text": "answer 2", "url": "", "relevance": 97, "link": ""}]

2\. Um operador escolheu uma dica IA da lista acuma. Usou-a para ensinar o mecanismo de IA as respostas corretas.

**Example of data:** {"client\_id": 11910, "message\_id": 8205, "hint\_id": 2, "hook\_type": "ai\_hints\_requested" \[event\_time] => 2019-07- 28T23:01:40Z}

Para modificar webhooks existentes, use webhooks(PUT).  Veja webhooks(GET)para seus webhooks atuais.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://c2dbr-pt.gitbook.io/c2dbr/api-and-webhooks/webhooks-post.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
