Skip to main content

Webhook Configuration

Webhooks allow Exotel to notify your application about events in real time. When a call completes, an SMS is delivered, or a campaign finishes, Exotel sends an HTTP POST request to your configured URL with event data.

tip

For the complete webhook payload reference for all event types, see Webhooks & Callbacks.

How Webhooks Work​

1. Event occurs (call completes, SMS delivered, etc.)
2. Exotel sends HTTP POST to your configured URL
3. Your server processes the data
4. Your server responds with HTTP 200 to acknowledge
5. If no 200 response, Exotel retries (up to 2 times)

Configuring Webhook URLs​

Per-Call Webhooks (StatusCallback)​

Set a webhook URL when making an API call. The URL receives a callback when the call status changes:

curl -X POST \
https://api.exotel.com/v1/Accounts/{account_sid}/Calls/connect.json \
-u {api_key}:{api_token} \
-d "From=+919876543210" \
-d "To=+919876543211" \
-d "CallerId=+914412345678" \
-d "StatusCallback=https://your-server.com/exotel/callback" \
-d "StatusCallbackEvents[]=terminal"

Account-Level Webhooks​

Configure a default webhook URL for all events on your account:

  1. Log in to my.exotel.com
  2. Navigate to Settings > Webhooks
  3. Enter your webhook URL for each event type:
Event TypeDescriptionURL Field
Voice StatusCallbackCalled when a voice call status changesVoice Callback URL
SMS StatusCallbackCalled when an SMS delivery status changesSMS Callback URL
HeartbeatPeriodic health check for your endpointsHeartbeat URL
  1. Click Save
info

Per-call webhook URLs (set in the API request) override account-level defaults. This lets you route different calls to different endpoints.

Webhook URL Requirements​

RequirementDetails
ProtocolHTTPS required (TLS 1.2 or higher)
Response timeMust respond within 15 seconds
Response codeMust return HTTP 200 to acknowledge receipt
AvailabilityMust be publicly accessible from Exotel servers
Content handlingMust accept application/x-www-form-urlencoded POST body
warning

If your endpoint does not respond with HTTP 200 within 15 seconds, Exotel considers the delivery failed and initiates retries.

Retry Logic​

When a webhook delivery fails, Exotel retries with the following schedule:

AttemptTimingBehavior
First attemptImmediateSends the webhook as soon as the event occurs
First retry5 minutes after failureResends the same payload
Second retry15 minutes after first retryFinal attempt with the same payload

What Counts as Failure​

ScenarioTreated As
HTTP 200 responseSuccess (no retry)
HTTP 2xx (other than 200)Success (no retry)
HTTP 3xx (redirect)Failure (retry triggered)
HTTP 4xx (client error)Failure (retry triggered)
HTTP 5xx (server error)Failure (retry triggered)
Connection timeoutFailure (retry triggered)
DNS resolution failureFailure (retry triggered)
SSL/TLS handshake failureFailure (retry triggered)

After All Retries Fail​

If all retry attempts fail:

  1. The webhook event is dropped -- it will not be retried further
  2. You can retrieve the event data manually using the respective API endpoint:
tip

Implement a reconciliation process that periodically polls the Exotel API to catch any events missed due to webhook failures. This ensures no data is lost.

Webhook Payload Format​

Voice Call Callback​

Exotel sends the following fields as form-encoded POST parameters:

FieldDescriptionExample
CallSidUnique call identifierabc123def456
CallFromCaller's number+919876543210
CallToDestination number+919876543211
DirectionCall directionoutbound-api
CallTypeType of callcompleted
StatusFinal call statuscompleted
StartTimeWhen the call started2024-01-15 10:30:00
EndTimeWhen the call ended2024-01-15 10:35:00
DurationCall duration in seconds300
RecordingUrlURL to the call recordinghttps://...
PriceCall cost2.50

SMS Callback​

FieldDescriptionExample
SmsSidUnique message identifiersms789xyz
ToRecipient number+919876543210
FromSender IDACMECORP
StatusDelivery statusdelivered
DateSentWhen the message was sent2024-01-15 10:30:00
ErrorCodeError code if failednull

Securing Your Webhooks​

IP Whitelisting​

Accept webhook requests only from Exotel's IP ranges. See IP Whitelisting for the list of Exotel IP addresses.

Webhook Signature Verification​

Verify that webhook requests genuinely come from Exotel:

  1. Exotel includes a signature header in each webhook request
  2. Use your API token to compute the expected signature
  3. Compare the computed signature with the header value
  4. Reject requests where signatures do not match

HTTPS Only​

Always use HTTPS for your webhook URLs. This encrypts the webhook payload in transit and prevents man-in-the-middle attacks.

Testing Webhooks​

Using a Test Endpoint​

For development and testing, use a service like ngrok to expose your local server:

  1. Start your local server on port 3000
  2. Run ngrok to create a public HTTPS URL
  3. Configure the ngrok URL as your webhook endpoint
  4. Make a test API call
  5. Observe the webhook delivery on your local server

Webhook Logs​

Check webhook delivery status in the Exotel dashboard:

  1. Navigate to Settings > Webhooks > Logs
  2. View the delivery status, response code, and response time for each webhook event
  3. Filter by date, event type, and delivery status

Troubleshooting​

IssuePossible CauseResolution
Webhook not receivedURL incorrect or unreachableVerify the URL is publicly accessible and correct
HTTP 403 responseServer rejecting Exotel's IPWhitelist Exotel's IP addresses
HTTP 500 responseServer-side error in your handlerCheck your server logs for errors
SSL errorInvalid or expired SSL certificateRenew your SSL certificate; ensure TLS 1.2+
TimeoutServer processing takes too longRespond with 200 immediately; process asynchronously
Duplicate eventsRetries after a slow responseImplement idempotency using CallSid/SmsSid as a key

Best Practice: Respond Fast, Process Later​

To avoid timeouts, separate webhook receipt from processing:

1. Receive webhook POST
2. Immediately respond HTTP 200
3. Queue the event data for async processing
4. Process the event in a background worker

This ensures Exotel receives the acknowledgement quickly, even if your business logic takes longer to execute.