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

Customizing The Assistant

This template keeps behavior in a few small places so it is easy to tune without rewriting the app. This can involve a good amount of trial and error, tuning RealTime prompts is something you’ll want to review the OpenAI prompting guide to better understand in general. As a note, the mini model is much less consistent with function handling.

Prompt Entry Points

System prompt

Edit src/prompts.ts when you want to change:

First-turn greeting

Edit src/realtime-bridge.ts when you want to change the exact opening the model says on the first turn.

That first response.create instruction is usually the strongest lever for stabilizing the opening.

Runtime Copy

The runtime values below come from wrangler.toml or .dev.vars:

If you want different copy per environment, keep the prompt generic and override the greetings with environment values.

Structured Intake

The live tool is save_call_intake in src/prompts.ts.

If you add a field:

  1. Update the tool schema in src/prompts.ts
  2. Update the TypeScript payload in src/types.ts
  3. Update persistence in src/db.ts
  4. Update the email layout in src/email.ts if the new field should appear in the summary

Helpful OpenAI References