feat(channels): WhatsApp concierge channel (shared number + phone routing)#3847
Closed
vibegui wants to merge 1 commit into
Closed
feat(channels): WhatsApp concierge channel (shared number + phone routing)#3847vibegui wants to merge 1 commit into
vibegui wants to merge 1 commit into
Conversation
…ting) Adds WhatsApp on top of the Teams/Discord channels feature, with a different shape: one shared decoCMS concierge number. A user verifies their phone once in their profile (Studio issues a code, the user texts it to the number); inbound messages route by phone → user → org and the org's agent answers AS that real user. - migration 110-user-phones (verified phone link, pending code, selected org); 109-channels bot_user_id made nullable (WhatsApp has no synthetic bot) - UserPhoneStorage + phone canonicalization - settings: WHATSAPP_WORKER_URL/TOKEN, WHATSAPP_INGEST_SECRET, CONCIERGE_NUMBER - whatsapp-worker client (Studio→worker /send) + global ingest route /api/whatsapp/ingest (secret auth, async): inbound-only code verification, phone→user→org resolution with default-org + in-chat pick-list, runs the agent as the real user via the generalized runChannelTurn (botUserId→userId) - profile MCP tools PHONE_LINK_START / PHONE_GET / PHONE_DELETE (basic-usage) - WhatsApp as an enable-only channel (CHANNELS_LIST setupKind "shared"; CHANNEL_CREATE skips the bot and activates immediately) - frontend: profile "Link WhatsApp" (show code + poll) and a per-platform "Add WhatsApp" enable dialog (pick agent) - unit tests: org-selection resolver + phone canonicalization Stacked on the Teams/Discord channels PR. Worker integration prompt: .context/whatsapp-worker-integration-prompt.md Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Superseded by #3850 — WhatsApp is now based off main (standalone), not stacked on the Teams/Discord channels PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds WhatsApp as a third channel, stacked on the Teams/Discord channels PR (#3749 — this PR's base is
vibegui/org-chat-integration, so the diff is WhatsApp-only). Merge #3749 first.Unlike the per-org Teams/Discord bots, WhatsApp uses one shared decoCMS concierge number. A user verifies their phone once in their profile; inbound messages route by phone → user → org and the org's agent answers as that real user.
How it works
POST /api/whatsapp/ingest(shared-secret auth, async) — verify code → resolve phone→user → pick the target org (saved default + in-chat numbered pick-list /switch) → run the agent as the real user → reply via the worker's/send.CHANNELS_LISTadvertises WhatsApp (setupKind: "shared"),CHANNEL_CREATEactivates immediately with a chosen agent. Only available whenWHATSAPP_WORKER_URL/TOKEN,WHATSAPP_INGEST_SECRET,WHATSAPP_CONCIERGE_NUMBERare set.mangabeira) stays the WABA owner and becomes a thin relay — integration prompt in.context/whatsapp-worker-integration-prompt.md.Key pieces
migration 110-user-phones;109-channels.bot_user_idmade nullableUserPhoneStorage+ phone canonicalization;whatsapp-workerclient;whatsapp-ingestrouterunChannelTurngeneralized (botUserId→userId) so the real user can answerPHONE_LINK_START / PHONE_GET / PHONE_DELETE(basic-usage)Testing
bun run check/lint/fmt:check/knipclean;build:serverok.curlthe ingest endpoint with a mock worker/send, or wire the real worker per the prompt. Runbun run --cwd=apps/mesh migratefirst.🤖 Generated with Claude Code
Summary by cubic
Adds WhatsApp as a shared-number concierge channel. Members link their phone once; inbound messages route phone → user → org, and the agent runs as the real user.
New Features
switch).runChannelTurnnow usesuserId) and replies via the WhatsApp worker/send.PHONE_LINK_START,PHONE_GET,PHONE_DELETE; “Link WhatsApp” in profile with live polling.UserPhoneStorage, phone canonicalization/masking, and unit tests for org selection and phone utils.Migration
user_phonestable;channels.bot_user_idis nullable for WhatsApp.WHATSAPP_WORKER_URL,WHATSAPP_WORKER_TOKEN,WHATSAPP_INGEST_SECRET,WHATSAPP_CONCIERGE_NUMBER.Written for commit 6dfad87. Summary will update on new commits.