Webhooks
RewardsNP can send your server a signed message when something happens for a business's customers: a visit, a reward, a draw win, progress towards a reward.
Setting up
A business adds its own webhook address on its dashboard, in the Webhooks card on the Messaging tab. Only a team member in the Connections group can do this; the Owner has that group by preset, a Manager does not. The business gives the address a name and the address itself, and is shown a signing secret, which starts with whsec_. It is shown once: the business passes it to you and you store it like a password. A business can hold up to 10 webhook addresses. The ConvertPlus team can also add an address for a business, at its request.
Rules for the address:
- It must be a public
https://address, at most 2048 characters, with no user name or password in it. - It must not lead to a private, local or reserved network address. We check this every time we connect, and if the name leads to several addresses, every one of them must be public.
- Redirects are never followed. Answer on the address itself.
- An address cannot be edited. A new address is a new set-up, with a new secret and a new verification.
The verification challenge
When the address is set up we send one endpoint.verification message. It is signed like every other message, and looks like this:
The challenge
{
"event": "endpoint.verification",
"event_id": "endpoint.verification:whe_5b1e…",
"schema_version": 1,
"occurred_at": "2026-10-03T12:34:56.789Z",
"client_id": "cli_…",
"campaign_id": null,
"branch_id": null,
"data": { "challenge": "0f1e2d3c4b5a69788796a5b4c3d2e1f0" }
}
Answer with a 2xx status and a JSON body, at most 4096 bytes, whose top-level challenge is exactly the value you were sent:
Your answer
{ "challenge": "0f1e2d3c4b5a69788796a5b4c3d2e1f0" }
- Until you answer correctly, nothing else is sent to the address.
- Things that happen before the address is verified are never sent to it, not later and not by a replay.
- A wrong answer counts as a failed delivery and is retried on the usual schedule. After seven failed attempts the check is set aside. The business presses Verify again on the Webhooks card to send a new one.
The message
Every message is an HTTP POST to your address with a JSON body, sent on a fresh connection, one message at a time.
| Header | Value |
|---|---|
Content-Type | application/json. The body is UTF-8. |
User-Agent | ConvertPlus-Webhook/1 |
X-ConvertPlus-Signature | t=<unix seconds>,v1=<hex>, or two v1 values while a secret is being replaced. See below. |
X-ConvertPlus-Event-Id | The same value as event_id in the body. |
X-ConvertPlus-Schema-Version | The same value as schema_version in the body. |
A message body
{
"event": "reward.unlocked",
"event_id": "reward.unlocked:l48211",
"schema_version": 1,
"occurred_at": "2026-10-03T12:34:56.789Z",
"client_id": "cli_…",
"campaign_id": "cmp_…",
"customer": {
"ref": "usr_3f9a1c2b4d5e6f70",
"phone_sha256": "…64 hex characters…",
"email_sha256": ""
},
"branch_id": null,
"data": {
"reward_name": "Free coffee",
"pool_ref": "loyalty:main",
"pool_name": "Coffee card",
"earned_by": "earned",
"claim_by": "2026-11-02T12:34:56.789Z",
"referral_role": null
}
}
eventis the event's name;dataholds the details for that event (see the table below).event_ididentifies the event. It is the same on every retry and every replay.schema_versionis1for every event today. Changes are additive only: a new key or a new event; a key never changes meaning.occurred_atis when the thing happened, in UTC. It does not change on a retry or a replay.client_idis the business.campaign_idis the campaign; it isnullon the two eventsendpoint.testandendpoint.verification.customeris present on the seven customer events and absent on the two eventsendpoint.testandendpoint.verification.branch_idis always present, andnullwhen the event has no branch.- Every
datakey listed for an event is present, andnullwhen it does not apply. The one exception islottery.won, which carries eitherreward_nameorpoints.
Events
| Event | When it is sent |
|---|---|
visit.recorded | A visit was recorded for a known customer - scanned by the customer, logged by staff, or reported through this API. |
reward.unlocked | A customer earned a reward (any way except winning a draw), or spent points on one. Both people in a referral get their own event. |
reward.claimed | Staff handed a reward over to the customer. |
lottery.won | A draw took place and this customer won. A draw win is never also sent as reward.unlocked. |
loyalty.progress | A visit added points to the customer's balance. |
streak.progress | A visit was counted on a visit ladder - every counted visit, not only the ones that reach a reward. |
passport.progress | A visit stamped a branch the customer had not visited before on a branch passport. |
endpoint.test | A test message, sent when Send test is pressed for your address, by the business on its dashboard or by the ConvertPlus team. It names no customer and no campaign. |
endpoint.verification | Sent once, when your address is first set up. Nothing else is sent until you answer it correctly. |
visit.recorded
A visit was recorded for a known customer - scanned by the customer, logged by staff, or reported through this API.
This event carries the customer object.
Key in data | Type | Always there | Meaning |
|---|---|---|---|
channel | string or null: scan, staff, api | yes | How the visit was recorded: scan (the customer's own page), staff (logged on the dashboard), api (reported through this API). Null on old history. |
transaction_value | number or null | yes | The bill amount, when one was given. |
reward.unlocked
A customer earned a reward (any way except winning a draw), or spent points on one. Both people in a referral get their own event.
This event carries the customer object.
Key in data | Type | Always there | Meaning |
|---|---|---|---|
reward_name | string or null | yes | The reward's name. |
pool_ref | string or null | yes | Which part of the campaign gave the reward. Treat it as opaque. |
pool_name | string or null | yes | That part's name as the business wrote it. |
earned_by | string or null | yes | How it was earned: referral, points_spent, or a word such as earned, granted or compensation. |
claim_by | string or null | yes | The last moment to claim it (UTC), or null when it does not lapse. |
referral_role | string or null: referrer, referred | yes | On a referral reward, which side this customer is. |
reward.claimed
Staff handed a reward over to the customer.
This event carries the customer object.
Key in data | Type | Always there | Meaning |
|---|---|---|---|
reward_name | string or null | yes | The reward's name. |
pool_ref | string or null | yes | Which part of the campaign gave the reward. Treat it as opaque. |
pool_name | string or null | yes | That part's name as the business wrote it. |
lottery.won
A draw took place and this customer won. A draw win is never also sent as reward.unlocked.
Carries EITHER reward_name (a prize) OR points (points added to the balance) - the other key is absent.
This event carries the customer object.
Key in data | Type | Always there | Meaning |
|---|---|---|---|
draw_name | string or null | yes | The draw's name. |
round | integer or null | yes | Which round of the draw. |
reward_name | string or null | no | The prize, when the win is a prize. |
points | number or null | no | The points won, when the win is points. |
claim_by | string or null | yes | The last moment to claim a prize (UTC). Null for a points win. |
loyalty.progress
A visit added points to the customer's balance.
This event carries the customer object.
Key in data | Type | Always there | Meaning |
|---|---|---|---|
points_earned | number or null | yes | Points added by this visit. |
balance | number or null | yes | The balance after it. |
tier | string or null | yes | The customer's tier name, or null. |
streak.progress
A visit was counted on a visit ladder - every counted visit, not only the ones that reach a reward.
This event carries the customer object.
Key in data | Type | Always there | Meaning |
|---|---|---|---|
pool_ref | string or null | yes | Which visit ladder. Treat it as opaque. |
visit_count | number or null | yes | Visits counted on the ladder so far. |
position | number or null | yes | Where the customer stands on the ladder. |
next_milestone | number or null | yes | The visit count of the next reward. Null at the top. |
passport.progress
A visit stamped a branch the customer had not visited before on a branch passport.
This event carries the customer object.
Key in data | Type | Always there | Meaning |
|---|---|---|---|
pool_ref | string or null | yes | Which passport. Treat it as opaque. |
stamps | number or null | yes | Branches stamped so far. |
stamps_required | number or null | yes | Branches needed to complete it. |
stamped_branch | string or null | yes | The branch this visit stamped. (branch_id on the message itself is null for this event.) |
endpoint.test
A test message, sent when Send test is pressed for your address, by the business on its dashboard or by the ConvertPlus team. It names no customer and no campaign.
This event has no customer object.
data is empty: {}.
endpoint.verification
Sent once, when your address is first set up. Nothing else is sent until you answer it correctly.
This event has no customer object.
Key in data | Type | Always there | Meaning |
|---|---|---|---|
challenge | string | yes | 32 lower-case hex characters. Send the same value back. |
- A draw win is sent as
lottery.wononly, never also asreward.unlocked. - When a reward is handed over automatically,
reward.unlockedandreward.claimedarrive together. passport.progressnames its branch indata.stamped_branch; itsbranch_idisnull.- Nothing is sent for a customer giving consent, a draw ticket being issued, a reward lapsing or being cancelled, or staff changing a points balance.
Verifying the signature
Check the signature of every message before you trust it.
- Keep the request body exactly as received, as raw bytes. Do not parse it and write it out again first.
- Read
X-ConvertPlus-Signature. Split it on commas. Take thetvalue and everyv1value. - Build the signed text: the
tvalue, a dot, then the raw body. - Compute HMAC-SHA256 of that text with your signing secret as the key, and write it as lower-case hex. The key is the whole secret you were given, including
whsec_. - Accept the message if any
v1value equals what you computed, with any secret you currently hold. Compare in constant time. - Reject a message whose
tis far from your own clock. We suggest five minutes. We do not enforce a window; you should.
Node.js
const crypto = require('node:crypto');
// rawBody: the body exactly as received (a Buffer). header: X-ConvertPlus-Signature.
// secrets: every signing secret you hold now (two while one is being replaced).
function verify(rawBody, header, secrets, toleranceSeconds = 300) {
const parts = String(header || '').split(',');
const t = (parts.find((p) => p.startsWith('t=')) || '').slice(2);
const sent = parts.filter((p) => p.startsWith('v1=')).map((p) => p.slice(3));
if (!/^[0-9]+$/.test(t) || sent.length === 0) return false;
if (Math.abs(Date.now() / 1000 - Number(t)) > toleranceSeconds) return false;
for (const secret of secrets) {
const expected = crypto.createHmac('sha256', secret).update(t + '.').update(rawBody).digest('hex');
for (const sig of sent) {
if (sig.length === expected.length && crypto.timingSafeEqual(Buffer.from(sig), Buffer.from(expected))) return true;
}
}
return false;
}
Python
import hashlib
import hmac
import time
# raw_body: the body exactly as received (bytes). header: X-ConvertPlus-Signature.
# secrets: every signing secret you hold now (two while one is being replaced).
def verify(raw_body, header, secrets, tolerance_seconds=300):
parts = (header or '').split(',')
t = next((p[2:] for p in parts if p.startswith('t=')), '')
sent = [p[3:] for p in parts if p.startswith('v1=')]
if not t.isdigit() or not sent:
return False
if abs(time.time() - int(t)) > tolerance_seconds:
return False
for secret in secrets:
signed = t.encode('ascii') + b'.' + raw_body
expected = hmac.new(secret.encode('utf-8'), signed, hashlib.sha256).hexdigest()
if any(hmac.compare_digest(sig, expected) for sig in sent):
return True
return False
Replacing a secret without an outage. When a secret is replaced, every message is signed with both the new secret and the old one, so the header carries two v1 values, the new one first. The business chooses Replace secret on the Webhooks card and passes you the new secret. Install it, then tell the business, which chooses Remove old secret. (The ConvertPlus team can do both steps for a business too.) A secret cannot be replaced again until the old one has been removed. A secret is shown once; a lost secret means a replacement.
t is the time of that attempt. A retry or a replay carries a new t and a new signature over the same body.
What counts as delivered
- Delivered means any 2xx status, received within 10 seconds for the whole exchange: connecting, sending, and your complete answer. A slow answer does not extend the 10 seconds.
- The body of your answer is ignored, except for the verification challenge.
- Everything else is a failure and is retried: any 3xx (redirects are never followed), any 4xx, any 5xx, a refused or dropped connection, a timeout, an address we refuse to connect to. No status is treated as final.
- Answer quickly and do your own work afterwards: accept the message, put it on a queue, return 200.
Retries, messages set aside, and pause
- Retries. The first attempt is made within seconds. After a failed attempt we wait 1 minute, 5 minutes, 30 minutes, 2 hours, 6 hours, then 24 hours before the next.
- Set aside. After the 7th failed attempt, about 33 hours after the first, the message is set aside and no longer retried. The business's team sees an alert on its dashboard. A business can send one set-aside message again itself: on its Webhooks card it chooses Deliveries for the address, then Retry beside the message. The ConvertPlus team can send a set-aside message again too.
- Order is not guaranteed. A retried message can arrive after a later one. Use
occurred_at, not arrival order. - Pause. After 10 failures in a row across all messages to an address, the address is paused. New events keep queueing for it and are held. Nothing is sent until the address is resumed, by the business with Resume on its Webhooks card or by the ConvertPlus team; a single retry or a replay does not resume it. The business can also pause an address itself with Pause.
- After a resume the held messages are sent oldest first, about 240 a minute, so a large backlog takes a while to arrive.
- If an address is removed, the messages still waiting for it are dropped.
Duplicates, event ids and replay
Delivery is at least once. You can receive the same event more than once: when your 2xx answer was lost or came after the 10 seconds, when a send was interrupted on our side, or when a message was sent again on request.
- Drop repeats by
event_id. It is the same on every retry and every replay, and the same for every address the event goes to. It is also in theX-ConvertPlus-Event-Idheader. - An
event_idis 1 to 128 visible ASCII characters with no spaces, for examplereward.unlocked:l48211. Treat it as opaque: store it and compare it, do not take it apart. - Replay. The ConvertPlus team can send again what was already delivered or set aside in a time range: at most 31 days and 1000 messages per request, oldest first. A replayed message has its original
event_idandoccurred_at, and a newtand signature. - A replay never includes anything from before the address was verified, and nothing whose content has already been removed. Content is kept for 90 days after a message is settled, unless the deployment is set differently.
- Customer details are filled in at the moment of sending. A retry or replay carries the customer's details as they are now, and nothing is sent about a customer who has since been deleted.
Customer details: hashed unless switched on
customer.refis our id for the customer at that business. It stays the same for the customer; treat it as opaque.customer.phone_sha256andcustomer.email_sha256are always present. Each is the SHA-256, in lower-case hex, of the value in a fixed form: the phone as+977followed by 10 digits, the email trimmed and in lower case.- When the customer has no phone or no email, that field is an empty string, not the hash of an empty string.
- There is no hash of the name.
- Plain details are off by default. The business switches them on for one address with the Send contact details in clear tick on its Webhooks card (it needs the Customers group as well as the Connections group, and an address that has been verified), or the ConvertPlus team can switch them on at the business's request; messages to it then also carry
customer.name,customer.phoneandcustomer.email, eachnullwhen the customer has none. The switch is read at the moment of sending.