Repository navigation
Open
1 / 21 of 2 issues completedOpen
1 / 21 of 2 issues completed
Copy link
Labels
complexity-highComplexity: high (board points 13)priority-p3Nice-to-havestatus-incubatingIdea under consideration — pre-Todo, not yet greenlit for developmenttheme-channelsTheme: Channelstype-featureNew functionality
Description
Summary
Umbrella tracking issue for WHATSAPP-001 Phase 3. Phase 1 (#299) shipped direct-message chat. Phase 2 (#467) wires access control. Phase 3 unlocks advanced Twilio capabilities: outbound-first messaging, SMS, interactive UX, voice transcription.
Each bullet below can be split into its own issue when picked up — kept together here so we can evaluate scope and sequencing as one conversation.
Context
Phase 1 operates inside Twilio's 24-hour customer-service window (an inbound message opens the window; freeform outbound is free within it). This is fine for reactive agents but blocks:
- Scheduled/proactive notifications to WhatsApp users
- Initiating conversations from the agent side
- Rich UX beyond plain text
Phase 3 addresses each with targeted Twilio primitives. No single item here is urgent — ship only if demand appears.
Acceptance Criteria (checklist of sub-features)
3a — Message templates (outbound-first / post-24h messaging)
- Twilio Content Builder integration: register + reference pre-approved templates
- Template storage:
whatsapp_templatestable (template_sid, name, category, placeholders schema, approval status) - Outbound send helper accepts
template_name+variables→ builds payload → routes via Content API - Error 63016 ("outside window") now falls back to template send if one is configured
- UI: list registered templates per agent, show approval status
- Unit tests for template payload construction
3b — SMS on same Twilio binding
- Reuse
whatsapp_bindingsrow (dropwhatsapp:prefix for SMS routes) - New
SmsAdaptersubclassingChannelAdapterOR extendWhatsAppAdapterwith amediumflag — pick whichever is cleaner after review - Router logic:
From: +E164(no prefix) vsFrom: whatsapp:+E164dispatches to appropriate adapter - Rate limiting keyed on
twilio_sms:{binding_id}:{phone} - UI: checkbox on Sharing panel "Also accept SMS to this number"
- Session identity: decide whether SMS + WhatsApp from the same phone share a session (likely yes — same
verified_email)
3c — Interactive messages (buttons, list pickers)
- Twilio Content API quick-reply buttons and list messages
- Agent response parser: detect structured markup (e.g., custom fenced block) → convert to interactive payload
- Inbound:
ButtonPayloadfield arrives asBodywith button ID — map to a deterministic agent prompt ("User selected: ") - Template approval considerations (interactive templates need separate Meta approval)
3d — Voice-note transcription
- Twilio sends
audio/ogg(WhatsApp voice notes) inMediaUrl0 - Extend
message_router.py:212voice-transcription branch to includechannel == "whatsapp"— today Telegram-only - Reuse
services/telegram_media.py::process_voiceif MIME-agnostic, else addwhatsapp_mediahelper - Download via existing SSRF-gated
WhatsAppAdapter.download_file→ Whisper API → replace placeholder in prompt - Unit tests for voice transcription path
Technical Notes
- Parent: feat: WhatsApp channel adapter via Twilio — per-agent integration (WHATSAPP-001) #299 (Phase 1)
- Depends on feat(whatsapp): access control integration (WHATSAPP-001 Phase 2, #299 follow-up) #467 (Phase 2 — access control) for proactive messaging identity resolution
- Twilio Content Builder docs: https://www.twilio.com/docs/content
- Template approval is a Meta Business process (24-72h turnaround) — UI must communicate this
- SMS on same binding is low-lift (~50 LOC) and high-leverage; pull out first if users ask for it
Related
- Parent: feat: WhatsApp channel adapter via Twilio — per-agent integration (WHATSAPP-001) #299 (WHATSAPP-001 Phase 1)
- Blocker for 3a proactive sends: feat(whatsapp): access control integration (WHATSAPP-001 Phase 2, #299 follow-up) #467 (Phase 2 access control)
- Reference:
docs/memory/feature-flows/whatsapp-integration.md(Phase 3 section)
Sub-issues
Collapse Sub-issuesSub-issues
Loading 2 sub-issues
Metadata
Metadata
Assignees
Labels
complexity-highComplexity: high (board points 13)priority-p3Nice-to-havestatus-incubatingIdea under consideration — pre-Todo, not yet greenlit for developmenttheme-channelsTheme: Channelstype-featureNew functionality
Activity