Docs · Webhooks
Hear about your leads, signed.
Add an endpoint in the console under Webhooks, pick its events, and Fernway POSTs each one to it as JSON, signed with the endpoint’s own secret. Endpoints must be https and public.
Events
Each event reaches each endpoint once per lead. The Fernway-Event header names it, and so does the body’s type.
| # | Event | In the console | Means |
|---|---|---|---|
| 1 | lead.picked_up | Picked up | Fernway took a lead in. It is on its way to GHL. |
| 2 | lead.signed | Signed for | Every step of the lead is in GHL: contact, note, meeting, stage. |
| 3 | lead.held | Held | GHL refused the lead for a reason waiting won't fix. The body says why; it waits for a fix and a resend. |
| 4 | lead.returned | Returned | GHL didn't answer in 8 tries over 24 hours. |
| 5 | lead.scored | Scored | Claude scored the lead (when the account turned lead score on). |
| 6 | fernway.test | Test | Sent by Send a test in the console. Not about a lead. |
The body
The lead as Fernway saw it when it noted the event, within seconds of it (a lead signed for in a second can already read signed in its lead.picked_up). score is null until the lead is scored; reason is GHL’s words when a lead is held; contact holds only the fields the lead came with.
{
"id": "evt_3fJ9kQ0vLr2mXp7aZt1cWn8e",
"type": "lead.signed",
"created": "2026-11-12T14:03:11.402Z",
"data": {
"waybill": "FW 26 00817",
"state": "signed",
"route": {
"key": "trial",
"label": "Trial requests"
},
"source": "form",
"receipt": "https://fernway.jeromebadour.com/track/eyJzIjo4MTd9.Qm2…",
"reason": null,
"contact": {
"firstName": "Lena",
"lastName": "Hartmann",
"email": "lena@northpine-dental.com",
"phone": "+15035550142",
"companyName": "Northpine Dental",
"message": "We want to start this week."
},
"ghl": {
"contactId": "ocwvFzhhiB7j0p9vyXK1",
"opportunityId": "1012v0E1Zo0iLqmzsfDN"
},
"score": {
"score": 5,
"summary": "A dental group owner asking to start a trial this week.",
"signals": [
"Asks to start now",
"Work email domain"
]
},
"pickedUpAt": "2026-11-12T14:03:09.811Z",
"updatedAt": "2026-11-12T14:03:11.390Z"
}
}Content-Type: application/json
Fernway-Event: lead.signed
Fernway-Delivery: evt_3fJ9kQ0vLr2mXp7aZt1cWn8e
Fernway-Signature: t=1794491791,v1=5b0c1e…
User-Agent: Fernway-Webhooks/1Checking the signature
Fernway-Signature is t=<unix seconds>,v1=<hex>, where the hex is HMAC-SHA256 of <t>.<the body as sent> with your secret. Check it against the raw body (before any JSON parsing), compare in constant time, and refuse a time more than 5 minutes away from yours, so an old call can’t be played again.
// Node 18+ with Express: read the body as it came, then check it.
import crypto from "node:crypto";
import express from "express";
const secret = process.env.FERNWAY_WEBHOOK_SECRET; // whsec_…, shown once in the console
const app = express();
app.post("/fernway", express.raw({ type: "application/json" }), (req, res) => {
const header = req.get("Fernway-Signature") ?? "";
const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")));
const body = req.body.toString("utf8");
const want = crypto.createHmac("sha256", secret).update(`${parts.t}.${body}`).digest("hex");
const fresh = Math.abs(Date.now() / 1000 - Number(parts.t)) <= 300;
const same = parts.v1?.length === want.length && crypto.timingSafeEqual(Buffer.from(parts.v1), Buffer.from(want));
if (!fresh || !same) return res.status(400).send("bad signature");
const event = JSON.parse(body); // { id, type, created, data }
// Use event.id to drop a repeat: a retry sends the same id and the same body.
res.status(200).json({ received: true }); // answer fast; do slow work after
});<?php
// PHP 8 (Laravel, WordPress or plain): read the raw body, then check it.
$secret = getenv('FERNWAY_WEBHOOK_SECRET'); // whsec_…, shown once in the console
$body = file_get_contents('php://input');
parse_str(str_replace(',', '&', $_SERVER['HTTP_FERNWAY_SIGNATURE'] ?? ''), $parts);
$want = hash_hmac('sha256', ($parts['t'] ?? '') . '.' . $body, $secret);
$fresh = abs(time() - (int) ($parts['t'] ?? 0)) <= 300;
if (!$fresh || !hash_equals($want, $parts['v1'] ?? '')) {
http_response_code(400);
exit('bad signature');
}
$event = json_decode($body, true); // ['id', 'type', 'created', 'data']
http_response_code(200);
echo json_encode(['received' => true]);Answers and retries
Answer any 2xx within 10 seconds and the delivery is done. Anything else (or no answer) is tried again on the same clock as a lead, with the same id and the same bytes, so you can drop a repeat by its id:
| # | Try | After the one before |
|---|---|---|
| 1 | Try 2 | 30 s |
| 2 | Try 3 | 2 min |
| 3 | Try 4 | 10 min |
| 4 | Try 5 | 30 min |
| 5 | Try 6 | 2 h |
| 6 | Try 7 | 6 h |
| 7 | Try 8 | 15 h |
After the last try the delivery shows as failed in the console, with what your endpoint answered, and Resend sends it again. Deliveries are kept 30 days.