Multi‑channel messaging for small businesses, in one Cloudflare Worker.
Concierge connects WhatsApp, Instagram, catch‑all email, and a unified Discord inbox. AI or static auto‑replies, glob‑pattern routing rules, and prepaid credit billing. Self‑host on Cloudflare or use the hosted service.
Concierge is one Cloudflare Worker, deployed once, that absorbs every customer message you receive and decides what to do with it, instantly. Below is the shortest path through the docs depending on where you’re starting.
The unified pipeline, channel by channel. Read this before touching wrangler.toml.
Channels, AI pipeline, persona safety queue, reply buffer DO, storage layout, auth.
From git clone to your first auto‑reply. Cloudflare resources, secrets, Access policies.
Every wrangler secret key, env var, binding, redirect URI, and webhook URL. Bookmark this.
concierge.calculon.tech runs this exact stack as a managed service. Sign up, connect your channels, and start auto‑replying in minutes. prepaid credit packs · email subdomains.
Features at a glance
WhatsApp auto‑reply |
Rule‑routed canned or AI reply on every incoming WhatsApp message. Embedded Signup wires phone numbers to your shared WABA in one click. |
Instagram DM auto‑reply |
Per‑account OAuth via Facebook Login. Page tokens encrypted in KV, rotated daily by the cron. |
Reply rules |
Per‑channel ordered list. Keyword matchers (case‑insensitive substring) and embedding matchers (BGE cosine similarity) route to canned text or an AI prompt. Mandatory default rule. |
Persona builder |
Tenant‑wide AI persona via guided builder (voice archetype, business, goal, catch‑phrases, off‑topics, handoff conditions), a curated archetype copied from the platform’s D1 catalog, or raw prompt. Every change runs through an async safety classifier before AI replies resume. |
Prompt envelope |
Every AI reply is sandwiched by a fixed preamble + postamble (in src/prompt.rs) that establishes the operating manual, jailbreak rails, and the universal handoff sentinel. Tenant content sits in the editable middle. |
Conversation sessions |
Per‑customer threads carry a stable conversation_id, recent message history, and any active handoff state. A tenant‑tunable idle gap (default 6 h) starts a fresh conversation; a tenant‑tunable history cap (default 20 turns) bounds the multi‑turn context fed to the AI. |
Human handoff |
The model can emit [[HANDOFF]] when triggers in the postamble or persona conditions fire (confusion, customer asks for a person, medical / legal / financial / safety territory). The pipeline strips the token, switches to a holding‑pattern voice for the cooldown (default 60 min), then goes silent. Tenant is paged once via the configured approval channels. |
Live demo chat |
Public welcome page hosts an interactive chat where visitors roleplay as a customer of a sample business. Persona picker pulls from the safety‑approved D1 archetype catalog; a "View prompt" panel reveals the exact envelope sent to the model. Real customer messages never arrive here. |
Email routing |
Catch‑all on cncg.email subdomains. Rules match on from, to, subject, body, has_attachment. Last‑match‑wins by priority. |
Discord relay |
Unified inbox in Discord. Messages from any channel arrive as embeds with Reply Approve Drop. |
Slash commands |
/status, /domains, /rules for managing your tenant from Discord. |
Onboarding wizard |
5‑step guided setup at /dashboard/wizard for new tenants. |
Localization |
Per‑tenant BCP‑47 locale (en-IN, en-US) drives Indian‑vs‑Western number grouping via icu4x; fluent‑rs FTL files for drop‑in new languages. |
Management panel |
Operator dashboard at /manage/* behind Cloudflare Access. Tenant CRUD, billing, audit logs. |
Billing |
Prepaid reply credits via Razorpay. Optimistic deduction, restored on failure. |
A look at the app
Live captures of the public site, regenerated from the running Worker by npm run screenshots. Each page is captured at desktop (1280×800) and mobile (375×812) widths so layout regressions show up against a baseline. The same script also runs a layout sanity check (page overflow + nav clipping) and exits non‑zero on a fail, so re‑running it serves as a smoke test for the marketing surface.
Desktop
Mobile
Architecture model
Concierge runs as a single Worker. State lives in Cloudflare primitives: D1 for append‑only message metadata and billing, KV for tenant config and conversation context, Workers AI for reply generation and BGE embeddings, and Queues for the persona safety classifier. Inbound email is routed through Cloudflare Email Routing’s send_to_worker action; outbound email uses the EMAIL binding.
Tokens are encrypted at rest with AES‑256‑GCM using a single ENCRYPTION_KEY. Message content is never persisted: only metadata (channel, direction, sender, recipient, timestamp). The reverse‑alias system for email replies stores enough information in KV to route a reply back to the original sender, then expires.
Inbound message bodies pass through the Worker but are never written to D1 or KV. AI replies are generated synchronously and discarded after send. Only metadata (channel, direction, sender, recipient, timestamp) lands in D1. A /data-deletion endpoint wipes that metadata; account-wide deletion is on the admin Settings page.
Getting started
Self‑host: deploy the Worker, then walk the deployment guide. You’ll need a Cloudflare account (Workers, D1, KV, Queues, Email Routing), a Meta Developer app, and a Discord application. Razorpay is optional.
# 1. clone
git clone https://github.com/ananthb/concierge
cd concierge
# 2. provision Cloudflare resources
wrangler d1 create concierge
wrangler kv namespace create KV
wrangler queues create concierge-safety
wrangler queues create concierge-safety-dlq
# 3. apply migrations · D1 schema
wrangler d1 migrations apply concierge --remote
# 4. deploy · webhooks, Access, Discord wired in the deployment guide
wrangler deploy
Hosted: sign in at concierge.calculon.tech, run the onboarding wizard, and you’re live on a shared cncg.email address. The hosted service runs the same code as this repo: the difference is that we own the WABA, the Discord app, and the email domain.
Built with
- Cloudflare Workers: Rust compiled to WebAssembly via
worker-rs. - Cloudflare D1, KV, Workers AI, Queues, Email Routing: the entire data plane.
- Meta Graph API: WhatsApp Business, Instagram, Facebook Login.
- Discord Interactions API: slash commands, button callbacks, modal submissions.
- icu4x + fluent‑rs: number/currency formatting and translation message bundles.
- Razorpay: payment gateway for paid credit packs and email subdomain subscriptions.