api
webhook_reliability
ai_generated
true
Twilio sends duplicate SMS because webhook endpoint returned non-2xx or timed out
ID: api/twilio-webhook-retry-duplicate-sms
85%Fix Rate
88%Confidence
3Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| any | active | — | — | — |
Root Cause
Twilio retries status callbacks up to 4 times if your endpoint doesn't return 2xx within 15 seconds. If the webhook triggers reply sending, each retry causes duplicate outbound messages.
genericWorkarounds
-
92% success Return TwiML immediately, queue reply sending asynchronously
Return empty <Response/> immediately. Process and reply via REST API from a background job.
-
90% success Implement idempotency using MessageSid from Twilio
if db.exists(message_sid=request.form['MessageSid']): return '<Response/>'
Dead Ends
Common approaches that don't work:
-
Return 200 only after sending the reply SMS
88% fail
If sending the reply takes >15s, Twilio retries. Your handler sends another reply on retry. User gets 2-4 duplicate SMS.
-
Disable retries in Twilio console
72% fail
Status callback retries cannot be fully disabled for all webhook types. Some retries are hardcoded.