Case study Digital health SaaS
AI SponsorA 24/7 AI recovery-support SaaS with WhatsApp voice and ~90% lower token costs.
The backend for a 24/7 AI sponsor for 12-step recovery: Claude chat with prompt caching, Stripe subscriptions and a WhatsApp voice pipeline.
- Client
- AI Sponsor
- Sector
- Digital health SaaS
- Engagement
- Backend build for a subscription SaaS
- Our role
- Backend architecture and AI engineering
- Status
- Production backend
Interface recreation · client data anonymized
- lower input-token cost
- ~90%
- lower input-token cost
- text and voice support
- 24/7
- text and voice support
- automated test categories
- 12
- automated test categories
(01) The challenge
What needed solving.
AI Sponsor gives people in 12-step recovery programs a supportive sponsor they can reach at any hour. The product needed a production backend: empathetic, safe AI conversations, subscription billing, and a way to talk through hard moments by voice instead of typing.
The long system prompt that defines the sponsor's personality, safety guardrails and crisis instructions was resent on every turn, so token costs would scale painfully with usage, and every hop of a voice conversation added latency.
(02) The solution
What we built.
We built the Node.js and Express backend around Claude with a cache-friendly prompt structure: stable instructions first, conversation history next and the new message last. Prompt caching cut input-token costs by about 90%, and the cache-hit rate is monitored alongside latency and spend.
Stripe handles subscriptions, trials and webhooks. Through Twilio and the WhatsApp Business API, users send voice notes that are transcribed with Whisper, answered by Claude and returned as synthesized speech. A 12-category automated test suite covers chat logic, sessions, webhooks and security boundaries.
(03) Architecture
How the system fits together.
01 · Channels
- Web chat
- WhatsApp voice notes
02 · Understand
- Whisper transcription
- Session memory
03 · Reason
- Claude, cached prompt
- Safety guardrails
04 · Respond
- Text reply
- Synthesized voice
05 · Business
- Stripe subscriptions
- Webhooks & tests
(04) Engineering decisions
The choices that made it work.
- 01
Caching as architecture
Prompt structure was designed around caching from the start, not switched on afterwards.
- 02
A full voice round trip
Voice note in, Whisper transcription, Claude reply, synthesized voice out, all within a conversational latency budget.
- 03
Isolated test categories
Chat, sessions, webhooks and security are tested separately, so a regression can't hide behind the audio.
(05) Results
What the client got.
- About 90% reduction in input-token costs through prompt caching
- Round-the-clock text and WhatsApp voice conversations
- Stripe subscriptions with trials and webhooks
- 12-category automated test suite passing across chat, sessions, webhooks and security
Technology
- Node.js
- Express
- Claude (Anthropic)
- Stripe
- Twilio
- WhatsApp Business API
- OpenAI Whisper
Services involved
Related case studies
National Political RAG Assistant
A national-scale AI assistant serving citizens and field teams from one knowledge base
- queries a day, by design
- 10,000+
- queries a day, by design
- audience-specific endpoints
- 2
- audience-specific endpoints
- routing: past vs planned programs
- Temporal
- routing: past vs planned programs
Conversational AWS Infrastructure Agent
Natural-language cloud operations on Amazon Bedrock, with confirmation before every change
- CLI commands required
- 0
- CLI commands required
- changes confirmed before execution
- 100%
- changes confirmed before execution
- enterprise model access
- Bedrock
- enterprise model access
MCP Multi-Tool Agent Platform
A governed agent platform with persistent memory and human approval before sensitive actions
- pluggable tool access
- MCP
- pluggable tool access
- sensitive calls human-approved
- 100%
- sensitive calls human-approved
- memory across restarts
- Persistent
- memory across restarts
Taking on new projects
Let’sbuild.
Want results like these? Let's talk.
Book a free 30-minute strategy call with our founder. You’ll leave with a clear view of the right architecture, timeline and next step, whether or not we work together.
- Reply within 24 hours
- NDA before you share anything confidential
- You own the code, prompts and documentation
- Hours overlap with US, UK, EU and Gulf teams