Repository navigation
Closed
Labels
complexity-mediumComplexity: medium (board points 5-8)priority-p2Importanttheme-channelsTheme: Channelstype-featureNew functionality
Description
Summary
Phase 2 follow-up to WHATSAPP-001 (#299). Wire WhatsApp into the unified cross-channel access control system (#311) so WhatsApp identities can be gated by the same agent_sharing / access_requests primitives as Telegram/Slack/web.
Phase 1 shipped the schema columns (whatsapp_chat_links.verified_email, whatsapp_chat_links.verified_at) up-front — this phase is pure application-only code.
Context
Today a WhatsApp user has no way to prove email identity, so they fall through to the legacy permissive path in message_router._handle_message_inner. That's fine for Phase 1 (agents opt in via whatsapp_bindings), but it means:
require_emailpolicy has no effect on WhatsAppopen_accesspolicy has no effect on WhatsApp- The approval queue (
access_requests) never sees WhatsApp senders proactive_message_service._deliver_via_channelcannot route to a WhatsApp-verified user (currently raisesValueError: Unknown channel: whatsapp)
Phase 2 closes the gap so WhatsApp gates uniformly with Telegram + Slack + web.
Acceptance Criteria
-
WhatsAppAdapter.is_command(message)detects/login,/logout,/whoami— mirrors Telegram's pattern -
WhatsAppAdapter.handle_command(message)implements the/login <email>→ email verification code →/login <6-digit-code>flow, writingverified_emailtowhatsapp_chat_linkson success -
WhatsAppAdapter.resolve_verified_email(message)already exists (Phase 1) — verify it's exercised by the router gate -
WhatsAppAdapter.prompt_auth(message, agent_name, bot_token)sends a WhatsApp-native prompt when the agent requires a verified email - Pending-login state stored in Redis with 10-minute TTL (matches Telegram pattern)
- On successful verification: run the same access gate as
message_routerto tell the user "you can chat" OR "pending approval" — no two-step UX surprise -
proactive_message_service._deliver_via_channelgains awhatsappbranch +_deliver_whatsapp()helper -
access_requests.channelnow includes'whatsapp'as a valid value; confirm DB schema comment inarchitecture.md - Unit tests: /login with email, /login with code (valid/invalid/expired), access-gate outcomes (shared/open_access/restricted), /logout, /whoami
- Feature flow doc updated:
docs/memory/feature-flows/whatsapp-integration.md+docs/memory/feature-flows/unified-channel-access-control.md
Technical Notes
- Depends on: feat: WhatsApp channel adapter via Twilio — per-agent integration (WHATSAPP-001) #299 (Phase 1) merged; feat: Unified channel access control — verified-email identity, per-agent allow-list, access requests (web / Telegram / Slack) #311 unified access control shipped
- Reference implementation:
src/backend/adapters/telegram_adapter.py::_handle_login_command+_handle_logout_command(near-identical shape) - Proactive delivery reference:
src/backend/services/proactive_message_service.py:232-298—_deliver_telegramis the template;_deliver_whatsappneeds binding lookup by agent → chat_link lookup by verified_email → Twilio REST send - No schema changes needed (columns shipped in Phase 1 migration)
Related
- Parent: feat: WhatsApp channel adapter via Twilio — per-agent integration (WHATSAPP-001) #299 (WHATSAPP-001 Phase 1)
- Cross-cut: feat: Unified channel access control — verified-email identity, per-agent allow-list, access requests (web / Telegram / Slack) #311 (unified channel access control)
- Related flows:
docs/memory/feature-flows/unified-channel-access-control.md,docs/memory/feature-flows/whatsapp-integration.md
Metadata
Metadata
Assignees
Labels
complexity-mediumComplexity: medium (board points 5-8)priority-p2Importanttheme-channelsTheme: Channelstype-featureNew functionality
Activity
feat(whatsapp): access control integration (WHATSAPP-001 Phase 2, Abi…
feat(whatsapp): access control integration (WHATSAPP-001 Phase 2, Abi…
docs: document v0.6.0 features (avatars, workspace mode, build-info, …