Tonedocs
API referenceWebhooks

Preview a webhook against a call

Says what a delivery would do for one of your calls, with the conditions and bodyTemplate you send — saved or not: whether every condition holds, and the exact JSON it would POST. Without a callId it picks the newest ended call whose data meets the conditions, else the newest ended call. Nothing is sent and nothing is stored. A live key or the dashboard only: a test key gets 403, because an endpoint receives live events too.

Requires the admin scope. A key with less gets 403 insufficient_scope.

POST
/v1/integrations/webhooks/preview
AuthorizationBearer <token>

Authorization: Bearer tone_live_… or tone_test_…. The prefix IS the environment: a test key reaches only the sandbox, and no request field bridges the two.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/integrations/webhooks/preview" \  -H "Content-Type: application/json" \  -d '{    "bodyTemplate": "{\\"order_id\\": \\"{{variables.order_number}}\\", \\"status\\": \\"cancelled\\", \\"reason\\": {{outputs.cancellation_reason}}, \\"tone_call_id\\": \\"{{call.id}}\\"}",    "callId": "b2e4c1d0-7a3f-4e1b-9c8d-2f6a5e4b3c21",    "conditions": [      {        "field": "outputs.order_confirmed",        "op": "eq",        "value": "cancelled"      }    ]  }'
{  "data": {    "body": {      "order_id": "#1042",      "reason": "ordered_by_mistake",      "status": "cancelled"    },    "callId": "9f1c2d84-4e3a-4f6c-b902-7d1e8a33c451",    "matched": true,    "miss": {      "field": "outputs.order_confirmed",      "index": 0,      "reason": "no_value"    }  }}
Was this page helpful?