Quick overview
This workflow handles Twilio recording-complete webhooks, downloads the call audio, transcribes it with OpenAI Whisper, and uses Anthropic Claude to extract structured call insights. It logs every call to Google Sheets, emails urgent calls via Gmail, and returns an empty TwiML response to close the Twilio request.
How it works
- Receives a Twilio Recording Status Callback webhook when an inbound call recording is completed.
- Normalizes the webhook payload to capture the call SID, caller/recipient numbers, recording URL, duration, and a timestamp.
- Downloads the MP3 recording from Twilio using HTTP Basic Auth and sends the audio to OpenAI Whisper to generate a transcript.
- Sends the transcript and call metadata to Anthropic Claude and parses its JSON output into fields like intent, urgency, summary, sentiment, and whether a callback is needed.
- Appends the combined call metadata, transcript, and AI analysis to a Google Sheets tab for logging and reporting.
- If the call is flagged as urgent (high urgency or a complaint), sends a detailed HTML alert email via Gmail.
- Returns an empty TwiML XML response to Twilio to complete the webhook response cleanly.
Setup
- Configure Twilio call recording (TwiML Bin/Studio/Voice setup) and set the Recording Status Callback URL to this workflow’s webhook endpoint.
- Add Twilio HTTP Basic Auth credentials in n8n (Account SID as username and Auth Token as password) and attach them to the Twilio recording download request.
- Add an OpenAI API key as an HTTP Header Auth credential (Authorization: Bearer <key>) for the Whisper transcription request.
- Add an Anthropic API key as an HTTP Header Auth credential (x-api-key: <key>) for the Claude messages request.
- Connect Google Sheets credentials, replace the spreadsheet ID, and create an “Inbound Calls” sheet with columns matching the logged fields.
- Connect Gmail credentials and replace the recipient address ([email protected]) with the operator inbox for urgent-call alerts.