Live browser-to-Telegram voice hand-off: a Realtime AI agent answers by voice, and pings this bot the moment a question needs a human.
Role
Stack
The voice-call feature on this very site: a WebRTC call to an OpenAI Realtime agent grounded in the same context as the text chat, running right in the browser. When the agent can't answer from that context, it calls a single function tool that saves the question and — through this Telegram bot — notifies me in real time, along with the caller's email so I know exactly who to follow up with. Every call start also fires a Telegram notice, so nothing slips by unnoticed.
Approach
- Cloudflare Turnstile + per-IP rate limit gate an ephemeral OpenAI Realtime client_secret mint — the real API key never reaches the browser
- WebRTC handshake straight from the client to OpenAI Realtime using that ephemeral key
- Same system-prompt context builder as the text chat widget, wrapped with voice-specific rules (short, no markdown, greet first)
- One function tool (save_question_for_serhii) — its result is relayed to this Telegram bot, no database involved
- Hard 2-minute call cap with a wrap-up notice and full teardown, independent of what the agent is doing
Verification note
Live in production on this site — real WebRTC calls, real Telegram notifications on call start and on unanswered questions. No call-volume numbers are claimed.