AI Phone Assistant — Twilio + OpenAI Realtime + Cloudflare Workers

Template for deploying an AI voice assistant with Twilio, OpenAI Realtime API, and Cloudflare Workers

View the Project on GitHub jmoore2333/twilio-openai-voice-assistant-cloudflare-template

Neon Setup

Use this path if you want Postgres. Everybody likes Postgres, and Neon is great - but just having everything handy in Cloudflare at the edge is also nice.

The turnkey ./scripts/setup.sh flow is D1-first. For Neon, keep using the manual setup below.

1. Create a Neon database

Create a new Neon project and copy its connection string.

2. Apply the schema

Run the SQL in schema-neon.sql using the Neon SQL editor or your normal migration workflow.

3. Configure Worker secrets

Set these values for your Worker:

wrangler secret put OPENAI_API_KEY
wrangler secret put TWILIO_AUTH_TOKEN
wrangler secret put DATABASE_URL
wrangler secret put RESEND_API_KEY

RESEND_API_KEY is optional. If you skip it, email delivery will be disabled.

4. Local development

Copy .dev.vars.example to .dev.vars and set:

5. Deploy

npm run deploy

6. Run a real inbound smoke test

After deploy:

  1. Set your Twilio number to POST https://<your-domain>/voice/incoming
  2. Place one short test call
  3. Confirm the newest row in intake_calls has a populated caller_name, reason_summary, and transcript content

Notes