Handle Twilio voice call webhook (legacy)
curl --request POST \
--url https://your-instance.example.com/api/webhook/calls/twilio \
--header 'Content-Type: application/json' \
--data '
{
"CallSid": "CA5f7b1c2e8a1d4e0012c3b4a5",
"CallStatus": "completed",
"From": "+14165550100",
"To": "+12362320246",
"Direction": "inbound"
}
'import requests
url = "https://your-instance.example.com/api/webhook/calls/twilio"
payload = {
"CallSid": "CA5f7b1c2e8a1d4e0012c3b4a5",
"CallStatus": "completed",
"From": "+14165550100",
"To": "+12362320246",
"Direction": "inbound"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
CallSid: 'CA5f7b1c2e8a1d4e0012c3b4a5',
CallStatus: 'completed',
From: '+14165550100',
To: '+12362320246',
Direction: 'inbound'
})
};
fetch('https://your-instance.example.com/api/webhook/calls/twilio', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://your-instance.example.com/api/webhook/calls/twilio",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'CallSid' => 'CA5f7b1c2e8a1d4e0012c3b4a5',
'CallStatus' => 'completed',
'From' => '+14165550100',
'To' => '+12362320246',
'Direction' => 'inbound'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://your-instance.example.com/api/webhook/calls/twilio"
payload := strings.NewReader("{\n \"CallSid\": \"CA5f7b1c2e8a1d4e0012c3b4a5\",\n \"CallStatus\": \"completed\",\n \"From\": \"+14165550100\",\n \"To\": \"+12362320246\",\n \"Direction\": \"inbound\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://your-instance.example.com/api/webhook/calls/twilio")
.header("Content-Type", "application/json")
.body("{\n \"CallSid\": \"CA5f7b1c2e8a1d4e0012c3b4a5\",\n \"CallStatus\": \"completed\",\n \"From\": \"+14165550100\",\n \"To\": \"+12362320246\",\n \"Direction\": \"inbound\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-instance.example.com/api/webhook/calls/twilio")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"CallSid\": \"CA5f7b1c2e8a1d4e0012c3b4a5\",\n \"CallStatus\": \"completed\",\n \"From\": \"+14165550100\",\n \"To\": \"+12362320246\",\n \"Direction\": \"inbound\"\n}"
response = http.request(request)
puts response.read_body"OK"{
"error": "Webhook processing failed"
}Webhooks
Handle Twilio voice call webhook (legacy)
Legacy catch-all Twilio voice webhook retained for backwards compatibility. Acknowledges with 200 and forwards the payload to the calls service for status processing — new integrations should target the specific /api/webhook/calls/twilio/ routes instead.
POST
/
api
/
webhook
/
calls
/
twilio
Handle Twilio voice call webhook (legacy)
curl --request POST \
--url https://your-instance.example.com/api/webhook/calls/twilio \
--header 'Content-Type: application/json' \
--data '
{
"CallSid": "CA5f7b1c2e8a1d4e0012c3b4a5",
"CallStatus": "completed",
"From": "+14165550100",
"To": "+12362320246",
"Direction": "inbound"
}
'import requests
url = "https://your-instance.example.com/api/webhook/calls/twilio"
payload = {
"CallSid": "CA5f7b1c2e8a1d4e0012c3b4a5",
"CallStatus": "completed",
"From": "+14165550100",
"To": "+12362320246",
"Direction": "inbound"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
CallSid: 'CA5f7b1c2e8a1d4e0012c3b4a5',
CallStatus: 'completed',
From: '+14165550100',
To: '+12362320246',
Direction: 'inbound'
})
};
fetch('https://your-instance.example.com/api/webhook/calls/twilio', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://your-instance.example.com/api/webhook/calls/twilio",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'CallSid' => 'CA5f7b1c2e8a1d4e0012c3b4a5',
'CallStatus' => 'completed',
'From' => '+14165550100',
'To' => '+12362320246',
'Direction' => 'inbound'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://your-instance.example.com/api/webhook/calls/twilio"
payload := strings.NewReader("{\n \"CallSid\": \"CA5f7b1c2e8a1d4e0012c3b4a5\",\n \"CallStatus\": \"completed\",\n \"From\": \"+14165550100\",\n \"To\": \"+12362320246\",\n \"Direction\": \"inbound\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://your-instance.example.com/api/webhook/calls/twilio")
.header("Content-Type", "application/json")
.body("{\n \"CallSid\": \"CA5f7b1c2e8a1d4e0012c3b4a5\",\n \"CallStatus\": \"completed\",\n \"From\": \"+14165550100\",\n \"To\": \"+12362320246\",\n \"Direction\": \"inbound\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-instance.example.com/api/webhook/calls/twilio")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"CallSid\": \"CA5f7b1c2e8a1d4e0012c3b4a5\",\n \"CallStatus\": \"completed\",\n \"From\": \"+14165550100\",\n \"To\": \"+12362320246\",\n \"Direction\": \"inbound\"\n}"
response = http.request(request)
puts response.read_body"OK"{
"error": "Webhook processing failed"
}Body
application/json
Twilio-assigned call identifier (CA…).
Twilio call state, e.g. ringing, in-progress, completed, busy, no-answer, failed.
Calling party phone number in E.164.
Called party phone number in E.164.
Call direction reported by Twilio: inbound, outbound-api, outbound-dial.
Response
Plain-text acknowledgement. New integrations should use the typed inbound/outbound/status/recording/amd routes instead.
The response is of type string.
Example:
"OK"
⌘I