Inspiration

I run Dopa, an Agentic ERP for SMBs in Latin America. 44% of small business sales are lost because nobody answers the message in time. Our AI agents already handle text conversations — but nothing closes deals like a real phone call.

When OpenAI launched Build Week with Codex + GPT-5.6, I saw the chance to build the voice layer in 4 days that normally takes weeks: a Telegram bot that triggers AI voice calls through Twilio, autonomously.

What it does

  1. You message @DopaVoiceBot on Telegram: "Call Juan at +51 979 300 062, he wants to buy Dopa"
  2. GPT-5.6 extracts the phone number and conversation context
  3. Twilio places a real PSTN call to that number
  4. An AI voice agent (Sofia) answers, presents the product, handles objections, and closes — all in Spanish
  5. The caller has a natural voice conversation, unaware they're talking to AI

How we built it

Every line of code was generated or accelerated by Codex with GPT-5.6 during OpenAI Build Week.

  • Telegram Bot — Webhook handler that receives messages and sends replies. Codex generated the Express route structure, error handling, and Telegram API integration.
  • GPT-5.6 Agent — Tool-calling pattern to decide "should I call?" vs "should I reply?". Codex designed the function schema and fallback parsing logic.
  • Twilio Voice — PSTN call initiation with <Gather input="speech"> for bidirectional conversation. Codex generated the complete TwiML loop.
  • Conversational Agent — GPT-5.6 processes caller speech in real time and responds with the right tone, context, and call-to-action. Codex crafted the system prompt for Spanish neutral LATAM voice.

Built with: Node.js, Express, TypeScript, ngrok, and the OpenAI Node SDK.

Challenges we ran into

  1. Twilio <Gather> speech timeout — The speech recognition needed tuning for Spanish. Codex suggested using speechTimeout="2" and <Say> fallbacks when no speech is detected.
  2. Telegram async flow — Telegram requires a 200 response within seconds. Codex structured the handler to respond immediately and process the call initiation asynchronously.
  3. Agent voice consistency — The AI agent needs to sound like a real salesperson: warm, brief, and Spanish-neutral. Codex iterated the system prompt through 5 versions.

What we learned

Codex + GPT-5.6 isn't just an autocomplete — it's an architecture partner. The most valuable moments weren't when it generated code, but when it suggested patterns I hadn't considered: the <Gather> approach over WebSockets for simplicity, the async Telegram handler to avoid timeouts, the tool-calling pattern for intent extraction.

What's next

This demo is a standalone version of the voice technology powering Dopa (dopa.solutions). Next steps: ConversationRelay for sub-second latency, multi-language support, and integration into Dopa's FlowBuilder for automated workflows.

Built With

Share this project:

Updates