View Categories

Inbound Webhooks

An inbound webhook lets another system tell RackHelm about a service it has created itself. A licence server that issues a reseller’s licence, for example, posts a signed event to the webhook’s URL, and RackHelm records the order for that service, for the right customer and product, and bills it from the next due date the event gives. The same webhook can later cancel, suspend or terminate the service when the other system says so, and report back to it. This article explains how webhooks work, how to create one and how the sending system must call it. It is for operators and for the developers of the sending system.

The setup is spread over four articles:

Before you start #

Note: Webhooks have two permissions of their own, in the Integrations & Servers group of the role editor. View Webhooks (view_webhooks) opens the list, each webhook’s settings, its event log and the dry run, but changes nothing. Manage Webhooks (manage_webhooks) adds creating, changing and deleting webhooks, the signing secret, and Approve, Re-process, Dismiss and Resend on the Events tab. No role is given either permission, on a new installation or an upgraded one, so only Super Admin can open webhooks until you grant them under Users & Roles → Roles & Permissions. See the Permission Reference.

Warning: Grant both permissions with care. A webhook turns a signed event into an order and an invoice for any customer it maps, its pages show the event payloads, and the Customers tab lists customers’ names and email addresses.

How an event becomes an order #

  1. The sender posts the event. RackHelm checks the signature and the timestamp, records the event and answers at once.
  2. The checks run. The event’s values are read from the paths set on the Mapping tab. The customer ID must be mapped to a portal customer on the Customers tab, the product must be ticked on the Products tab, the event must match the conditions for creating an order, and the due date must be acceptable. An event that fails a check makes nothing.
  3. The webhook’s mode decides what happens next. In Capture only the event is logged and nothing is created. In Hold for approval it waits on the Events tab until someone presses Approve. In Automatic the order is created straight away.
  4. The order is created for the mapped customer at the catalogue price of the product’s cycle, with a £0.00 activation invoice, marked paid, that records the start. Nothing is charged until the next due date, when the service renews like any other.
  5. The service comes to exist by the route set for the product: it already exists at the sender, the portal provisions it now or on the next provisioning run, or it waits on Pending Provisioning for staff.

An event with the same event ID, or for a remote service the webhook has already ordered, never makes a second order.

The webhook list #

Expand Integrations in the admin sidebar and click Webhooks, or go to /admin/webhooks. Each row shows whether the webhook is Receiving or Off, its name and how many customers it maps, its receiving URL with a copy button, its mode (Capture only, Hold for approval or Automatic), how many products are ticked, and when the last event arrived with that event’s outcome.

The Inbound Webhooks index listing configured webhooks with receiving status, URL copy button and mode
The inbound webhooks list at Integrations → Webhooks.

Creating a webhook #

  1. Press New webhook.
  2. Enter a Name, for example “Licence server”. It is shown in the list, in staff alerts and in the notes of the orders the webhook creates.
  3. Press Create.

The webhook opens on its Setup tab, switched off and in Capture only mode. A green box shows the signing secret.

Warning: Copy the signing secret into the sending system straight away. It is stored encrypted and is never shown again. If it is lost, tick Generate a new signing secret when I save on the Setup tab and save: the old secret stops working at once, so update the sender at the same time.

A sensible order of work: set up the Setup tab, switch Receive webhooks on while the mode is still Capture only, let the sender post a few real events, map them using Use the last event received on the Mapping tab, try them with the dry run, and only then move to Hold for approval or Automatic.

The Setup tab #

The edit page has seven tabs: Setup, Mapping, Actions, Customers, Products, Add-ons & options and Events. Each tab saves on its own; saving one never changes another.

The webhook Setup tab showing Receive webhooks toggle, mode selector, Webhook URL, signature and timestamp headers and callbacks card
The Setup tab holds the webhook URL, signature headers, clock tolerance and callback settings.
Setting What it does
Name Up to 120 characters. Shown in the list, in staff alerts and in the notes of the orders the webhook creates.
Receive webhooks While off, the URL answers 404 and nothing is recorded. Actions already scheduled are not carried out: the next run hands them to staff.
What to do with an event Capture only: log every event and create nothing. Hold for approval: run every check, then wait for someone to press Approve on the Events tab. Automatic: create the order as soon as an event passes every check.
Status of a new order Active (the usual choice) or Pending. See Mapping Events to Orders for what Pending changes.
Webhook URL Read only, with a Copy button. POST only, exactly this address, with no trailing slash.
Signature header and Timestamp header The request headers the sender puts the signature and the timestamp in. They start as X-Webhook-Signature and X-Webhook-Timestamp; change them to match a sender that uses other names.
Clock tolerance (seconds) How far the sender’s timestamp may be from the portal’s clock, from 30 to 3600. It starts at 300.
Generate a new signing secret when I save Replaces the secret. The new one is shown once, after the save.
Callbacks to the sender Where and how the portal reports back. See Events, Callbacks and Status.

