Summary
Trust starts at the signed webhook. We create the minimal Hono app, register whatsapp.message.received in Kapso, and prove a real phone message reaches the app and gets a reply.
Steps
- Create the minimal module-level Hono application.
- Verify the raw body with
X-Webhook-Signaturebefore parsing it. - Parse unbuffered and buffered Kapso v2 payloads.
- Ignore non-text, outbound, business-app, history-sync, and wrong-number events.
- Derive the customer phone from the signed event and send a fixed reply.
// Verify first, parse second. Never trust identity from the body alone.
const ok = verifyWebhook(rawBody, signature, WEBHOOK_SECRET);
if (!ok) return c.json({ error: "bad signature" }, 401);
Proof
Send a real WhatsApp message from your phone and watch it arrive in the app logs with a reply.
Principle
The transport is trusted, but each request still arrives without memory. Next: durable conversation state.