Skip to content

feat: WhatsApp platform wiring (Step 2)#55

Open
zshanhui wants to merge 3 commits into
mainfrom
cursor/whatsapp-platform-wiring-8b02
Open

feat: WhatsApp platform wiring (Step 2)#55
zshanhui wants to merge 3 commits into
mainfrom
cursor/whatsapp-platform-wiring-8b02

Conversation

@zshanhui
Copy link
Copy Markdown
Owner

@zshanhui zshanhui commented Jun 1, 2026

Implements Step 2 — Platform wiring from the WhatsApp integration plan (Step 1 discoverability deferred).

What's included

  • GET/POST /api/webhooks/whatsapp — Meta subscription verification and signed event ingest
  • whatsapp_message_log table — Idempotent audit log for inbound messages, delivery statuses, and other webhook events
  • Servicesconfig, signature (HMAC-SHA256), ingest (parse + persist)
  • Feature flagWHATSAPP_ENABLED + WHATSAPP_APP_SECRET required for POST; route mounts when WHATSAPP_VERIFY_TOKEN or enabled
  • .env.example — Documented WhatsApp env vars
  • Testsspecs/whatsapp/* (signature, ingest parsing, DB dedupe)

How to test locally

  1. Copy .env.example.env and set WHATSAPP_VERIFY_TOKEN, WHATSAPP_ENABLED=true, WHATSAPP_APP_SECRET
  2. pnpm run db:migrate
  3. Start server: NODE_ENV=development npx tsx ./bin/www
  4. Expose port 3000 via HTTPS tunnel; configure callback URL in Meta App Dashboard → WhatsApp → Configuration
  5. Send test payload from Meta; confirm rows in whatsapp_message_log

Not in this PR

  • Step 1 wa.me links
  • Outbound templates (Step 3)
  • Checkout opt-in (Step 4)
Open in Web Open in Cursor 

- Add whatsapp_message_log migration and model with idempotent inserts
- Mount GET/POST /api/webhooks/whatsapp with raw body for signature verify
- Add config, signature, and ingest services behind WHATSAPP_ENABLED
- Add .env.example, AGENTS.md and routes.md docs, mocha specs

Co-authored-by: zshanhui <zshanhui@users.noreply.github.com>
@gitguardian
Copy link
Copy Markdown

gitguardian Bot commented Jun 1, 2026

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
14986488 Triggered Generic Password e1ff300 .env.example View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

cursoragent and others added 2 commits June 1, 2026 15:23
- Convert webhook route, services, model, and specs from JS to TS
- Add shared types in src/shared/whatsapp.ts
- Remove duplicate .js implementations; use named export for router

Co-authored-by: zshanhui <zshanhui@users.noreply.github.com>
Co-authored-by: zshanhui <zshanhui@users.noreply.github.com>
@zshanhui zshanhui marked this pull request as ready for review June 2, 2026 04:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants