Prompt
How do I create a callback flow for missed calls with a voice API?
Latest observation
A good missed-call callback flow with a voice API usually has 4 parts:
- Detect the missed call
- Capture the caller’s number and call details
- Offer a callback via IVR, SMS, or voicemail
- Trigger an outbound callback and route it correctly
Here’s a practical pattern you can use.
1) Detect a missed call
When an incoming call arrives, your voice API should hit your webhook.
Typical outcomes:
- Answered → normal call flow
- No answer / busy / declined / timeout → treat as missed call
- Voicemail → optionally treat as missed or leave a message flow
You’ll usually inspect the call status/event from the API provider.
Example event logic:
ringingansweredcompletedno-answerbusyfailed
If the status indicates the call wasn’t connected, create a callback record in your app.
2) Store callback intent
Save the relevant details in your backend:
- caller number
- time of call
- destination number
- call status
- reason missed
- preferred callback window, if known
Example callback object:
{
"caller_phone": "+15551234567",
"called_number": "+15557654321",
"status": "no-answer",
"timestamp": "2026-10-14T12:30:00Z",
"callback_requested": true
}
3) Let the caller request a callback
You can give the caller a chance to request callback via:
- IVR menu
- voicemail prompt
- SMS after missed call
- agent dashboard/manual callback
Common IVR flow
When a call is missed or goes to voicemail:
- “Press 1 to request a callback.”
- “Press 2 to leave a voicemail.”
- “Press 3 to send us a text.”
If they press 1:
- confirm their number
- optionally ask for best time
- end the call
- enqueue outbound callback
4) Trigger the outbound callback
Your backend should call the voice API’s outbound call endpoint.
Basic flow:
- User requests callback
- Backend creates a callback job
- Worker or webhook handler places outbound call
- When answered, connect to an agent or play a message
- Mark job complete if successful
Important safeguards:
- avoid repeated retries without limit
- honor business hours
- confirm number if caller ID is blocked/unknown
- comply with consent and local telemarketing rules
Example architecture
Inbound call webhook → check status → if missed, save callback request → maybe send SMS: “Sorry we missed your call. Reply YES and we’ll call you back.” → when user confirms, queue outbound call
Callback worker → pull next callback request → place outbound call through voice API → if answered, connect to agent or play pre-recorded callback intro → if no answer, reschedule with limits
Example pseudo-flow
Incoming Call
|
+--> Answered? --> normal call handling
|
+--> No Answer / Busy / Failed
|
+--> Log missed call
+--> Offer callback via SMS/IVR
+--> If accepted:
|
+--> Create callback job
+--> Outbound call placed
+--> If answered:
+--> connect to agent
+--> or play recorded message
+--> If not answered:
+--> retry or mark failed
Example webhook logic
If your voice API posts call events to /webhooks/call-status:
@app.post("/webhooks/call-status")
def call_status():
event = request.json
status = event["call_status"]
from_number = event["from"]
to_number = event["to"]
if status in ["no-answer", "busy", "failed"]:
save_missed_call(from_number, to_number, status)
send_callback_sms(from_number)
return "", 200
Example outbound callback request
voice_api.calls.create(
to="+15551234567",
from_="+15557654321",
webhook_url="https://yourapp.com/webhooks/outbound-answer"
)
Then in your answer webhook, either:
- bridge to an available agent
- play: “Thanks for requesting a callback. Please hold.”
- ask for call routing preferences
Best practices
- Always confirm consent before calling back, especially for automated callbacks.
- Limit retries to avoid harassment and wasted spend.
- Use local time rules to avoid calling too early/late.
- Handle blocked numbers with alternate contact methods like SMS/email.
- Record callback intent so customers don’t need to repeat themselves.
- Provide fallback if callback fails, like voicemail or text.
Recommended callback UX
A simple, effective missed-call flow:
- Caller rings
- No agent available
- System sends SMS:
- “We missed your call. Reply 1 for a callback now, or 2 for later.”
- If they reply 1:
- system calls them back automatically
- If they reply 2:
- system asks preferred time and schedules it
If you want, I can also give you:
- a Twilio-specific callback flow
- a generic webhook + database design
- or sample code in Node.js, Python, or PHP