Handle Twilio answering machine detection
curl --request POST \
--url https://your-instance.example.com/api/webhook/calls/twilio/amd \
--header 'Content-Type: application/json' \
--data '
{
"CallSid": "CA5f7b1c2e8a1d4e0012c3b4a5",
"AnsweredBy": "machine_start",
"MachineDetectionDuration": "2400"
}
'import requests
url = "https://your-instance.example.com/api/webhook/calls/twilio/amd"
payload = {
"CallSid": "CA5f7b1c2e8a1d4e0012c3b4a5",
"AnsweredBy": "machine_start",
"MachineDetectionDuration": "2400"
}
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',
AnsweredBy: 'machine_start',
MachineDetectionDuration: '2400'
})
};
fetch('https://your-instance.example.com/api/webhook/calls/twilio/amd', 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/amd",
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',
'AnsweredBy' => 'machine_start',
'MachineDetectionDuration' => '2400'
]),
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/amd"
payload := strings.NewReader("{\n \"CallSid\": \"CA5f7b1c2e8a1d4e0012c3b4a5\",\n \"AnsweredBy\": \"machine_start\",\n \"MachineDetectionDuration\": \"2400\"\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/amd")
.header("Content-Type", "application/json")
.body("{\n \"CallSid\": \"CA5f7b1c2e8a1d4e0012c3b4a5\",\n \"AnsweredBy\": \"machine_start\",\n \"MachineDetectionDuration\": \"2400\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-instance.example.com/api/webhook/calls/twilio/amd")
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 \"AnsweredBy\": \"machine_start\",\n \"MachineDetectionDuration\": \"2400\"\n}"
response = http.request(request)
puts response.read_body"OK"{
"error": "Webhook processing failed"
}Webhooks
Handle Twilio answering machine detection
AMD callback posted by Twilio with the AnsweredBy classification (human, machine_start, machine_end_beep, machine_end_silence, fax, unknown). Stamps the result on the Call record and may trigger a voicemail-drop or missed-call follow-up depending on automation settings.
POST
/
api
/
webhook
/
calls
/
twilio
/
amd
Handle Twilio answering machine detection
curl --request POST \
--url https://your-instance.example.com/api/webhook/calls/twilio/amd \
--header 'Content-Type: application/json' \
--data '
{
"CallSid": "CA5f7b1c2e8a1d4e0012c3b4a5",
"AnsweredBy": "machine_start",
"MachineDetectionDuration": "2400"
}
'import requests
url = "https://your-instance.example.com/api/webhook/calls/twilio/amd"
payload = {
"CallSid": "CA5f7b1c2e8a1d4e0012c3b4a5",
"AnsweredBy": "machine_start",
"MachineDetectionDuration": "2400"
}
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',
AnsweredBy: 'machine_start',
MachineDetectionDuration: '2400'
})
};
fetch('https://your-instance.example.com/api/webhook/calls/twilio/amd', 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/amd",
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',
'AnsweredBy' => 'machine_start',
'MachineDetectionDuration' => '2400'
]),
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/amd"
payload := strings.NewReader("{\n \"CallSid\": \"CA5f7b1c2e8a1d4e0012c3b4a5\",\n \"AnsweredBy\": \"machine_start\",\n \"MachineDetectionDuration\": \"2400\"\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/amd")
.header("Content-Type", "application/json")
.body("{\n \"CallSid\": \"CA5f7b1c2e8a1d4e0012c3b4a5\",\n \"AnsweredBy\": \"machine_start\",\n \"MachineDetectionDuration\": \"2400\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-instance.example.com/api/webhook/calls/twilio/amd")
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 \"AnsweredBy\": \"machine_start\",\n \"MachineDetectionDuration\": \"2400\"\n}"
response = http.request(request)
puts response.read_body"OK"{
"error": "Webhook processing failed"
}Body
application/json
Response
Plain-text acknowledgement (Twilio only checks 2xx).
The response is of type string.
Example:
"OK"
⌘I