Nesta área
Webhooks
Manage webhook endpoints, deliveries and replays.
List webhooks
get/v1/public/webhooks
Parâmetros
Sem parâmetros.
Respostas
200Webhooks list returned
Exemplos
curl -X GET "https://api.cognizy.ai/api/v1/public/webhooks" \
-H "Authorization: Bearer $COGNIZY_API_KEY"Create webhook
post/v1/public/webhooks
Aceita Idempotency-Key
Registers a webhook endpoint. The HMAC signing secret is returned ONCE in the response — store it; we never expose it again.
Parâmetros
Sem parâmetros.
Corpo (JSON)obrigatório
urlstring (uri)obrigatório- Target URL that will receive the POST. Must be HTTPS in production.
eventsstring[]obrigatório- List of event names to subscribe to.
descriptionstringopcional- Optional human-readable description for this webhook.
whatsAppInstanceIdsstring[]opcional- Only deliver events from these WhatsApp numbers (ids from GET /whatsapp/instances). Empty or omitted = every number. Events without a number (contacts, deals, website chat) are always delivered.
| Campo | Tipo | Descrição |
|---|---|---|
urlobrigatório | string (uri) | Target URL that will receive the POST. Must be HTTPS in production. |
eventsobrigatório | string[] | List of event names to subscribe to. |
descriptionopcional | string | Optional human-readable description for this webhook. |
whatsAppInstanceIdsopcional | string[] | Only deliver events from these WhatsApp numbers (ids from GET /whatsapp/instances). Empty or omitted = every number. Events without a number (contacts, deals, website chat) are always delivered. |
Respostas
201Webhook created. The signing secret is returned ONCE here.400Missing url or invalid event list
Exemplos
curl -X POST "https://api.cognizy.ai/api/v1/public/webhooks" \
-H "Authorization: Bearer $COGNIZY_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"url": "https://api.example.com/webhooks/cognizy",
"events": [
"message.created",
"conversation.closed"
],
"description": "Sync incoming messages with Salesforce",
"whatsAppInstanceIds": [
"whatsAppInstance_123"
]
}'Get webhook by id
get/v1/public/webhooks/{id}
Parâmetros
idstringobrigatório· caminho- Webhook ID
| Campo | Onde | Tipo | Descrição |
|---|---|---|---|
idobrigatório | caminho | string | Webhook ID |
Respostas
200Webhook returned404Webhook not found
Exemplos
curl -X GET "https://api.cognizy.ai/api/v1/public/webhooks/<id>" \
-H "Authorization: Bearer $COGNIZY_API_KEY"Update webhook
patch/v1/public/webhooks/{id}
Aceita Idempotency-Key
Parâmetros
idstringobrigatório· caminho- Webhook ID
| Campo | Onde | Tipo | Descrição |
|---|---|---|---|
idobrigatório | caminho | string | Webhook ID |
Corpo (JSON)obrigatório
urlstring (uri)opcionaleventsstring[]opcionaldescriptionstringopcionalisActivebooleanopcional- Set
falseto pause delivery without deleting the webhook. Re-enabling resets the failure streak. whatsAppInstanceIdsstring[]opcional- Only deliver events from these WhatsApp numbers (ids from GET /whatsapp/instances). Empty or omitted = every number. Events without a number (contacts, deals, website chat) are always delivered.
| Campo | Tipo | Descrição |
|---|---|---|
urlopcional | string (uri) | |
eventsopcional | string[] | |
descriptionopcional | string | |
isActiveopcional | boolean | Set false to pause delivery without deleting the webhook. Re-enabling resets the failure streak. |
whatsAppInstanceIdsopcional | string[] | Only deliver events from these WhatsApp numbers (ids from GET /whatsapp/instances). Empty or omitted = every number. Events without a number (contacts, deals, website chat) are always delivered. |
Respostas
200Webhook updated400Invalid event list404Webhook not found
Exemplos
curl -X PATCH "https://api.cognizy.ai/api/v1/public/webhooks/<id>" \
-H "Authorization: Bearer $COGNIZY_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"url": "https://example.com/webhooks/cognizy",
"events": [
"texto"
],
"description": "texto",
"isActive": true,
"whatsAppInstanceIds": [
"whatsAppInstance_123"
]
}'Delete webhook
delete/v1/public/webhooks/{id}
Parâmetros
idstringobrigatório· caminho- Webhook ID
| Campo | Onde | Tipo | Descrição |
|---|---|---|---|
idobrigatório | caminho | string | Webhook ID |
Respostas
204Webhook deleted404Webhook not found
Exemplos
curl -X DELETE "https://api.cognizy.ai/api/v1/public/webhooks/<id>" \
-H "Authorization: Bearer $COGNIZY_API_KEY"Send a test event
post/v1/public/webhooks/{id}/test
Aceita Idempotency-Key
Dispatches a webhook.test event to the configured URL using the current signing secret.
Parâmetros
idstringobrigatório· caminho- Webhook ID
| Campo | Onde | Tipo | Descrição |
|---|---|---|---|
idobrigatório | caminho | string | Webhook ID |
Respostas
200Test event dispatched404Webhook not found
Exemplos
curl -X POST "https://api.cognizy.ai/api/v1/public/webhooks/<id>/test" \
-H "Authorization: Bearer $COGNIZY_API_KEY" \
-H "Idempotency-Key: $(uuidgen)"Rotate webhook secret
post/v1/public/webhooks/{id}/rotate-secret
Aceita Idempotency-Key
Issues a new signing secret. The previous one stays valid for 24h, with both signatures emitted in X-Cognizy-Signature (v1=<new>,v1=<old>).
Parâmetros
idstringobrigatório· caminho- Webhook ID
| Campo | Onde | Tipo | Descrição |
|---|---|---|---|
idobrigatório | caminho | string | Webhook ID |
Respostas
200New signing secret returned (shown ONCE)404Webhook not found
Exemplos
curl -X POST "https://api.cognizy.ai/api/v1/public/webhooks/<id>/rotate-secret" \
-H "Authorization: Bearer $COGNIZY_API_KEY" \
-H "Idempotency-Key: $(uuidgen)"List webhook deliveries
get/v1/public/webhooks/{id}/deliveries
Parâmetros
idstringobrigatório· caminho- Webhook ID
limitstringopcional· consulta
| Campo | Onde | Tipo | Descrição |
|---|---|---|---|
idobrigatório | caminho | string | Webhook ID |
limitopcional | consulta | string |
Respostas
200Deliveries list returned404Webhook not found
Exemplos
curl -X GET "https://api.cognizy.ai/api/v1/public/webhooks/<id>/deliveries" \
-H "Authorization: Bearer $COGNIZY_API_KEY"Replay a webhook delivery
post/v1/public/webhooks/deliveries/{deliveryId}/replay
Aceita Idempotency-Key
Re-sends the payload of a previous delivery to the webhook URL.
Parâmetros
deliveryIdstringobrigatório· caminho- Webhook delivery ID
| Campo | Onde | Tipo | Descrição |
|---|---|---|---|
deliveryIdobrigatório | caminho | string | Webhook delivery ID |
Respostas
200Delivery replayed404Delivery not found
Exemplos
curl -X POST "https://api.cognizy.ai/api/v1/public/webhooks/deliveries/<deliveryId>/replay" \
-H "Authorization: Bearer $COGNIZY_API_KEY" \
-H "Idempotency-Key: $(uuidgen)"