Getting Started

To add a webhook endpoint, head to https://app.leexi.ai/en/settings/webhooks and click on Add

Complete the Name, URL and Description for your webhook, and Save

The webhook will only activate after we have sent your endpoint a test event and received a valid (20X) HTTP response. You may try reactivating the webhook once your endpoint is up and running.

Currently we only send a singly type of events: call.processed

Call access scope

Each webhook has a call access scope that controls which calls it receives events for. By default — and for every webhook created before this feature — a webhook receives events for all of the company's calls, so existing integrations are unaffected. An admin can instead link a webhook to a specific user (it then only receives events for calls that user can access) or restrict it through access rules. The access scope is configured from the webhook settings.

Verifying signatures

Every delivery is signed following the Standard Webhooks specification, so you can check that it comes from Leexi and was not altered. The secret is shown in the webhook's edit window once the webhook is created, but creating it already sends a test delivery, and a failed test switches the webhook off. So create the webhook, copy its secret, set up your receiver, then activate the webhook.

Each request carries three headers:

HeaderContent
webhook-idThe delivery identifier. It stays the same across retries, so you can use it to ignore a delivery you already handled.
webhook-timestampThe time of the delivery, in seconds since the Unix epoch.
webhook-signaturev1, followed by the base64-encoded HMAC-SHA256 signature.

The signing secret (whsec_...) is shown in the webhook's edit window in the webhook settings, where it can also be regenerated. Regenerating it invalidates the previous secret immediately.

The signature is computed over <webhook-id>.<webhook-timestamp>.<raw request body>, using the base64-decoded part of the secret after whsec_ as the key. The Standard Webhooks libraries do this check for you. Without a library, in Node.js:

const crypto = require('crypto');

function verifyLeexiWebhook(secret, headers, rawBody) {
  const id = headers['webhook-id'];
  const timestamp = headers['webhook-timestamp'];
  if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 5 * 60) return false;

  const key = Buffer.from(secret.replace(/^whsec_/, ''), 'base64');
  const expected = crypto.createHmac('sha256', key).update(`${id}.${timestamp}.${rawBody}`).digest();

  return headers['webhook-signature'].split(' ').some(signature => {
    const [version, value] = signature.split(',');
    const received = Buffer.from(value || '', 'base64');
    return version === 'v1' && received.length === expected.length && crypto.timingSafeEqual(received, expected);
  });
}

Always verify against the raw body as received, before parsing the JSON: re-serializing it can change the bytes and break the signature.