View Categories

Inbound Webhooks: Mapping Events to Orders

An inbound webhook has to read each event the way the sending system writes it: where the customer ID is, which product it is for, when the first charge falls due. This article covers the four tabs that turn an event into an order (Mapping, Customers, Products and Add-ons & options) and the dry run that shows what an event would do before it does it. Read Inbound Webhooks first.

Before you start #

Note: Changing any of these tabs needs Manage Webhooks (manage_webhooks). Staff with View Webhooks (view_webhooks) can read them, list the paths in a sample and run the dry run, but cannot save. See the Permission Reference.

It is easiest to map real events. Leave the webhook in Capture only with Receive webhooks on, ask the sender to post a few events, then work from Use the last event received.

The Mapping tab #

The webhook Mapping tab showing the sample payload helper, field path inputs, Provision conditions and Dates and emails settings
The Mapping tab turns paths inside an incoming JSON payload into RackHelm order fields and conditions.

Find paths in a payload #

Paste an example event into the box, or press Use the last event received, then press List paths. A table lists every value in the event with its path and a sample value; values that look like secrets are masked. In the Use for column, choose what a value is for, and the path is filled in below: one of the fields, a condition, a service detail to store, a condition for one of the actions, or an add-on rule. The sample itself is never saved.

Paths use dots between the levels of the event, for example data.billing.customer_id. A number picks an entry from a list, so data.items.0.code is the code of the first item. Paths cannot contain spaces, * or braces.

Where each value is #

The fields marked * are required before the webhook can leave Capture only.

Field What it is
Event ID The sender’s unique ID for the event. The same ID twice never makes two orders. Leave it blank to use a hash of the body.
Event type Shown in the event log. Use a condition to act on one type only.
Customer ID (from the sender) * The customer as the sender knows them. It is looked up on the Customers tab, and the portal customer mapped to it is billed. It does not have to be a portal ID.
Product (portal ID or code) * The portal product ID, or the sender’s own code for the product set on the Products tab, compared without regard to case. Only ticked products are accepted.
Next due date The date of the first charge: YYYY-MM-DD or an ISO 8601 date and time, after today. When the event has none, the rule under Dates and emails applies.
Remote service ID * The sender’s own ID for the service, for example the licence ID. A second event with the same ID never makes a second order, and services the portal provisioned itself through the same Custom API integration are recognised too.
Domain name Needed for cPanel, Plesk, Enhance and domain products, and ignored by the rest. Plain ASCII; an international name in its xn-- form.
Service ID (portal) Optional. The portal’s own ID for the service, if the sender keeps it. Only the actions read it.
Callback URL (this event) Optional. Sends this event’s report somewhere other than the webhook’s callback URL. See Events, Callbacks and Status.

Create the order (Provision) only when #

Conditions decide which events are orders. Every condition must hold, or the event is not an order. A typical one is type equals license.created. The operators are equals, does not equal, is one of (comma separated), is present and is missing, and you can add up to ten conditions. At least one is required before the webhook can leave Capture only.

Cancelling, suspending and the other actions have conditions of their own on the Actions tab. An event that matches none of them is logged and ignored, and one that matches more than one is refused.

Service details to store #

Each row stores a value from the event on the new service as attr.<key>, exactly as a provisioning reply would, so the service page shows it and later Custom API calls can use it as {{ attr.key }}. A key that looks like a password, token or licence key is stored encrypted. You can store up to 50 details.

When a ticked product is provisioned through a Custom API integration and set to Already exists, the card lists the details that integration’s calls need, ticked when they are mapped. Events for those products are refused while any of them is not mapped, because the service could not be renewed or managed without it.

Dates and emails #

Setting What it does
When the event has no due date Refuse the event (the default), One billing cycle after the event arrives (the cycle chosen on the Products tab), A number of days after the event arrives, or The next occurrence of a day of the month. A due date in the event is always used when there is one.
Days after the event / Day of the month (1–31) The numbers for the last two rules.
Move a due date on the 29th, 30th or 31st to the 28th On by default. Each renewal adds one cycle to the due date, and a billing day from the 29th to the 31st drifts once a shorter month is reached. The 28th exists in every month.
Latest accepted due date (days from today) From 1 to 3660, starting at 400. A due date further ahead is refused, so a mistake in the sender cannot put a first charge years away.
Email the customer “your service is ready” Off by default: for a reseller, the portal customer is the reseller, and the sender usually tells them already. When on, it follows the service: at once for a service that already exists, or when the portal finishes provisioning it.

A default due date is counted from the day the event arrived, so re-processing it later gives the same date. If that date has passed by the time the event is approved or re-processed, the event is refused and the order has to be made by hand.

Status of a new order #

On the Setup tab, Status of a new order is Active or Pending. Active is the usual choice. With Pending, overdue suspension leaves the service alone. A service the portal provisions turns Active once provisioning succeeds, but one recorded as already existing, or left for staff, stays Pending until staff change it.

The Customers tab #

The Customers tab maps the sender’s customer IDs to the portal customers who are billed. Press Add row, enter the Customer ID the sender sends, an optional Label, and choose the Portal customer billed. Untick Active to stop a row without deleting it, then press Save customers.

  • The two IDs do not have to match. Customer IDs are compared without regard to case, and each can appear once.
  • Only a main customer account can be billed: not a guest, and not a sub-account.
  • An event whose customer ID has no active row is logged and ignored, and staff are alerted. Add the row, then press Re-process on the event.

Note: The portal’s own store purchases are not filtered out by this table. If the sender also reports services the portal itself ordered from it, an echo of one is recognised by its remote ID once the purchase is provisioned, and the sender is asked to retry while it is still being provisioned. To be certain, the sender should not attach a mapped customer ID to services the portal orders.

