Skip to main content

Webhooks

Webhooks allow you to receive real-time notifications about specific events happening on Liveforce platform. When an event occurs, a POST request is sent to the URL you have configured for the webhook, containing details about the event.

Webhooks are set up and managed on the webhooks configuration page in the admin web app. To access this page, navigate to Menu > Platform Settings > App settings > Webhooks. Note that this page is only accessible to admins with Owner role or ALLOW DEVELOPER ACCESS permission, and is only enabled for companies with API access (read Getting Started for more info).

Payload Format​

The payload sent to your webhook URL is a JSON object with the following structure:

interface WebhookPayload {
company_id: number;
event_id: string; // 26-character ID of event occurrence
topic: string;
timestamp: string; // ISO 8601 format, time of event (not time of delivery)
delivery_timestamp: string; // ISO 8601 format, time of request
data: { /* event data */ };
}

Error Handling & Retries​

If your webhook endpoint responds with a non-2xx status code or exceeds 10s response timeout, the webhook delivery is considered failed. In such cases, Liveforce will retry sending the webhook up to 5 times with increasing interval (1m, 2m, 3m, 4m, 5m). If all retries fail, the event will be marked as failed and no further attempts will be made.

All retries of a delivery carry the same event_id, so use it as an idempotency key. A retry only means we didn't get a 2xx response - your endpoint may have already processed the event. Note that delivery_timestamp, and therefore the signature, is different for every attempt.

Certain events may allow configuring additional actions on failure (e.g. sending email notification).

Rate Limiting​

By default, Liveforce will send out webhook requests at a rate of up to 10 requests per second.

Your server may suggest a higher limit via response headers. The recommended way to do this is to ensure your server provides a valid rate limit policy in the RateLimit-Policy header (following the IETF draft). We will follow the policy with the lowest rate limit, calculated as (request quouta) / (time window in seconds).

Besides the policy header, we also check RateLimit (from the same IETF draft), as well as commonly used X-RateLimit-Remaining and X-RateLimit-Reset. When supplied together with a valid policy, those headers help to dynamically lower sending rate if necessary. If no valid policy is provided, rate limit can be inferred from those headers alone, but only up to the value of 20 requests per second.

Rate limit suggested by your server cannot be lower than default limit of 10 requests per second.

Note that Liveforce tracks rate limits per configured webhook, not per URL or domain. If you have multiple webhooks pointing to the same URL, each webhook will be treated as an independent target, which may result in amount of request exceeding the rate limit of your server. To avoid this, it is recommended to use separate endpoints with separate rate limit pools for each webhook, or use a single webhook for all required events.

Security​

To confirm that webhook request genuinely came from Liveforce and that nothing altered it in transit, you can use the X-Signature HTTP header. This header is included for all requests with configured signing.

Liveforce signs requests with an asymmetric key pair: we hold the private key, and you verify with the matching public key. There is no shared secret to exchange or protect - the public key is not sensitive, and possessing it does not allow anyone to forge a request. Two signing methods are available, Ed25519 (EdDSA) and RSA (RS256); the signing method can be set up on the webhook configuration page.

After signing is configured, you will be able to download a public key file in the PEM format. Here is an example of a public key file payroll-sync.ed25519_eddsa.pem:

-----BEGIN PUBLIC KEY-----
MCowBQYDK2VwAyEA1amkM7au3D8fWdZwzkjHs6so9LhVniv/hTWisoMFqbw=
-----END PUBLIC KEY-----

This is the standard SubjectPublicKeyInfo (SPKI) encoding, which every mainstream crypto library reads directly - crypto.createPublicKey() in Node.js, x509.ParsePKIXPublicKey() in Go, openssl pkey -pubin on the command line, and so on.

Whichever signing method you use, the same rules apply:

  • The signature is hex encoded in the header, and is computed over the exact bytes of the request body. It must be verified before parsing the JSON, never rely on re-serializing the payload, as this can change key order and formatting, resulting in, sometimes seemingly random, signature mismatches. In Express, for instance, this means using express.raw({ type: "application/json" }) rather than express.json() on the webhook route.
  • If signature verification fails, reject the request.
  • By default, webhook security isn't configured, and requests are not signed, meaning no X-Signature header is sent. If you expect signed deliveries, missing header must be treated as a failed verification.
  • We also strongly recommend checking payload's company_id and delivery_timestamp fields to guard against replayed deliveries.

Ed25519 is the recommended choice of signature algorithm - it's modern, secure and fast to compute. A signature is always 64 bytes (128 hex characters) and a public key is 32 bytes, which keeps the header small and the key file trivial to embed in configuration.

The signature is produced over the raw request body directly - Ed25519 hashes the message internally, so there is no separate digest step.

verify-ed25519.js
import { createPublicKey, verify } from "node:crypto";
import { readFileSync } from "node:fs";

const publicKey = createPublicKey(readFileSync("payroll-sync.ed25519_eddsa.pem"));

// body is the raw request body as a Buffer, signature is the X-Signature header
export function verifyEd25519(body, signature) {
if (!signature) {
return false;
}

// algorithm must be null for Ed25519: the scheme defines its own hashing
return verify(null, body, publicKey, Buffer.from(signature, "hex"));
}

RSA (RS256)​

RS256 is offered for environments where RSA is the only practical option - some managed platforms, hardware security modules and older runtimes still lack Ed25519 support. If yours supports both, use Ed25519 instead.

The signature is RSASSA-PKCS1-v1_5 over the SHA-256 digest of the request body, using a 2048-bit RSA key, which makes it 256 bytes long (512 hex characters). Note the padding: PKCS#1 v1.5, not PSS. Examples below set the padding explicitly rather than relying on library defaults.

verify-rsa.js
import { constants, createPublicKey, verify } from "node:crypto";
import { readFileSync } from "node:fs";

const publicKey = createPublicKey(readFileSync("payroll-sync.rsa_rs256.pem"));

// body is the raw request body as a Buffer, signature is the X-Signature header
export function verifyRSA(body, signature) {
if (!signature) {
return false;
}

return verify(
"sha256",
body,
{ key: publicKey, padding: constants.RSA_PKCS1_PADDING },
Buffer.from(signature, "hex"),
);
}