FERNWAY

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.

#EventIn the consoleMeans
1lead.picked_upPicked upFernway took a lead in. It is on its way to GHL.
2lead.signedSigned forEvery step of the lead is in GHL: contact, note, meeting, stage.
3lead.heldHeldGHL refused the lead for a reason waiting won't fix. The body says why; it waits for a fix and a resend.
4lead.returnedReturnedGHL didn't answer in 8 tries over 24 hours.
5lead.scoredScoredClaude scored the lead (when the account turned lead score on).
6fernway.testTestSent 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.

POST to your endpoint
{
  "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"
  }
}
Headers
Content-Type: application/json
Fernway-Event: lead.signed
Fernway-Delivery: evt_3fJ9kQ0vLr2mXp7aZt1cWn8e
Fernway-Signature: t=1794491791,v1=5b0c1e…
User-Agent: Fernway-Webhooks/1

Checking 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
// 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
// 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:

#TryAfter the one before
1Try 230 s
2Try 32 min
3Try 410 min
4Try 530 min
5Try 62 h
6Try 76 h
7Try 815 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.