The Products tab #

Tick each product the webhook may order. Products are grouped as in the catalogue and can be filtered by name. For each ticked product, choose:

Column What it does
Billing cycle The cycle the service renews on. One-off cycles cannot be chosen: they are marked (never renews).
Create How the service comes to exist (see below).
Sender’s code Optional. The sender’s own name for the product, when it does not send the portal ID. Each code can be used once.

The price is always the catalogue’s price for the chosen cycle in the customer’s currency: an event can never set a price or a cycle. A product with no price above 0.00 for that cycle and currency is refused, because a service created at 0.00 would renew free for ever.

Create routes #

Route What happens Offered for
Already exists The sender made the service; it is recorded as provisioned. Products provisioned through an active Custom API integration, and products with no integration.
Now The portal provisions it as soon as the order is saved. Products with one active integration that really provisions: cPanel, Plesk, Enhance, Pterodactyl, GameCP, the domain registrars and Custom API.
Schedule The next Provision Orders run provisions it. As for Now.
Nothing (staff) It waits on Pending Provisioning for staff, who are alerted. Any product the webhook may order.

A route that does not fit a product is shown as (not available) with the reason. A webhook can never order an SSL certificate, which needs the configuration step only a store purchase starts, or a product in the System group (Credit Deposit), which is a balance top-up rather than a service.

Warning: Now and Schedule spend real money where the provider charges, against a £0.00 activation invoice: the customer first pays on the next due date. A domain product registers the domain for real at the registrar, paid by you.

Domain and hosting products #

cPanel, Plesk, Enhance and domain products need the Domain name path in every event. A domain product registers the part of the name before its TLD (the product’s name), needs a billing cycle of 12 months or a multiple of it, and, on Now or Schedule, a customer with a complete default address (first line, city and country). Without one the event is refused: add the address to the customer, then press Re-process.

Services left for staff #

A service created on Nothing (staff) is listed on Users & Roles → Pending Provisioning with the status staff_setup and the note “Left for staff: provision it, or mark it provisioned”. Set it up and press Mark Provisioned, or, where the product has an integration, use the Provision now button. The automatic provisioning run never picks these services up. In the customer’s Sites list the service shows as Setting up meanwhile. See The Pending Provisioning Queue.

The Add-ons & options tab #

An event can also order a product’s add-ons and set its configurable options, named by the sender’s own codes. Leave this tab alone if the sender never sends any.

Where the event lists its add-ons #

Choose the Shape: The event lists no add-ons, A list of entries, or An object (code → value). For a list, give the Path of the list or object and, inside each entry, the path of the code, the value and the quantity. An entry can also be a bare code.

Rules #

Each rule translates one thing the event sends:

  • When the event sends: Entry with code (from the list above), Value at path (anywhere in the event), or Always.
  • Sent value: a particular value, or any value.
  • Product: All products or one ticked product.
  • Then: add an add-on with a fixed option, or with the option whose value was sent; set a configurable option to the value sent or to a fixed value; or Ignore it (nothing is ordered).

A rule for one sent value beats a rule for any value, and a rule for one product beats a rule for all products. An Always rule names one product and gives it a default, used only when the event does not set that add-on or option itself.

For example, a game-server reseller sends {"extras": [{"code": "ram", "value": "4096"}], "location": "uk"}. Set the list at extras with code code and value value, then add the rules “Entry with code ram, any value → Extra RAM › the option whose value was sent” and “Value at path location = uk → LocationID = 1″.

Prices always come from the catalogue: the add-on option’s price for the product’s cycle, in the customer’s currency. Add-ons go on the same order and renew with the service. Only one of each add-on is ordered: a quantity of 0 skips it, and more than 1 is refused.

Warning: Anything the event sends that no rule maps, or that the product does not offer or price, refuses the whole event, and staff are alerted. Add the rule, then press Re-process. Some values are never set by a webhook whatever a rule says, such as transfer codes, domain fields and passwords; the tab lists them.

Add-ons that staff must set up raise an alert naming them, and those that need provisioning wait on Pending Provisioning too.

Trying an event first: the dry run #

On the Mapping tab, with an event in the sample box, press Test this payload with the saved settings. RackHelm runs every check against the settings as last saved, without checking a signature, and shows what the event would do. Nothing is written and nothing is sent.

The result starts with a badge: Would create an order, Already ordered — nothing would be created, Would be logged and ignored, Would be refused, or, for an action, Would suspend the service and so on. Below it come the customer and how they were found, the product and route, the order status, cycle, price and first charge date, the remote service ID, the details to store, and a table of the add-ons. An action that is switched off is tested too, with Switched off. Switched on, it would ….

Troubleshooting #

Symptom Cause and fix
Every event is Ignored The customer ID has no active row on the Customers tab, or the event does not match the Provision conditions. Open the event with View to see the reason.
The dry run still shows the old result after a change It uses the saved settings. Save the tab first.
“… has no … price above 0.00 in …” The product has no price for that cycle in the customer’s currency. Price it in the catalogue, or choose another cycle.
Events for a Custom API product set to Already exists are refused A detail its calls need is not mapped under Service details to store. Map every key the card lists.
A domain event is refused for want of an address The customer has no complete default address. Add one, then press Re-process.
An event with add-ons is refused A code or value has no rule, or the product does not offer or price that add-on. Add the rule, then press Re-process.
An event approved some days later is refused for its due date A default due date counts from the day the event arrived and has passed. Create the order by hand.
A route shows (not available) The product’s integration cannot do it; the reason is shown under the row. For example, a product with two integration rows cannot use Now or Schedule.