/

Guides

Webhooks

Get an HTTPS callback for every message status change, signed so you can verify it came from us.

Applies to

v2

verify-signature.js
// Placeholder: Fernway is a fictional API.
import { verifyWebhook } from "@fernway/node"
 
export async function POST(req) {
const event = verifyWebhook(
await req.text(),
req.headers.get("fernway-signature"),
process.env.FERNWAY_WEBHOOK_SECRET,
)
if (event.type === "message.delivered") {
// mark the message as delivered
}
return new Response(null, { status: 204 })
}

Create an endpoint

Add an HTTPS URL in the dashboard or with POST /v2/webhook_endpoints and pick the events you want, such as message.delivered and message.failed. Fernway sends a JSON event to that URL each time one happens.

Verify signatures

Every event carries a fernway-signature header. Verify it with your endpoint's signing secret before you trust the payload, and reject events older than five minutes to block replays.

Retries

Return any 2xx status within 10 seconds. Otherwise Fernway retries with exponential backoff for up to 24 hours. Make your handler idempotent by storing the event id.

i

Placeholder API

Fernway is a fictional product used to show how this template works. Replace these docs with your own in the CMS.

Create a free website with Framer, the website builder loved by startups, designers and agencies.