Create a webhook
Create a webhook to receive events on your server. In the same call, Platica stores its credentials as secrets and verifies the destination. A successful verification activates the webhook.
Example
curl https://api.platic.ai/v1/webhooks \
-H "Authorization: Bearer $PLATIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "CRM",
"url": "https://example.com/hooks/platica",
"events": ["message.created"]
}' await platic.webhooks.create({ name: "CRM", url: "https://example.com/hooks/platica", events: ["message.created"] }); If your credential covers several workspaces, add ?workspace=<id> with the workspace where it is created (list workspaces); without it the answer is 400.
Request body
{
"name": "Notifications webhook",
"url": "https://example.com/webhook",
"events": [
"conversation.created",
"conversation.status.updated",
"message.created",
"client.created",
"client.customFields.updated"
],
"active": true,
"secret": "whsec_test_example",
"headers": {
"Authorization": "Bearer sk_test_example",
"Custom-Header": "custom value"
},
"autoPause": { "mode": "time", "hours": 24 }
} Body parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
name | string | Webhook name, 1 to 100 characters | ✓ |
url | string | URL where the notifications are sent, up to 500 characters | ✓ |
events | array | Events it subscribes to, at least one. See available events | ✓ |
active | boolean | With false it is saved without verifying or activating. Default true | — |
secret | string | Secret used to sign every delivery, up to 255 characters. It is stored as a workspace secret and is not returned. It is only accepted if url is https and public | — |
headers | object | Headers included in every delivery. Up to 10; names up to 100 characters and values up to 500. The value of a header that carries a credential is stored as a secret and is not returned | — |
secrets | object | Map of slot to the id of a secret that already exists, instead of sending its value: webhook.secret for the signature, header:<name> for a header | — |
autoPause | object | When it pauses itself if your server keeps failing: { "mode": "failures", "failures": 5..1000 } or { "mode": "time", "hours": 1..168 }. Default: after 5 consecutive failed deliveries. See automatic pause | — |
You can mix conversation, message, contact, and WhatsApp Flows events in the same webhook. If you use whatsapp.flows.*, your endpoint must answer with JSON in under 700 ms. See WhatsApp Flows.
Response
201 Created. data carries the whole webhook, with the fields from get a webhook, plus activation.
{
"status": "success",
"message": "Webhook created successfully",
"data": {
"id": "webhook_abc123",
"name": "Notifications webhook",
"url": "https://example.com/webhook",
"events": [
"conversation.created",
"conversation.status.updated",
"message.created",
"client.created",
"client.customFields.updated"
],
"active": true,
"hasSecret": true,
"headers": {
"Authorization": "[REDACTED]",
"Custom-Header": "custom value"
},
"createdAt": "2026-10-28T12:05:00.000Z",
"updatedAt": "2026-10-28T12:05:03.000Z",
"creationDate": "2026-10-28T12:05:00.000Z",
"lastUpdate": "2026-10-28T12:05:03.000Z",
"lastDeliveryAt": null,
"lastDeliveryStatus": null,
"lastDeliveryCode": null,
"lastDeliveryError": null,
"autoPause": { "mode": "time", "hours": 24 },
"consecutiveFailures": 0,
"failingSince": null,
"status": "enabled",
"version": 3,
"verified": true,
"secrets": [
{
"slot": "webhook.secret",
"state": "authorized",
"secretId": "a1c3e5f7092b4d6f8a0c2e4f6b8d0a1c3e5f7092b4d6f8a0c2e4f6b8d0a1c3e5"
},
{
"slot": "header:authorization",
"state": "authorized",
"secretId": "5d0c7a1e9b3f4a6c8e2d1f0b7a9c3e5d6f8a0b2c4d6e8f1a3b5c7d9e0f2a4b6c"
}
],
"activation": { "active": true },
"workspaceId": "ws_123",
"nextStep": "Active. It delivers: conversation.created, conversation.status.updated, message.created, client.created, client.customFields.updated."
}
} Response fields
| Field | Type | Description |
|---|---|---|
active | boolean | true if the webhook already delivers |
hasSecret | boolean | true if it has a signing secret. The value is never returned |
activation.active | boolean | Result of the verification in this call |
activation.reason | object | Only if it was not activated: { code, message } with the reason |
secretsError | object | Only if the webhook was saved but a credential could not be stored or bound: { code, message } |
| All the others | — | See get a webhook |
If the destination does not pass verification
The webhook is saved anyway, inactive. The response is still 201, with message: "Webhook saved but not active — see nextStep":
{
"status": "success",
"message": "Webhook saved but not active — see nextStep",
"data": {
"id": "webhook_abc123",
"active": false,
"status": "draft",
"activation": {
"active": false,
"reason": {
"code": "VERIFICATION_FAILED",
"message": "El destino no pasó la verificación (respondió HTTP 503): tiene que estar en línea y no contestar con un error del servidor. El webhook quedó guardado e inactivo."
}
},
"nextStep": "Saved but not active: El destino no pasó la verificación (respondió HTTP 503): tiene que estar en línea y no contestar con un error del servidor. El webhook quedó guardado e inactivo. Fix the destination and run POST /v1/webhooks/webhook_abc123/test."
}
} The example omits the webhook's other fields. reason.message is in Spanish. Fix your server and use test a webhook to activate the saved webhook.
activation.reason.code | When |
|---|---|
VERIFICATION_FAILED | The destination answered with a 5xx status |
OPERATION_UNCONFIRMED | The verification could not be completed, for example because the destination did not answer in time |
SECRETS_NEED_AUTHORIZATION | A credential is not authorized for the current destination |
Errors
| Status | details.code | When |
|---|---|---|
400 | INVALID_REQUEST | The body fails validation: a field is missing, url is not a URL, an event does not exist, there are more than 10 headers, autoPause carries another field or a number out of range. details.issues carries each problem with path and message, without repeating the secret |
400 | INVALID_REQUEST | Your credential covers several workspaces and you did not send ?workspace=, or you sent one it does not cover. details.available carries the IDs you can use |
400 | INVALID_CONFIG | The name, the URL, or the events are not valid |
400 | SECRET_DESTINATION_INVALID | You sent secret and url is not https, points to localhost or a private IP, or carries a #fragment. Nothing is saved |
401 | UNAUTHENTICATED | The credential is missing or invalid |
403 | FORBIDDEN | An OAuth token without the platica:write scope, the person does not have the Integrations module (the message is Missing integrations permission), or does not have permission to configure webhooks |
409 | REQUEST_ID_CONFLICT | You repeated an Idempotency-Key with a different body. Use a new key for a new operation |
{
"code": 400,
"error": "Bad Request - The request has validation errors",
"details": {
"code": "INVALID_REQUEST",
"message": "The request has validation errors",
"issues": [
{ "path": ["url"], "message": "Must be a valid URL" },
{ "path": ["events", 0], "message": "Invalid event" }
]
}
} The general error format is in Errors.
Notes
- Keep the
secreton your server when you create it. If you lose it, rotate it or send a new one with update a webhook. - The secrets created here show up in list secrets with names like
Webhook <name> · firma. Their ids are insecrets[]. - The verification sends a
HEADrequest to your URL. A response with a status below500is enough,404or405too. - Continue with Delivery and signatures to validate every delivery.