feat(whatsapp): WhatsApp concierge channel (shared number + phone routing)#3850
Open
vibegui wants to merge 2 commits into
Open
feat(whatsapp): WhatsApp concierge channel (shared number + phone routing)#3850vibegui wants to merge 2 commits into
vibegui wants to merge 2 commits into
Conversation
… main) Standalone WhatsApp channel, independent of Teams/Discord. One shared decoCMS concierge number serves every org: 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. Carries the minimal channel plumbing (generic `channels` table + ChannelStorage + runChannelTurn + channel runtime + the enable/list/delete tools) — no Teams/Discord adapters, webhooks, wizard, credentials, or bot identity. Those can stack on top later. - migrations: 109-channels (generic per-org channel: agent + status), 110-user-phones (verified phone link, pending code, selected org) - UserPhoneStorage + phone canonicalization; ChannelStorage - 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 runChannelTurn - profile MCP tools PHONE_LINK_START / PHONE_GET / PHONE_DELETE (basic-usage) - enable-only channel tools: CHANNELS_LIST / CHANNEL_CREATE / CHANNEL_LIST / CHANNEL_DELETE - frontend: Channels settings page (WhatsApp-only), "Add WhatsApp" enable dialog (pick agent), profile "Link WhatsApp" (show code + poll) - unit tests: org-selection resolver + phone canonicalization Worker integration prompt: .context/whatsapp-worker-integration-prompt.md Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…s own bot
The concierge worker is a self-contained presales bot, not a thin relay. The
ingest endpoint now classifies synchronously and returns { handled }: Studio
owns the message only for a verification code or a phone linked to a user with a
WhatsApp-enabled org; otherwise { handled: false } and the concierge runs its
own pipeline. The agent reply is still delivered async via the worker's send
endpoint. Drops the 'not linked' auto-reply (that path is now the concierge's).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
A standalone WhatsApp channel, based off
main— independent of the Teams/Discord work. One shared decoCMS concierge number serves every org: a user verifies their phone once in their profile, and inbound messages route by phone → user → org, with the org's agent answering as that real user.Carries only the minimal channel plumbing it needs (a generic
channelstable +ChannelStorage+runChannelTurn+ channel runtime + enable/list/delete tools). No Teams/Discord adapters, webhooks, wizard, credentials, or bot identity.How it works
decocms/conciergeworker forwards every inbound toPOST /api/whatsapp/ingest; Studio classifies synchronously and returns{ handled }. Studio owns the message only for a verification code or a linked user with a WhatsApp-enabled org — otherwise{ handled: false }and the concierge runs its own presales bot. The reply is delivered async via the worker's send endpoint.switch) → run the agent as the real user.WHATSAPP_WORKER_URL/TOKEN,WHATSAPP_INGEST_SECRET,WHATSAPP_CONCIERGE_NUMBERare set.Key pieces
109-channels(generic per-org channel: agent + status) +110-user-phonesUserPhoneStorage, phone canonicalization,whatsapp-workerclient,whatsapp-ingestroute (returns{ handled })PHONE_LINK_START / PHONE_GET / PHONE_DELETE(basic-usage)CHANNELS_LIST / CHANNEL_CREATE / CHANNEL_LIST / CHANNEL_DELETEThe worker
The integration target is
decocms/concierge(workerdecocms-concierge,api/main.ts). It stays the front-door presales bot and gains: a Studio handoff at the top ofhandleInbound(forward → ifhandled, stop), and aPOST /sendendpoint for Studio to deliver replies. Full prompt:.context/whatsapp-worker-integration-prompt.md.Testing
bun run check0 errors ·lint·knip·fmt:checkclean ·build:serverok.bun run --cwd=apps/mesh migrate, thencurlthe ingest endpoint (asserts{handled}), with a mock/send.🤖 Generated with Claude Code