- Qubitara Connect
- Webhooks
Webhooks
Qubitara Connect can notify your system when something happens, so you do not have to keep asking. You register a web address (an endpoint), choose the events you care about, and Qubitara Connect sends a signed message to that address each time one of those events occurs. Manage endpoints in the console under Developer → Webhooks. You need the permission to manage webhooks.
Set up an endpoint#
Open Developer → Webhooks and add an endpoint.
Enter the address. It must start with
https://and be reachable from the public internet. Addresses that point to private or internal networks are refused.Choose the events to receive. Leave the list empty to receive every event.
Copy the signing secret. It starts with
whsec_and is shown only once. If you lose it, rotate the secret to get a new one.
An endpoint can be paused and resumed. You can add a short description to remember what each one is for.
Events#
Event | When it fires | Main fields in data |
|---|---|---|
conversation.created | A new conversation starts. | conversationId, contactId, channel, status |
conversation.message_received | A customer message arrives. | conversationId, messageId, direction, body |
conversation.assigned | A conversation is assigned to a team member. | conversationId, assignedTo |
conversation.resolved | A conversation is marked resolved. | conversationId, resolvedBy |
contact.created | A contact is added. | contactId, name, phone |
ticket.created | A ticket is opened. | ticketId, subject, priority |
ticket.sla_breached | A ticket misses its response or resolution target. | ticketId, slaMinutes, breachedAt |
campaign.completed | A campaign finishes sending. | campaignId, sent, delivered, failed |
message.delivered | A message is confirmed delivered. | messageId, conversationId, deliveredAt |
message.failed | A message could not be delivered. | messageId, conversationId, errorCode |
The fields listed are the ones shown in the sandbox samples. Treat them as the minimum and ignore any extra fields you do not recognise, because more can be added over time. The console also sends a test.ping event when you press the test button on an endpoint; it is never sent for real activity.
What a delivery looks like#
Every delivery is a POST with a JSON body in this shape:
{
"id": "evt_9f2c4a1b7d3e8a05",
"type": "conversation.message_received",
"createdAt": "2026-09-08T10:00:00.000Z",
"data": {
"conversationId": "…",
"messageId": "…",
"direction": "inbound",
"body": "Hi, is my order shipped yet?"
}
}These headers are added to every request:
X-Qubitara-Event: the event type.X-Qubitara-Delivery: a unique id for this delivery.X-Qubitara-Signature: the signature, described next.
Verifying a delivery#
Anyone who knows your endpoint address could send it fake messages, so check every delivery before you trust it. The signature header looks like this (example values):
X-Qubitara-Signature: t=1788861600,v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bdt is the time the delivery was signed, in seconds since 1 January 1970. v1 is an HMAC-SHA256 of the text timestamp + "." + raw body, using your whole signing secret (including the whsec_ part) as the key, written as lowercase hexadecimal.
To verify: split the header, rebuild the signed text from the timestamp and the raw request body exactly as received, compute the hash, and compare it with v1 using a constant-time comparison. Then reject deliveries whose timestamp is too old (five minutes is a sensible limit), so a captured delivery cannot be replayed later. Always use the raw body, not a re-formatted copy of the parsed JSON.
import { createHmac, timingSafeEqual } from 'node:crypto';
export function verify(rawBody, header, secret, toleranceSeconds = 300) {
const parts = Object.fromEntries(header.split(',').map((p) => p.split('=')));
const timestamp = parts.t;
const received = parts.v1;
if (!timestamp || !received) return false;
if (Math.abs(Date.now() / 1000 - Number(timestamp)) > toleranceSeconds) return false;
const expected = createHmac('sha256', secret)
.update(timestamp + '.' + rawBody)
.digest('hex');
const a = Buffer.from(expected);
const b = Buffer.from(received);
return a.length === b.length && timingSafeEqual(a, b);
}import hmac, hashlib, time
def verify(raw_body: bytes, header: str, secret: str, tolerance: int = 300) -> bool:
parts = dict(p.split("=", 1) for p in header.split(","))
timestamp, received = parts.get("t"), parts.get("v1")
if not timestamp or not received:
return False
if abs(time.time() - int(timestamp)) > tolerance:
return False
signed = timestamp.encode() + b"." + raw_body
expected = hmac.new(secret.encode(), signed, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, received)Replying, retries and ordering#
Reply quickly. Answer with any 2xx status within 10 seconds. Any other status, a timeout or a connection error counts as a failure. Redirects are not followed.
Retries. A failed delivery is tried again after about 30 seconds, then 2 minutes, then 10 minutes, then 30 minutes. That makes five attempts in total. After the fifth failure the delivery is marked abandoned. A background job picks up retries every 30 seconds, so timings are approximate.
Automatic pause. After 10 failed deliveries in a row, the endpoint is switched off and the reason is recorded. A successful delivery resets the count. When you have fixed the problem, switch the endpoint back on in the console, which also clears the count.
Duplicates and order. Deliveries can arrive more than once and out of order. Use the
idin the body to ignore ones you have already handled.Do the work later. Reply first, then process the event in the background.
Watching and replaying deliveries#
Under Developer → Webhooks the delivery log lists each delivery with its status (pending, delivered or abandoned), the number of attempts, your server's response and any error. You can filter by endpoint and status. Replay sends a delivery again straight away and restarts its retry schedule, whatever state it was in.
Rotating the secret#
Rotate the signing secret if it may have leaked or someone who knew it has left. The new secret is shown once. Deliveries are signed with the new secret from that moment, and the old one stops working immediately, so update your receiver at the same time.
Testing#
Use the sandbox in Developer → Sandbox to see a sample body for every event, and to send a real signed test.ping to one of your endpoints. This checks that your server is reachable and that your signature check passes, without waiting for real activity.
Managing webhooks through the API#
These endpoints require the permission to manage webhooks. Paths are relative to the API base address.
Method and path | What it does |
|---|---|
GET /developer/webhooks/events | Lists the event names you can subscribe to. |
GET /developer/webhooks | Lists your endpoints. |
POST /developer/webhooks | Adds an endpoint. Body: url (https, required), description, events. Returns the signing secret once. |
PATCH /developer/webhooks/:id | Changes description, events or isActive. |
POST /developer/webhooks/:id/rotate-secret | Creates a new signing secret and returns it once. |
DELETE /developer/webhooks/:id | Removes an endpoint. |
GET /developer/webhooks/deliveries | Lists deliveries. Filters: endpointId, status, page, limit. |
POST /developer/webhooks/deliveries/:id/replay | Sends a delivery again. |