Skip to main content
Admin Modules

Twilio Dashboard

SMS sending, voice calls, message history, call logs, and phone number management via Twilio REST API

February 27, 2026

Twilio Dashboard

The Twilio Dashboard at /admin/twilio manages SMS messaging and voice calls via the Twilio REST API. It provides five tabs: Messages, Send SMS, Make Call, Calls, and Numbers.

Architecture

Admin UI → /api/admin/twilio-manage → Twilio REST API
                                       ├── /Messages.json (SMS)
                                       ├── /Calls.json (voice)
                                       ├── /Balance.json (account)
                                       └── /IncomingPhoneNumbers.json

All requests go through a single API route (/api/admin/twilio-manage) which authenticates with Twilio using Basic auth (SID:Token). The route handles both GET (health check) and POST (action-based dispatch).

Page Layout

Stats Row

Four stat cards:

  • Balance — Twilio account balance in USD
  • Messages — total SMS message count
  • Calls — total call count
  • Numbers — purchased phone numbers

Messages Tab

Table of recent SMS messages showing To, From, Body (truncated to 60 chars), Status, and Date. Status badges are color-coded: green for delivered/completed, blue for sent/queued, red for failed/busy, yellow for undelivered/no-answer.

Send SMS Tab

Form card with:

  • To — phone number in E.164 format (+15551234567)
  • Message — text body with live character counter (max 1600)
  • Send button with spinner feedback
  • Success shows the message SID; message list auto-refreshes

Make Call Tab

Form card with:

  • To — phone number in E.164 format
  • Message — text that Twilio will speak to the recipient via TwiML <Say>
  • Voice — dropdown of Amazon Polly voices:
    • Matthew (Male, US) — default
    • Joanna (Female, US)
    • Amy (Female, UK)
    • Brian (Male, UK)
  • Call button with spinner feedback
  • Success shows the call SID; calls list auto-refreshes

The call uses inline TwiML: <Response><Say voice="Polly.Matthew">Your message here</Say></Response>. Message text is XML-escaped before embedding.

Calls Tab

Table of recent calls showing To, From, Duration (seconds), Status, Direction, and Date. Same color-coded status badges as Messages.

Numbers Tab

Card grid of purchased phone numbers showing the number (monospace), friendly name, and capabilities (Voice / SMS / MMS).

API Route

Route: /api/admin/twilio-manage

Auth: Admin-only (CF Access JWT validation)

GET

Health check — returns Twilio account connection status, friendly name, and type.

POST Actions

All POST requests take { "action": "...", ...params }:

ActionParametersReturns
get-accountnonefriendlyName, status, type, dateCreated, balance, currency
list-messagespageSize (max 100, default 50)messages[], total
send-smsto, messageBodysent, sid, status
make-callto, message, voice (optional)called, sid, status
list-callspageSize (max 100, default 50)calls[], total
list-numbersnonenumbers[]

Error Handling

  • Missing Twilio credentials → 500 with configuration error
  • Missing required params → 400 with validation error
  • Twilio API errors → 502 with error message from Twilio
  • All requests have a 10-second timeout via AbortSignal

Environment Variables

VariableRequiredDescription
TWILIO_ACCOUNT_SIDYesTwilio Account SID (AC...)
TWILIO_AUTH_TOKENYesTwilio Auth Token
TWILIO_FROM_NUMBERFor Send/CallE.164 outbound number (+1...)

Set in production via npx wrangler pages secret put. For local dev, add to .env or .dev.vars.

Voice Integration

The Make Call feature uses Amazon Polly voices through Twilio’s <Say> TwiML verb. This works immediately without any external audio hosting.

ElevenLabs voices (higher quality, more natural) require a different approach: generate audio → upload to a public URL → use Twilio’s <Play> verb. Since admin routes are behind Cloudflare Access, Twilio can’t fetch audio directly. A future enhancement would host generated audio on R2 with public access.

  • Bland AI Phone Agent (/admin/bland) — AI-powered conversational calls with Bland’s internal models
  • Vapi Voice Agent (/admin/vapi) — programmable voice AI with pluggable LLM and voice providers
  • ElevenLabs (/admin/elevenlabs) — voice library and TTS playground
  • OpenClaw voice-call tool — agent-initiated calls using the same Twilio account
  • Argonaut voice mode — browser-based voice chat (Whisper STT + ElevenLabs TTS)
admintwiliosmsvoicecallsphonettspolly