Skip to content

Webhooks

The BSP API lets you configure a notification URL per client. When events occur on templates, the platform sends a POST to that URL with the event payload.

Get the configuration

Endpoint: GET /v1/webhook/config

Query params: client_id (optional, requires BSP_CN if it differs from the token)

curl --request GET \
  --url 'https://api.chattigo.com/v1/webhook/config?client_id=6' \
  --header 'Authorization: Bearer <token>'

Response (200):

{
  "id": 6,
  "url": "https://my-server.com/webhook/whatsapp",
  "active": true
}

Errors

CodeCase
400Invalid client_id
403client_id different from the token without BSP_CN
404No configuration exists for that client

Create or update the configuration

Endpoint: PUT /v1/webhook/config

curl --request PUT \
  --url 'https://api.chattigo.com/v1/webhook/config' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "client_id": 6,
    "url": "https://my-server.com/webhook/whatsapp"
  }'
CodeCase
200Configuration saved
400url required, or invalid client_id
403Cross-client without BSP_CN
If you do not send client_id in the PUT, the token’s client_id is used.

Event notification

When the configuration is active, the API notifies the URL with POST and Content-Type: application/json. The payload varies by event (saveCreatedEvent, saveUpdatedEvent, etc.).

Notifier behavior

  • Events are sent asynchronously — they do not block the HTTP response.
  • Notification errors are logged without failing the main request.
  • The HTTP client uses configurable timeouts and connection limits.

HTTP client configuration

KeyDefaultDescription
webhook.max_conns_per_host50Max connections per host
webhook.max_idle_conns_per_host50Max idle connections per host
webhook.idle_conn_timeout_secs10Idle connection timeout
webhook.max_idle_conns50Max total idle connections
webhook.timeout_secs60Timeout per request
Your endpoint must respond quickly and be idempotent: events can repeat and the notifier does not retry on error.