RackHelm refuses to switch a webhook to Hold for approval or Automatic until it can actually make an order:

  • the Customer ID, Product and Remote service ID paths are mapped;
  • the Next due date path is mapped, or a default is chosen for events without one;
  • there is at least one condition for creating the order;
  • the Domain name path is mapped if a ticked product needs a domain.

How the sender calls it #

This section is for whoever builds the sending system.

The request #

  • Method and address: POST to the webhook URL, which has the form https://<your portal>/webhooks/inbound/<token>. All routes under /webhooks/inbound/* are exempt from browser CSRF token verification (PreventRequestForgery in Laravel 13) and authenticated solely by the HMAC signature and timestamp headers below.
  • Body: one JSON object, at most 512 KB, sent with Content-Type: application/json. Encode the event once and send exactly those bytes.
  • Timestamp: the current Unix time in seconds, in the timestamp header (X-Webhook-Timestamp unless you changed it).
  • Signature: the lower-case hex of HMAC-SHA256(secret, timestamp + "." + body), in the signature header (X-Webhook-Signature unless you changed it). The bare hex is accepted, and so are sha256=<hex> and v1=<hex>. Several signatures separated by commas or spaces are accepted too, which lets a sender sign with an old and a new secret while it changes over.
  • Event ID: give every event a unique ID and map its path on the Mapping tab. The same ID twice never makes two orders. Without one, RackHelm uses a hash of the body instead.

A request whose timestamp is further from the portal’s clock than the Clock tolerance is refused. So is the same signed request sent a second time: to retry, sign again with a new timestamp.

For example, in a shell:

secret='the signing secret'
url='https://portal.example.com/webhooks/inbound/your-webhook-token'
body='{"id":"evt_1001","type":"license.created","data":{"customer_id":"R-42","product":"pro","license_id":"LIC-9001","next_due":"2026-12-01"}}'
ts=$(date +%s)
sig=$(printf '%s.%s' "$ts" "$body" | openssl dgst -sha256 -hmac "$secret" | sed 's/^.* //')
curl -sS -X POST "$url" 
  -H 'Content-Type: application/json' 
  -H "X-Webhook-Timestamp: $ts" 
  -H "X-Webhook-Signature: sha256=$sig" 
  --data-binary "$body"

The answer #

An event that is accepted is answered with 200 and a JSON body such as {"received": true, "event_id": "…", "status": "created", "order_id": "…"}. status is what became of the event (see Events, Callbacks and Status); reason, order_id, order_item_id and invoice_id are added when they apply, and redelivery is true when the event had been received before.

Warning: An event that is ignored or refused is still answered with 200 and "received": true: the portal received it, and its status says what happened. The sender must read status. It should also treat any answer without "received": true as a failure and retry, even when the HTTP status is 200.

Answer Meaning
200 Received. Read status for the outcome.
400 “Webhook timestamp header is required.” The timestamp header is missing.
400 “Webhook timestamp is too old or too far in the future.” The timestamp is outside the clock tolerance. Check both clocks.
400 “The body must be a JSON object.” The body is not JSON, or is a list or a single value.
401 “Invalid webhook signature.” The signature does not match. See Troubleshooting below.
404 “Unknown webhook.” The URL is wrong, the webhook was deleted, or Receive webhooks is off.
409 “This signed request has already been received.” A replay of a request already accepted. Sign it again with a new timestamp.
413 “Payload too large.” The body is over 512 KB.
503 with Retry-After Retry later. Either another request about the same service is being handled, or a store purchase the event may be about is still being provisioned ("status": "deferred").
500 “Internal error.” Retry. The event is processed again when it is sent again.

Each webhook URL accepts up to 120 requests a minute, and its status URL another 120.

Deleting a webhook #

The bin button on the list deletes a webhook and its event log, and its URL stops answering at once. A webhook that has created orders or changed services, or has an action still to run, cannot be deleted, because its event log is the record of why those orders exist. Switch it off on the Setup tab instead.

Troubleshooting #

Symptom Cause and fix
No Webhooks entry in the sidebar Your role holds neither view_webhooks nor manage_webhooks. Only Super Admin has them until they are granted.
“You can view this webhook but not change it (that needs the Manage Webhooks permission).” You hold View Webhooks only.
Every request gets 401 “Invalid webhook signature.” The sender is signing a re-encoded copy of the body rather than the exact bytes it sends, is using an old secret, or has left out the full stop between the timestamp and the body. Sign the raw body bytes; if the secret is lost, generate a new one.
Every request gets 404 Receive webhooks is off, or the URL has a trailing slash or an old token. Copy the URL from the Setup tab again.
Events arrive but nothing is ever created The webhook is in Capture only, or in Hold for approval waiting for Approve. Check the Events tab.
“Map the … path before switching to Hold or Automatic.” A required path is not mapped yet. Map it on the Mapping tab and save, then change the mode.
“Add at least one condition … before switching to Hold or Automatic.” There is no condition for creating the order. Add one on the Mapping tab, usually on the event type.
The delete button is greyed out The webhook has created orders or changed services. Switch it off instead.