Guides
Receive and verify webhooks
Create an endpoint, verify every delivery, respond fast and let retries do the rest.
On this page
Webhooks notify your systems of activity in Ottla: a question is answered or refused, a customer asks for a human, someone signs up for an alert, a sync completes or billing changes. They are available on all plans. Ottla signs each delivery, retries failed deliveries and keeps a log of deliveries that you can replay.
This guide covers how to receive them safely. See the webhook events reference for a full list of events and their payloads.
Where teams usually start
| Event | What teams do with it |
|---|---|
escalation.opened |
Open a ticket in their own help desk when a shopper asks for a person |
question.refused |
Send questions the assistant could not answer to the content team, who add the missing detail |
alert.subscribed |
Note back-in-stock and price-drop demand in a buying spreadsheet (the payload carries a hashed email, never the address) |
product.ingested |
Check each catalogue batch’s created, updated and skipped counts in their own monitoring |
subscription.past_due |
Tell finance straight away, because catalogue syncing pauses while an account is past due |
Add a webhook
-
Open the webhooks page
Navigate to Storefront → Webhooks and click Add webhook. You need Admin or Owner permissions.
-
Enter the URL
Use an HTTPS endpoint on a server you control, such as
https://shop.example/webhooks/ottla. -
Choose events
Select the Events you’d like to receive, grouped by category, or enable All events, which also includes any future events we add. Add a Description to identify your webhook.
-
Save and copy the signing secret
Save, then copy the Signing secret. It starts with
whsec_and is shown once. If you lose it, use Rotate secret.
What a delivery looks like
Each delivery is a POST with a JSON body: the event id, the event name, when it happened, and the event’s data.
POST /webhooks/ottla HTTP/1.1
Content-Type: application/json
User-Agent: Ottla-Webhooks/1.0
X-Ottla-Event: question.answered
X-Ottla-Event-Id: 01JC3V7Q4M8T2X9K5R6N0B1D2E
X-Ottla-Delivery: 90412
X-Ottla-Signature: v=1,t=1792577700,sig=5f2c0e...
{
"id": "01JC3V7Q4M8T2X9K5R6N0B1D2E",
"event": "question.answered",
"created": "2026-10-21T10:15:00+00:00",
"data": {
"question": {"id": 48211, "text": "Which two-person tent is lightest?"},
"answer": {"id": 48213, "confidence": "high", "fallback": false, "refusal_reason": null, "sources_count": 3}
}
}
| Header | Value |
|---|---|
X-Ottla-Signature |
v=1,t=<unix seconds>,sig=<hex> |
X-Ottla-Event |
The event name, such as question.answered |
X-Ottla-Event-Id |
The event’s id. It is the same on every retry and replay, so use it to drop duplicates. |
X-Ottla-Delivery |
This delivery’s id. Retries keep it; a replay gets a new one. |
Content-Type |
application/json |
User-Agent |
Ottla-Webhooks/1.0 |
Verify the signature
Check every delivery before you trust it. The signature is a lowercase hex HMAC SHA-256 of the timestamp, a full stop and the raw body (<t>.<raw body>), keyed with your signing secret. To verify the webhook signature:
- You must read the raw request body exactly as it arrived. If you parse and re-serialise the JSON, the signature will not match.
- Reject the delivery if
tis more than 300 seconds from your clock, so an old delivery cannot be replayed at you. - Compute the HMAC and compare it with each
sig=value in constant time. Accept if any matches: during a secret rotation there are two.
The following examples have been tested against signatures built exactly as Ottla creates them, including rotating between two secrets, tampering with the body and using an old timestamp.
<?php
$secret = getenv('OTTLA_WEBHOOK_SECRET');
$header = $_SERVER['HTTP_X_OTTLA_SIGNATURE'] ?? '';
$body = file_get_contents('php://input'); // the raw body, exactly as sent
preg_match('/(?:^|,)t=(\d+)/', $header, $t);
preg_match_all('/(?:^|,)sig=([a-f0-9]{64})/', $header, $sigs);
$fresh = isset($t[1]) && abs(time() - (int) $t[1]) <= 300;
$expected = hash_hmac('sha256', ($t[1] ?? '').'.'.$body, $secret);
$valid = $fresh && array_filter($sigs[1], fn ($s) => hash_equals($expected, $s)) !== [];
if (! $valid) {
http_response_code(400);
exit;
}
http_response_code(200);
// Reply first, then process. Drop duplicates by $_SERVER['HTTP_X_OTTLA_EVENT_ID'].
const crypto = require('crypto');
const express = require('express');
function verifyOttlaSignature(rawBody, header, secret, toleranceSeconds = 300) {
const parts = String(header || '').split(',');
const t = parts.find((p) => p.startsWith('t='))?.slice(2);
const sigs = parts.filter((p) => p.startsWith('sig=')).map((p) => p.slice(4));
if (!t || Math.abs(Math.floor(Date.now() / 1000) - Number(t)) > toleranceSeconds) return false;
const expected = Buffer.from(crypto.createHmac('sha256', secret).update(t + '.' + rawBody).digest('hex'));
return sigs.some((s) => { const b = Buffer.from(s); return b.length === expected.length && crypto.timingSafeEqual(b, expected); });
}
const app = express();
// express.raw keeps the body exactly as sent, so the signature still matches
app.post('/webhooks/ottla', express.raw({ type: 'application/json' }), (req, res) => {
const rawBody = req.body.toString('utf8');
if (!verifyOttlaSignature(rawBody, req.get('X-Ottla-Signature'), process.env.OTTLA_WEBHOOK_SECRET)) {
return res.sendStatus(400);
}
res.sendStatus(200); // reply first
const eventId = req.get('X-Ottla-Event-Id');
const event = JSON.parse(rawBody);
handleLater(eventId, event); // your own code: skip any eventId you have already handled
});
Answer fast, then process
Reply with any 2xx status within 10 seconds. Anything else, or no reply in time, counts as a failed attempt. So acknowledge first and do the work afterwards, in a background job if it might be slow. If that job calls the Ottla API in turn, the errors reference lists every status and code it can get back. Writing to your order system or sending an email inside the request is the usual cause of timeouts.
You can receive the same event more than once, after a retry or a replay. Keep the X-Ottla-Event-Id values you have handled and skip any you have seen.
Retries and pauses
| Attempt | When |
|---|---|
| 1 | As soon as the event happens |
| 2 | About 5 seconds later |
| 3 | About 15 seconds after that |
| 4 | About 1 minute after that |
| 5 | About 4 minutes after that |
| 6 | About 10 minutes after that. If this fails too, the delivery is marked failed. |
If a webhook fails 10 consecutive times, it is paused and Ottla holds its events instead of dropping them. It tries one delivery after 1 hour, then after 2, 4, 8 and 16 hours, then every 24 hours. Once a delivery is successful, the webhook is active again and held events are sent, starting with the oldest, 30 per minute.
Events are not held forever. Any event that has been held for more than 72 hours fails instead of being delivered late. After a webhook has been paused for 72 hours, any new events fail straight away. If you pause a webhook yourself, it does not receive or hold any events.
Rotate the secret
Click Rotate secret on the webhook’s page. You can keep the old secret working for a while (24 hours by default), and the console shows when it stops under Old secret also signs until. During that overlap each delivery carries two sig= values, one per secret, so the verification code above keeps working while you deploy the new secret.
Test and replay
Send test event sends a webhook.test event with the data {"test": true, "endpoint_id": ..., "message": ...}, signed like any other delivery. You cannot subscribe to it; it only comes from the button.
The list of Deliveries shows you each event, what HTTP status your endpoint returned, how many attempts were made and when it was delivered. You can Replay a delivery that was successful or failed. This uses the same event id and can be useful if you fix a bug in your endpoint. You can send up to 10 test and replay requests per minute per webhook.
Forward handoffs to your help desk
Handoffs are sent to your team in Ottla’s Support inbox with the conversation included. You can also forward them to your helpdesk using webhooks. Enable Webhook handoff in Customer chat → Support settings under Channels and select your Webhook endpoint.
Ottla then sends escalation.opened when a shopper asks for a person (without the transcript), escalation.message for each message, escalation.resolved when the conversation closes, and escalation.rated when the shopper rates it. Only the endpoint you select receives them. Hand conversations to your team covers the rest of the set-up.
FAQ
Frequently asked questions
How long do I have to respond?
10 seconds. Reply with a 2xx first, then do the work.
What if my endpoint is down?
Ottla attempts to deliver your webhook up to 6 times over approximately 15 minutes. After 10 failures in a row, the webhook is paused and holds events for up to 72 hours, trying again with growing gaps.
Can I get the same event twice?
Yes, after a retry or a replay. Drop duplicates by X-Ottla-Event-Id.
Does Ottla require HTTPS?
Ensure you use an HTTPS endpoint. Webhooks contain customer questions and other data from your store. The signature verifies the request came from Ottla but does not encrypt the payload.
Are webhooks on every plan?
Yes. Some events only trigger for features on some plans, such as the weekly digest (Growth and above). The events reference notes which.
Next
Webhook events reference
Every event and its payload.
Test your integration
Safe ways to test without a sandbox.
Hand conversations to your team
Support settings and the escalation API.
Webhooks for your store
What webhooks can do for your team.