Integration webhooks
BetterQ can call your own systems as things happen: when a token or appointment is requested, once it has its number, and when serving finishes. All optional.
What the webhooks do
A webhook is a message BetterQ sends to a web address you provide, so your own system is told about something the instant it happens. Nothing about the queue changes for your staff or customers — this is purely a way to plug BetterQ into the systems you already run.
Setting them up
Select your name at the bottom of the menu on the left, choose App Settings, then Integration Webhooks. You need the Manage organisation settings permission to see App Settings. There are three boxes — one for each webhook — where you paste the web address BetterQ should call. Fill in the one(s) you want and select Save changes at the top. You can use one, two or all three. The Learn more button beside it opens this page.
- All three calls are always sent as a POST request, with the headers
Content-Type: application/json,Accept: application/jsonandX-Signature— there is nothing to choose. - Every call times out after 5 seconds. This can’t be changed: a queue screen must never wait longer than that on an outside system.
- Each box takes a full web address, starting with
https://(orhttp://), of up to 2,048 characters. Anything else is refused when you save, with a message under the box, and nothing in App Settings is saved until it is fixed. - Your address must be reachable over the public internet, and should answer with a success status (a 2xx) as fast as it can.
- All three share the same signing secret, so your systems verify every call the same way.
How requests are signed
So your system can be sure a call really came from BetterQ, every request is signed. BetterQ generates a secret for you the first time you save any webhook address — until then the section says “A signing secret is generated automatically the first time you save any webhook URL.” The secret is 64 characters long and stays hidden as dots until you select Reveal; then Copy puts it on your clipboard and Hide covers it again. Regenerate replaces it after asking you to confirm, and the old one stops working at once. Anyone who can open App Settings can reveal or regenerate it. Clearing all three addresses keeps the secret, ready for when you add one again.
On every request BetterQ takes the exact bytes of the JSON body and produces an HMAC-SHA256 using your secret. It sends the result — the letters sha256= followed by the hex digest — in a header named X-Signature:
X-Signature: sha256=HMAC_SHA256(your_secret, raw_request_body)To verify a call, compute the same thing from the raw body you received and your copy of the secret, then compare the two with a constant-time check. If they don’t match, reject the request. Read the raw body before parsing it as JSON — re-serialising a parsed object can change a byte and break the check.
\/ and letters outside plain English, such as £ or é, as \u codes — £ arrives as \u00a3. Any JSON reader turns these back into the right characters, but they are part of the signed bytes, which is another reason to check the signature on the raw body. Numbers that identify things, such as a queue’s id, are sent as text, and a set of answers with nothing in it is sent as an empty list, [], rather than {}.<?php
$secret = 'paste-your-signing-secret-here';
// The raw body BEFORE decoding — the signature is over these exact bytes.
$body = file_get_contents('php://input');
$signature = $_SERVER['HTTP_X_SIGNATURE'] ?? '';
$expected = 'sha256=' . hash_hmac('sha256', $body, $secret);
if (! hash_equals($expected, $signature)) {
http_response_code(401); // Not from BetterQ — reject it.
exit;
}
$payload = json_decode($body, true);The token/appointment requested webhook
This webhook fires every time a visit begins — a walk-in token taken at the kiosk, the QR page, the website or an embedded screen, a token a staff member issues on behalf of a customer, and an appointment booking, whoever makes it. BetterQ waits for the reply (up to 5 seconds) before finishing, because the reply can decide the customer’s priority. The customer sees the screen working for that moment.
What BetterQ sends
| Field | What it is |
|---|---|
type | walk-in for a token, or appointment for a booking. |
service_category | The name of the service the customer chose. null on a queue that offers no separate services. |
queue | The queue (line) they joined — its id (as text) and name. |
custom_field_data | The answers to the custom fields you flagged as lookup fields, keyed by each field’s slug. A lookup field the customer left blank is sent as null. A multi-choice field is sent as a list. With no lookup fields on the form, this is an empty list, []. See Custom fields. |
appointment_data | For a booking only: the name, email, mobile, date (YYYY-MM-DD) and time (HH:MM, in the queue’s own time zone) the customer entered. email or mobile is null when not given. It is null for a walk-in. |
{
"type": "walk-in",
"service_category": "Account Opening",
"queue": { "id": "12", "name": "Main Branch" },
"custom_field_data": {
"national_id": "199512345678",
"account_number": "0041233219"
},
"appointment_data": null
}For an appointment booking the type is appointment and appointment_data carries the booking details:
"appointment_data": {
"name": "Lim Siew Lan",
"email": "lim.sl@example.com",
"mobile": "+60195520034",
"date": "2026-07-13",
"time": "09:00"
}What your system replies with
Reply with a 2xx status and a JSON object as the body. Both fields are optional — send an empty object, {}, and the visit simply stays Regular. Do send a body, though: an empty reply, or anything that is not a JSON object, counts as a failed call (see When calls keep failing).
{
"tier": "vip",
"customer_data": {
"email": { "label": "Email", "value": "lim.sl@example.com" },
"mobile": { "label": "Mobile", "value": "+60195520034" },
"account_manager": { "label": "Account manager", "value": "Aisha Rahman" }
}
}| Reply field | What BetterQ does with it |
|---|---|
tier | One of vip, priority or regular, written in lower case exactly like that. Sets the customer’s priority — but only where the tier is decided automatically (see the next table). Anything else, or a missing tier, leaves the visit Regular. An appointment booking is always the appointment tier — BetterQ sets that itself, so any tier you return for a booking is ignored. |
customer_data | A set of entries, each with a text label and a text value, shown as the Customer record — to the representative while they serve, and on the visit’s token profile afterwards. Entries whose label or value are not plain text are dropped. Entries named mobile and email also fill in contact details the customer did not give — see How email and mobile number are handled. This works for bookings as well as walk-ins. See Serving a customer and Token profile. |
When the returned priority is used
| How the visit began | Is the returned tier used? |
|---|---|
| Kiosk, QR page, or website | Yes — the reply sets the priority. |
| Staff issuing on behalf, priority left on Automatic | Yes — the reply sets the priority. |
| Staff issuing on behalf, priority chosen by hand | No — the staff member’s choice wins. |
| Appointment booking | No — an appointment is always the appointment tier, set by BetterQ. |
The token/appointment issued webhook
This webhook fires a moment after the one above, once the visit actually has its number — for every walk-in token and every appointment booking, on every channel. It is the one to use when your own system needs to know which number the customer was given: to text them yourself, to print something, or to file the visit in your own records.
BetterQ sends it in the background and does not wait for a reply. Whatever you send back is ignored, and a call that fails changes nothing for the customer — their token is already theirs. Verify the signature the same way and answer with any 2xx.
What BetterQ sends
| Field | What it is |
|---|---|
token_no | The number the customer was given — the whole point of this webhook. |
tier | The priority the visit ended up with: vip, priority, regular, or appointment for a booking. This is the final answer, after your requested-webhook reply and any choice a staff member made. |
issued_via | How the visit began: kiosk, qr, web, embed (an embedded screen on your own site) or operator (a staff member issuing or booking on behalf). An appointment the customer booked themselves carries the channel they booked on, such as web. |
queue | The queue (line) they joined — its id (as text) and name. |
service_category | The name of the service the customer chose. null on a queue that offers no separate services. |
email | The email address on file for the visit, or null. See How email and mobile number are handled. |
mobile | The mobile number on file for the visit, or null. |
custom_field_data | Everything the customer entered on the issuance form, keyed by each field’s slug — not only the lookup fields. A field they left blank is absent. A multi-choice field is sent as a list, and a tick box as "1" (ticked) or "0". If your form has more than one Mobile Number field, the number the customer gave appears under each of them. With nothing entered, this is an empty list, []. See Custom fields. |
appointment_data | For a booking only: the name, date (YYYY-MM-DD), time (HH:MM) and mode — onsite or online. It is null for a walk-in. The booking’s email and mobile are not repeated here; they are the top-level email and mobile. |
{
"token_no": "0207",
"tier": "vip",
"issued_via": "kiosk",
"queue": { "id": "12", "name": "Main Branch" },
"service_category": "Account Opening",
"email": "lim.sl@example.com",
"mobile": "+60195520034",
"custom_field_data": {
"national_id": "199512345678",
"account_number": "0041233219",
"reason_for_visit": "Open a new account"
},
"appointment_data": null
}For an appointment booking the tier is always appointment, and appointment_data carries the booking details:
{
"token_no": "9004",
"tier": "appointment",
"issued_via": "web",
"queue": { "id": "12", "name": "Main Branch" },
"service_category": "Mortgage Advice",
"email": "lim.sl@example.com",
"mobile": "+60195520034",
"custom_field_data": { "national_id": "199512345678" },
"appointment_data": {
"name": "Lim Siew Lan",
"date": "2026-07-13",
"time": "09:00",
"mode": "onsite"
}
}How email and mobile number are handled
BetterQ may need to reach the customer — to text them their token number (where text delivery is switched on for the queue), to email or text an appointment confirmation, and to send a service review invitation afterwards. It works out the mobile number and email for a visit in a fixed order.
mobile or an email entry inside your requested webhook reply’s customer_data and uses its value. So your system can supply contact details BetterQ wouldn’t otherwise have — for example a kiosk walk-in you recognised only by an ID number.The served webhook
This webhook fires when a representative completes a token from their counter screen. It tells your system the visit is done and sends the details of what happened. BetterQ makes the call quietly in the background — completing a token is never held up waiting for you — and it ignores the reply, so just verify the signature the same way and answer with any 2xx.
| Field | What it is |
|---|---|
token_no | The customer’s token number. |
rep | Who served the customer — their representative id (as text), name and email. |
queue | The queue the visit belonged to — its id (as text) and name. |
type | walk-in or appointment. |
service_category | The name of the service. null when there is none. |
customers_custom_field_data | The customer’s answers to your lookup fields only, keyed by slug — the same fields the requested webhook sends. An empty list, [], when there are none. |
reps_custom_field_data | Everything the representative filled in on their side, keyed by slug. A tick box is "1" or "0". An empty list, [], when there is nothing. |
appointment_data | For an appointment only: the booking’s name, email, mobile, date (YYYY-MM-DD) and time (HH:MM, in the queue’s own time zone). null otherwise. |
{
"token_no": "0207",
"rep": { "id": "4", "name": "Nadeesha Perera", "email": "nadeesha@example.com" },
"queue": { "id": "12", "name": "Main Branch" },
"type": "walk-in",
"service_category": "Account Opening",
"customers_custom_field_data": { "national_id": "199512345678" },
"appointment_data": null,
"reps_custom_field_data": { "outcome_note": "Verified NIC" }
}Run your own messaging instead
You don’t have to use BetterQ’s built-in text messaging at all. If you’d rather send everything yourself — with your own text or email provider, your own wording and your own sending numbers — the webhooks give your system every moment it needs, including the token number. Leave the text-messaging (SMS) credentials blank in the SMS Delivery section of App Settings and drive it all from your side.
email and mobile fields — so a customer who typed either one can be messaged from your side straight away. Where the form asks for neither, identify the customer another way (such as an ID number) and look their details up in your own system. Appointment bookings carry the email and mobile the customer entered when booking.A worked example
Here is a complete receiving endpoint for the Token/Appointment requested webhook — it checks the signature, looks the customer up, and replies with a tier and some details for the representative. The curl tab shows how to fire a correctly-signed test request at it from your own machine.
SECRET='paste-your-signing-secret-here'
BODY='{"type":"walk-in","service_category":"Account Opening","queue":{"id":"12","name":"Main Branch"},"custom_field_data":{"national_id":"199512345678"},"appointment_data":null}'
# Sign the exact bytes of the body, the same way BetterQ does.
SIGNATURE="sha256=$(printf '%s' "$BODY" | openssl dgst -sha256 -hmac "$SECRET" -hex | sed 's/^.*= //')"
curl -X POST https://your-system.example.com/betterq/requested \
-H 'Content-Type: application/json' \
-H "X-Signature: $SIGNATURE" \
--data "$BODY"When calls keep failing
Calls to your systems can fail — the address might be down, unreachable, or rejecting the signature. A one-off failure is nothing to worry about, and it never affects a customer. But a run of them in a single day usually means the connection needs attention.
BetterQ counts failed calls to the Token/Appointment requested webhook through the day. A call counts as failed when your address can’t be reached or takes longer than 5 seconds, answers with an error status (4xx or 5xx), or replies with something that is not a JSON object or is larger than 10 KB. Once the day’s failures pass a limit, it emails your main administrator once — and only once that day, however many more fail — asking someone to check the connection. You set that limit as the Webhook failure threshold on the System configuration screen (5 a day unless changed, so the email goes out on the 6th failure). The count resets at midnight in your organisation’s time zone.
For as long as the day’s failures are over that limit, every administrator also sees a Token/Appointment requested webhook is failing alert under Needs attention on the Admin dashboard and in their bell. Unlike the email, it stays up for the rest of the day, even after the connection is fixed, and clears when the count resets at midnight.

