1. Register an endpoint

In the dashboard, add a webhook URL for your project. Copy the signing secret (whsec_…) — it is shown once.

2. Verify and handle

import { parseWebhook, WEBHOOK_HEADERS } from "@interactions-hq/skyline/webhooks";

export async function POST(req: Request) {
  const raw = await req.text();
  const event = parseWebhook(
    raw,
    {
      signature: req.headers.get(WEBHOOK_HEADERS.signature),
      timestamp: req.headers.get(WEBHOOK_HEADERS.timestamp),
    },
    process.env.SKYLINE_WEBHOOK_SECRET!
  );
  if (!event) return new Response(null, { status: 401 });

  if (event.type === "message.received" && !event.data.fromMe) {
    console.log(event.data.from, event.data.text);
  }

  return new Response(null, { status: 200 });
}

3. Test

Send a message to your project’s line. Your endpoint should receive a message.received event within a few seconds. Return 2xx quickly. Do slow work asynchronously — see Delivery and retries.