evOo-local/apps/api/src/messaging-webhook.ts
cynarAI 6c7eed7580 Initial clean evOo-local from f00577b
Fresh history cut from cynarAI/evoo antigravity-handoff/project-timeline
(Voice First + project timeline). Brand docs/titles as evOo; keep @rakazo/*
packages as tech debt. Excludes node_modules, caches, secrets, voice blobs.
2026-09-20 17:15:16 +02:00

27 lines
1.2 KiB
TypeScript

import type { MessagingSurface } from "@rakazo/adapter-kit";
import type { Hono } from "hono";
export const MESSAGING_WEBHOOK_BASE_PATH = "/api/v1/messaging/webhook";
/**
* Per-provider inbound webhooks. Verification (Slack HMAC, WhatsApp
* signatures + GET challenge, Telegram secret header, sendblue shared
* secret) happens inside the surface's platform adapters; replay safety
* comes from per-message client nonces downstream. Mounted only when the
* messaging surface is enabled.
*/
export function mountMessagingWebhookRoutes(app: Hono, deps: { messaging: MessagingSurface }) {
app.all(`${MESSAGING_WEBHOOK_BASE_PATH}/:provider`, async (c) => {
const response = deps.messaging.handleWebhook(c.req.param("provider"), c.req.raw);
if (!response) return c.json({ error: "Unknown provider" }, 404);
return response;
});
// The pre-multi-platform sendblue path; already-configured dashboards
// keep delivering without an update.
app.post("/api/v1/phone/webhook", async (c) => {
const response = deps.messaging.handleWebhook("sendblue", c.req.raw);
if (!response) return c.json({ error: "Unknown provider" }, 404);
return response;
});
}