Webhook reference
The events ab.one sends, their exact payloads and headers, how to check the signature, and how delivery works.
A webhook is a POST request that ab.one sends to your endpoint when something happens in a test. You set it up on the test's Settings tab, under Webhooks: switch on Enable webhooks, enter the Endpoint URL and a Signing secret, pick the events and click Save webhook. The steps are in Scheduled reports and webhooks.
Each test has its own webhook. To get events for several tests, set up the webhook on each of them; they can all point to the same endpoint. There's no store-wide webhook in the app, and webhooks can't be set up through the REST API.
The request
POST /your/endpoint HTTP/1.1
Content-Type: application/json
X-Abone-Event: test_ended
X-Abone-Signature: sha256=5d41402abc4b2a76b9719d911017c592…
{"event":"test_ended","testId":"3f1c2a9e-…","storeId":"9a2e…","data":{"testId":"3f1c2a9e-…","status":"ended"},"sentAt":"2026-11-02T09:14:03.120Z"}
Headers
| Header | Value |
|---|---|
Content-Type | application/json |
X-Abone-Event | The event name, the same as event in the body. |
X-Abone-Signature | sha256= followed by the HMAC-SHA256 of the raw body, as lowercase hex, with your signing secret as the key. Only sent when the webhook has a signing secret. |
Body
| Field | Type | What it is |
|---|---|---|
event | string | test_started, test_ended, winner_declared or significance_reached. |
testId | string | The test's ID. Use it with GET /tests/:testId to fetch the current results. |
storeId | string | ab.one's ID for the store. |
data | object | Details of the event. Its fields depend on the event and on what caused it, see below. |
sentAt | string | When ab.one sent the request (ISO 8601, UTC). |
Events
test_started
"data": { "testId": "3f1c2a9e-…", "status": "live" }
Sent when someone sets the test live with one of these buttons:
- Launch now on a scheduled test's page
- Resume on a paused test's page
- ⋮ → Start test or Resume in the test list
test_ended
When someone ends the test with End test:
"data": { "testId": "3f1c2a9e-…", "status": "ended" }
When the test ends on its own:
"data": { "reason": "significance" }
reason | Why the test ended |
|---|---|
significance | Stop when significant was on and the result became reliable. A significance_reached event is sent too. |
visitor_cap | Stop after visitors was set and the test reached that number. |
Check which form you got: data.status is only there when someone ended the test, data.reason only when it ended on its own. testId is always at the top level of the body.
Declaring a winner also ends the test, but sends only winner_declared, not test_ended. Ending a test through the MCP server sends nothing.
winner_declared
"data": { "testId": "3f1c2a9e-…", "variantId": "b71d5e3a-…" }
Sent when someone clicks Declare winner on the test page. variantId is the winning version, which can be the control. It's the same ID as variants[].id in the REST API. See End a test and apply the winner.
significance_reached
"data": { "confidence": 96.84, "winner": "b71d5e3a-…" }
Sent when a test ends on its own because it reached significance, together with test_ended (reason: "significance"). This only happens for tests with one variant and Stop when significant switched on, after the minimum test duration.
| Field | What it is |
|---|---|
confidence | How sure ab.one is that the winner is better, in percent (0 to 100, not rounded). See Statistics. |
winner | The ID of the winning version, which can be the control. null if it couldn't be determined. |
Check the signature
Compute the HMAC-SHA256 of the raw request body with your signing secret and compare it with the X-Abone-Signature header. Use the body exactly as received: if you parse the JSON and serialize it again, the bytes change and the signature won't match. Compare in constant time.
Without a signing secret there's no signature header, and anyone who knows your endpoint URL can send fake requests to it. Always set a secret.
Node.js (Express)
import crypto from "node:crypto";
import express from "express";
const app = express();
const SECRET = process.env.ABONE_WEBHOOK_SECRET;
function isFromAbone(rawBody, header) {
const expected = "sha256=" + crypto.createHmac("sha256", SECRET).update(rawBody).digest("hex");
const a = Buffer.from(expected);
const b = Buffer.from(header ?? "");
return a.length === b.length && crypto.timingSafeEqual(a, b);
}
// express.raw keeps the body as a Buffer, so the signature can be checked.
app.post("/webhooks/abone", express.raw({ type: "application/json" }), (req, res) => {
if (!isFromAbone(req.body, req.get("X-Abone-Signature"))) {
return res.status(401).end();
}
res.status(204).end(); // answer first, work afterwards
const { event, testId, data } = JSON.parse(req.body.toString("utf8"));
// … queue your own processing here
});
app.listen(3000);
Python (Flask)
import hashlib
import hmac
import json
import os
from flask import Flask, abort, request
app = Flask(__name__)
SECRET = os.environ["ABONE_WEBHOOK_SECRET"].encode()
def is_from_abone(raw_body: bytes, header: str | None) -> bool:
expected = "sha256=" + hmac.new(SECRET, raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, header or "")
@app.post("/webhooks/abone")
def abone_webhook():
raw = request.get_data() # the raw bytes, before any parsing
if not is_from_abone(raw, request.headers.get("X-Abone-Signature")):
abort(401)
payload = json.loads(raw)
# … queue your own processing here
return "", 204
PHP
<?php
$secret = getenv('ABONE_WEBHOOK_SECRET');
$raw = file_get_contents('php://input');
$expected = 'sha256=' . hash_hmac('sha256', $raw, $secret);
if (!hash_equals($expected, $_SERVER['HTTP_X_ABONE_SIGNATURE'] ?? '')) {
http_response_code(401);
exit;
}
$payload = json_decode($raw, true);
http_response_code(204);
Delivery
- One attempt. ab.one sends each request once.
- 5 second timeout. If your endpoint doesn't answer within 5 seconds, the request is dropped.
- No retries. Errors, timeouts and non-2xx answers aren't retried, and ab.one doesn't keep a delivery log.
- Answer fast. Return a 2xx status straight away and do the real work afterwards, for example in a queue.
Because a message can be lost, don't use webhooks as your only record. Treat a webhook as a signal to fetch the test's current state from the REST API, and run a periodic check as a fallback.
Duplicates and idempotency
The body has no unique event ID. Make your handler safe to run twice for the same event:
- Use
eventplustestIdas the key. An ended test can't be started again, sotest_ended,winner_declaredandsignificance_reachedmean the same thing each time they arrive for a test. Skip the ones you've already handled. test_startedcan come more than once for the same test, for example after a pause. Compare with the state you stored last instead of acting blindly.- Don't use
sentAtto detect duplicates: it's set fresh for every request.