PlennoHelp

Set up and secure webhooks

Which status changes of API requests Plenno can forward to your own system, and how to check each notification securely with an HMAC signature.

For owners and admins
On this page

Purpose

When a request comes in through the Leads API and its status changes later, Plenno can automatically pass that on to your own system: a webhook. This lets your CRM, advertising or reporting system know, for example, when a request has been won or lost.

Using webhooks

No management screen. Webhooks do not currently have their own management screen in Plenno. Contact Plenno if you want to use webhooks or want to know what is possible for your integration. Never put secrets or API keys in a message.

What you need in any case:

  • your own endpoint that is reachable over HTTPS;
  • a secret for that endpoint, which you use to check the signature of every notification. Store the secret like a password, for example as an environment variable on your server.

Original lead events (legacy)

Event When
lead_status_changed The request’s stage has changed.
lead_won The request was moved to a won stage, or the linked deal was marked as won.
lead_lost The request was moved to a lost stage, or the linked deal was marked as lost.

The request’s stage and the deal are independent of each other. A lead_won or lead_lost can therefore come from the deal while the request’s stage has not changed. If both the request and the deal are closed as won, you may receive lead_won twice for the same request, each with its own event_id.

For these three original events, only requests that came in through the public Leads API produce this webhook. Requests added by hand, through Website requests or through n8n do not. A test request (created with a test key) does not produce this webhook itself, not even when you change the request’s stage; there are no test webhooks for these events. If you create a deal for a test request yourself and mark it as won or lost, that can produce a lead_won or lead_lost. See Live and test API keys.

Lifecycle events

In addition to the three original lead events, there are lifecycle events for changes to all related data in your organisation, including data added by hand:

Part Events
Customers lead.created, lead.updated, lead.stage_changed
Companies company.created, company.updated
Opportunities deal.created, deal.updated, deal.stage_changed, deal.won, deal.lost
Actions activity.created, activity.updated, activity.completed
Quotes quote.created, quote.updated, quote.status_changed
Invoices invoice.created, invoice.updated, invoice.status_changed
Work orders work_order.created, work_order.updated, work_order.status_changed

A lifecycle payload contains api_version: "2026-10-05", mode (live or test), resource (type, ID and api_url), changes (names of the changed fields) and data (permitted status fields). Names, contact details, notes and document content are not included. If you need more data, fetch it through the API, with a key that has the right permissions and the same live or test mode. Lifecycle events also have event_id, event_type and occurred_at.

An endpoint only receives the events it is subscribed to. Up to 32 event names are allowed; unknown or duplicate names are rejected. Discuss with Plenno which events your integration needs.

The original payload

{
  "event_id": "00000000-0000-4000-8000-000000000101",
  "event_type": "lead_won",
  "occurred_at": "2026-10-02T09:14:02.000Z",
  "lead_id": "00000000-0000-4000-8000-000000000001",
  "external_id": "website-lead-1001",
  "status": "won",
  "attribution": {
    "utm_source": "google",
    "utm_medium": "cpc"
  }
}
  • event_type tells you what happened. Use this field in your own logic.
  • status describes the new situation, for example the new stage or won, lost or open.
  • lead_id is the same ID you got back when you created the request through the API.
  • external_id is the reference you sent yourself when creating it (null if you did not use one).
  • attribution only contains these six keys, if you sent them in metadata at the time: utm_source, utm_medium, utm_campaign, utm_content, utm_term and gclid. The rest of your metadata is never included.

Headers and HMAC signing

Every request is a POST with Content-Type: application/json and these headers:

Header Meaning
x-plenno-webhook-signature HMAC-SHA256 over "${timestamp}.${rawBody}", as a hex string.
x-plenno-webhook-timestamp Time of sending, in milliseconds since the epoch, as a string.
x-plenno-webhook-event-id The same event_id as in the payload, useful for detecting duplicate deliveries.

The signature is HMAC-SHA256(secret, "${timestamp}.${rawBody}"), where rawBody is exactly the bytes that were sent. So calculate the signature over the raw body as received, not over a rebuilt object: the key order and whitespace may differ.

Example: receive and verify a webhook

// Node.js, Express: adapt to your own framework.
import crypto from "node:crypto";

const WEBHOOK_SECRET = process.env.PLENNO_WEBHOOK_SECRET;

app.post("/plenno/webhook", express.raw({ type: "application/json" }), (req, res) => {
  const timestamp = req.header("x-plenno-webhook-timestamp");
  const signature = req.header("x-plenno-webhook-signature");
  const rawBody = req.body; // Buffer, not yet parsed as JSON.

  if (!timestamp || !signature) return res.status(400).end();

  const expected = crypto
    .createHmac("sha256", WEBHOOK_SECRET)
    .update(`${timestamp}.${rawBody.toString("utf8")}`, "utf8")
    .digest("hex");

  const providedBuffer = Buffer.from(signature, "utf8");
  const expectedBuffer = Buffer.from(expected, "utf8");
  const isValid =
    providedBuffer.length === expectedBuffer.length &&
    crypto.timingSafeEqual(providedBuffer, expectedBuffer);

  // Recommended: reject a timestamp that is too old (for example older than 5 minutes),
  // to protect against replay of an old request.
  const ageMs = Date.now() - Number(timestamp);
  if (!isValid || Number.isNaN(ageMs) || Math.abs(ageMs) > 5 * 60_000) {
    return res.status(401).end();
  }

  const payload = JSON.parse(rawBody.toString("utf8"));
  // ... process payload.event_type, payload.lead_id, and so on.

  res.status(200).end();
});

Read the body as raw bytes (express.raw, not express.json) before you parse it: the signature is calculated over exactly those bytes.

Retries and errors

  • Plenno waits up to 8 seconds for a response.
  • Only an HTTP status code of 200–299 counts as successful.
  • If a delivery fails, Plenno tries again later with an increasing delay (5 minutes × attempt number², up to 60 minutes), up to 8 attempts in total.
  • If 20 delivery attempts in a row fail, the endpoint is paused automatically. Contact Plenno in that case.
  • Plenno never follows a redirect (3xx); that counts as a failure.
  • In exceptional cases, the same event may arrive twice. Use event_id to detect this.

Security requirements

  • The endpoint must use HTTPS.
  • Internal, private or local addresses (such as localhost, 127.0.0.1 or 192.168.x.x) are rejected.
  • Always check x-plenno-webhook-signature before you process the payload. Never process a request with a missing or invalid signature.

Limitations

  • There is no separate management screen for webhooks in Plenno yet.
  • The three original lead events and the lifecycle events have different payloads. Process them separately.
  • The original lead events have no separate test webhooks. Lifecycle events state their mode in mode; handle test data separately.

Next steps

Read Getting started with the Leads API for the overview, or Live and test API keys to try out an integration safely first.

Updated November 19, 2026 · Checked against Plenno 9.5.5

Related articles

Was this helpful?