Create a webhook subscription
Creates a webhook subscription to receive event notifications and sends a webhook.ping to the URL. The secret that signs the deliveries appears only in this response: keep it to verify each delivery's signature. Send events: ["*"] to receive every event, those added later included. A test subscription receives test conversations' events only and a live one live conversations' only; the environment cannot be changed later. An API key creates subscriptions in its own environment only.
Authorization
apiKey API key (prefix spk_test_ or spk_live_) or personal access token (prefix pat_)
In: header
Header Parameters
Idempotency key that prevents processing a request twice. Use a unique UUID v4 per request.
length <= 255Request Body
application/json
Whose events the subscription receives: test conversations' or live conversations'. It cannot be changed later. With an API key it is the key's environment: leave it out, or name that one, as naming the other is refused
Value in
- "test"
- "live"
Events the subscription receives, or ["*"] for every event, those added later included; * is never listed beside a name. webhook.ping is always sent and cannot be subscribed to
Free-form data kept with the subscription
HTTP or HTTPS URL that receives the events
Response Body
application/json
application/json
curl -X POST "https://example.com/webhooks" \ -H "Idempotency-Key: string" \ -H "Content-Type: application/json" \ -d '{ "environment": "test", "url": "string" }'{ "secret": "string", "webhook": { "conversation_id": "string", "created_at": "2019-08-24T14:15:22Z", "created_by": "string", "environment": "test", "events": [ "*" ], "failing_since": "2019-08-24T14:15:22Z", "id": "whs_abc123", "is_active": true, "metadata": { "property1": null, "property2": null }, "organization_id": "string", "paused_at": "2019-08-24T14:15:22Z", "tenant_id": "string", "updated_at": "2019-08-24T14:15:22Z", "url": "string" }}