Webhooks
Webhooks tell your system about changes in Lynked as they happen: Lynked sends an HTTPS POST to
your URL for every event you subscribed to.
Subscribing#
A subscription is one URL and the event types it receives. Create it with the API or by hand in the Lynked dashboard (Integrations → Public API → Webhooks); both show the same subscriptions.
POST /api/public/v1/webhooks HTTP/1.1
Authorization: Bearer lk_live_...
Content-Type: application/json
{
"url": "https://example.com/lynked/webhooks",
"event_types": ["customer.joined", "points.earned"]
}
The response holds the subscription's secret (whsec_…). It is shown only once, here and when
you rotate it; store it next to your API key. You need it to verify the signature.
- The URL must use
httpsand point to a public address. - Up to 5 subscriptions per event type.
- Each subscription has its own secret, so you can rotate one without touching the others.
What Lynked sends#
POST /lynked/webhooks HTTP/1.1
Host: example.com
Content-Type: application/json
User-Agent: Lynked-Webhooks/1
X-Lynked-Signature: t=1764244800,v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd
{
"id": "01936f4e-7b2a-7c3d-9e8f-1a2b3c4d5e6f",
"type": "customer.joined",
"created_at": "2026-11-27T12:00:00+00:00",
"data": { "...": "..." }
}
| Field | Description |
|---|---|
id | Identifier of the event. The same event sent again (a retry or a manual re-send) keeps its id. |
type | The event type. |
created_at | When the event happened. |
data | The event's object; its shape is on the event's page in the API Reference. |
Verifying the signature#
Every request carries the header X-Lynked-Signature:
X-Lynked-Signature: t=1764244800,v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd
| Part | Meaning |
|---|---|
t | Unix time (seconds) when Lynked signed the request. |
v1 | Hex HMAC-SHA256 of the string <t>.<raw body>, keyed with the subscription's secret. |
The signature is a shared-secret HMAC: there is no public key. Only Lynked and you know the secret, so a valid signature proves the request came from Lynked and was not changed on the way.
To check a request:
- Split the header on
,and taketandv1. - Reject the request if
tis more than 5 minutes away from your current time. This stops an old request from being replayed. - Compute
HMAC-SHA256(secret, t + "." + raw_body)as hex. Use the raw request body exactly as received, before any JSON parsing: re-encoded JSON differs byte by byte. - Compare it with
v1in constant time. If they differ, reject the request with400or401.
import crypto from 'node:crypto';
function verifyLynkedSignature(rawBody, header, secret) {
const parts = Object.fromEntries(header.split(',').map(part => part.split('=')));
const timestamp = Number(parts.t);
if (!timestamp || Math.abs(Date.now() / 1000 - timestamp) > 300) {
return false;
}
const expected = crypto.createHmac('sha256', secret).update(`${timestamp}.${rawBody}`).digest('hex');
const received = Buffer.from(parts.v1 ?? '', 'hex');
return received.length === expected.length / 2
&& crypto.timingSafeEqual(Buffer.from(expected, 'hex'), received);
}
function verifyLynkedSignature(string $rawBody, string $header, string $secret): bool
{
parse_str(str_replace(',', '&', $header), $parts);
$timestamp = (int) ($parts['t'] ?? 0);
if (abs(time() - $timestamp) > 300) {
return false;
}
$expected = hash_hmac('sha256', $timestamp . '.' . $rawBody, $secret);
return hash_equals($expected, (string) ($parts['v1'] ?? ''));
}
// $rawBody = file_get_contents('php://input');
Responding and retries#
Answer with any 2xx status within 5 seconds. Do the real work after you answer, for example in
a background job. Anything else is a failure: another status, a timeout, a connection error. A
redirect (3xx) is a failure too; Lynked does not follow it.
After a failure Lynked retries the same event after 1 minute, 5 minutes, 30 minutes, 2 hours and 12 hours. After the last attempt the delivery is marked failed.
- Delivery is at least once: the same event can arrive twice. Use
idto skip events you already processed. - Events can arrive out of order. Use
created_at, or read the current state through the API. - A subscription is never turned off automatically. When deliveries keep failing, Lynked emails the subscription's notification address, at most once a day.
Testing#
Send a webhook.test event to a subscription from the dashboard to check your URL and your
signature check. Its data is { "message": "This is a test webhook from Lynked" }.
The dashboard also shows every delivery of the last 30 days, with its status, attempts and the last response, and can send a delivery again.