feat(P1): TG/WA/FB webhooks + big homepage refresh + setup runbook - #3
Open
IMPTio wants to merge 1 commit into
Open
feat(P1): TG/WA/FB webhooks + big homepage refresh + setup runbook#3IMPTio wants to merge 1 commit into
IMPTio wants to merge 1 commit into
Conversation
Three bots + a serious homepage so Mike can test what he asked for. TG bot is fully wired with the existing TELEGRAM_BOT_TOKEN — chat with @Rambo_Marc2_bot once the webhook is set. WA + FB schemas are correct and inert until Mike provisions Meta Business numbers. Telegram (FULL — testable today) - apps/site/functions/api/tg/webhook.ts - /start [city] → city picker (12 quick-pick buttons in 3-col grid) or pre-filled CTA - /book <city> + /city <city> → CTA reply with one-tap booking URL button - plain text "Dublin" → CTA reply (any city, even unknown — passes through to find-hotel-input) - callback_query handler for button taps - secret_token verification (TG_WEBHOOK_SECRET in CF env) - Persists Intent to KV INTENTS with channel='tg' for attribution - apps/site/functions/_lib/telegram.ts — fetch-only Bot API helpers (no SDK) WhatsApp (schema-correct, awaiting Meta provisioning) - apps/site/functions/api/whatsapp/webhook.ts - GET — Meta verification challenge (hub.mode/hub.verify_token/hub.challenge) - POST — text + interactive (button_reply/list_reply) handler - Replies via cta_url interactive type — Meta's preferred CTA pattern - Persists Intent with channel='wa' - 200-acks unprovisioned to avoid Meta retry-storms Facebook Messenger (schema-correct, awaiting Page wiring) - apps/site/functions/api/fb/webhook.ts - GET — Meta verification challenge - POST — quick_reply + postback + plain text handlers - Replies via generic template (title/subtitle/buttons) — m.me-compatible - Persists Intent with channel='fb' - /fb landing CTA points to m.me/imptio (env-overrideable) Homepage refresh at / - 6-stat hero (36 channels · 5% · 90d · 8.7KB · €0 · 60s) - Live demo widget embedded inline (data-key=demo-home, dest=Dublin) - All 36 channels in 6 tiered grids with status pills (Live/P1/P2/P3/P4/P5) - 4-step "How it works" flow visualisation - Dark Goodness panel with 5 numbers (5%/€5/3%/2%/1t) - Comparison table vs Booking/Expedia - Real partner sign-up form POSTing to /api/partners/signup - Footer with GitHub + OpenAPI + agent.json deeplinks - /widget → / 301 (legacy partner inbound links) ops/SETUP.md — one-shot commands Mike runs after merge - Step 1: CF Pages "Connect to Git" UI (5 min) - Step 2: wrangler kv:namespace create × 3 + paste IDs into wrangler.toml - Step 3: 13 env vars listed + source from vercel-env-backup - Step 4: ONE curl to set Telegram webhook + paste secret into env - Step 5: WA + FB webhook URLs in Meta dev portal - Step 6: Mongo sync + uptime monitor crontab on mgmt server - Step 7: explicit test checklist for TG/WA/FB Why workflows still aren't in .github/workflows/ gh OAuth token lacks `workflow` scope. Refresh requires interactive browser. Resolution: monitor + sync crons run on mgmt server (already has direct Mongo + CF API access — same pattern as brain-tick). Workflows in ops/workflows/ are templates Mike can paste via the GitHub web UI any time. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.7 <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
Three bots + a real homepage. Telegram is fully wired with the existing token — Mike can test today by chatting with
@Rambo_Marc2_botonce the webhook is set. WhatsApp + Facebook handlers are schema-correct receivers ready for Mike's Meta-side provisioning.The homepage at
swarm.impt.io/is now a serious sales page showing every channel with status, a live embedded widget demo, the Goodness mechanic, comparison vs Booking/Expedia, and a real partner sign-up form.What Mike can test today (after merge + CF Pages connect + 1 curl)
swarm.impt.io/→ pick a city in the embedded widget → land onapp.impt.io/find-hotel-inputsetWebhookcurl inops/SETUP.mdstep 4: chat@Rambo_Marc2_bot→/start→ city buttons → tap → booking link in chatswarm.impt.io/wa→ wa.me opens prefilled "Book Dublin" → bot reply lands once Meta provisions the WA Business numberswarm.impt.io/fb→ m.me opens IMPT page → page reply lands once Mike adds the IMPT FB Page to the Messenger Platform appFiles
Telegram (full impl)
apps/site/functions/api/tg/webhook.ts—/start [city],/book <city>, plain-text city, callback queriesapps/site/functions/_lib/telegram.ts— fetch-only Bot API helperstg)secret_tokenheader verificationWhatsApp Cloud API (schema-correct, inert until Meta provisioning)
apps/site/functions/api/whatsapp/webhook.ts— GET verify + POST handlercta_urlinteractive typeFacebook Messenger (same)
apps/site/functions/api/fb/webhook.ts— GET verify + POST handlerHomepage refresh —
apps/site/public/index.html/widget → /301 to keep legacy partner inbound links workingSetup runbook —
ops/SETUP.mdExact commands for: CF Pages connect, KV bindings, env vars, Telegram webhook, WA/FB Meta dev portal, mgmt-server crontab.
Workflows status
Still in
ops/workflows/not.github/workflows/. Pushing to.github/workflows/requiresworkflowOAuth scope; refresh is interactive-only. Workaround documented inops/SETUP.md: monitor + Mongo sync run on the mgmt server cron (same pattern asbrain-tick). Workflows inops/workflows/are pasteable via the web UI any time.Stack
🤖 Generated with Claude Code