Docs Guides
Webhooks
Signed, retried event delivery, with every event and its payload.
Every state change writes an event in the same transaction as the change, so an event exists if and only if the change committed. A dispatcher delivers events to the endpoints you register.
Webhooks notify. To act on one, call the API.
Register an endpoint#
curl -X POST "$LMS_URL/api/v1/webhook-endpoints" \
-H "X-API-Key: $LMS_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://api.example.com/lms/events",
"eventTypes": [
"enrollment.completed",
"certificate.issued"
]
}'const LMS_URL = process.env.LMS_URL
const LMS_KEY = process.env.LMS_KEY
const res = await fetch(`${LMS_URL}/api/v1/webhook-endpoints`, {
method: 'POST',
headers: { "X-API-Key": LMS_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
"url": "https://api.example.com/lms/events",
"eventTypes": [
"enrollment.completed",
"certificate.issued"
]
}),
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)
const data = await res.json()const LMS_URL = process.env.LMS_URL!
const LMS_KEY = process.env.LMS_KEY!
const res = await fetch(`${LMS_URL}/api/v1/webhook-endpoints`, {
method: 'POST',
headers: { "X-API-Key": LMS_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
"url": "https://api.example.com/lms/events",
"eventTypes": [
"enrollment.completed",
"certificate.issued"
]
}),
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)
const data: unknown = await res.json()import os
import requests
LMS_URL = os.environ["LMS_URL"]
HEADERS = {"X-API-Key": os.environ["LMS_KEY"]}
res = requests.post(f"{LMS_URL}/api/v1/webhook-endpoints", headers=HEADERS, json={
"url": "https://api.example.com/lms/events",
"eventTypes": [
"enrollment.completed",
"certificate.issued",
],
}, timeout=10)
res.raise_for_status()
data = res.json()import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Request {
public static void main(String[] args) throws Exception {
String lmsUrl = System.getenv("LMS_URL");
String lmsKey = System.getenv("LMS_KEY");
String body = """
{
"url": "https://api.example.com/lms/events",
"eventTypes": [
"enrollment.completed",
"certificate.issued"
]
}
""";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/webhook-endpoints"))
.header("X-API-Key", lmsKey)
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(body))
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() >= 300) throw new IllegalStateException(response.statusCode() + " " + response.body());
System.out.println(response.body());
}
}require "net/http"
require "json"
lms_url = ENV.fetch("LMS_URL")
uri = URI("#{lms_url}/api/v1/webhook-endpoints")
request = Net::HTTP::Post.new(uri, "X-API-Key" => ENV.fetch("LMS_KEY"), "Content-Type" => "application/json")
request.body = {
"url" => "https://api.example.com/lms/events",
"eventTypes" => [
"enrollment.completed",
"certificate.issued",
],
}.to_json
response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(request) }
raise "#{response.code} #{response.body}" unless response.is_a?(Net::HTTPSuccess)
data = JSON.parse(response.body)<?php
$lmsUrl = getenv('LMS_URL');
$ch = curl_init("$lmsUrl/api/v1/webhook-endpoints");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-Key: ' . getenv('LMS_KEY'), 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
"url" => "https://api.example.com/lms/events",
"eventTypes" => [
"enrollment.completed",
"certificate.issued",
],
]),
]);
$response = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 300) {
throw new RuntimeException($response);
}
$data = json_decode($response, true);package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader(`{
"url": "https://api.example.com/lms/events",
"eventTypes": [
"enrollment.completed",
"certificate.issued"
]
}`)
req, _ := http.NewRequest("POST", os.Getenv("LMS_URL") + "/api/v1/webhook-endpoints", body)
req.Header.Set("X-API-Key", os.Getenv("LMS_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, _ := io.ReadAll(res.Body)
if res.StatusCode >= 300 {
panic(fmt.Sprintf("%d %s", res.StatusCode, data))
}
fmt.Println(string(data))
}Use ["*"] for everything. The response includes the signing secret (whsec_…) once. The URL must be https and must not resolve to a private, loopback or link-local address.
What you receive#
POST with Content-Type: application/json and these headers:
| Header | Meaning |
|---|---|
X-NoBS-Event |
The event type |
X-NoBS-Delivery |
This delivery’s id |
X-NoBS-Signature |
t=<unix seconds>,v1=<hex> |
{
"id": "6f1c0b9e-3a52-4d7e-8b14-9c2e7a05d3f8",
"type": "enrollment.completed",
"occurredAt": "2026-11-25T14:03:11Z",
"tenantId": "0d7e4c2a-91b3-4f6a-8e05-b7c19a3d5e42",
"data": { "userId": "…", "courseId": "…" }
}
Verify the signature#
v1 = HMAC_SHA256(secret, t + "." + rawBody). Use the raw request body, not re-serialised JSON, and reject timestamps more than a few minutes old.
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 age = Math.abs(Date.now() / 1000 - Number(parts.t))
if (!parts.t || !parts.v1 || age > toleranceSeconds) return false
const expected = createHmac('sha256', secret).update(`${parts.t}.${rawBody}`).digest('hex')
const a = Buffer.from(expected), b = Buffer.from(parts.v1)
return a.length === b.length && timingSafeEqual(a, b)
}import { createHmac, timingSafeEqual } from 'node:crypto'
export function verify(rawBody: string | Buffer, header: string, secret: string, toleranceSeconds = 300): boolean {
const parts = Object.fromEntries(header.split(',').map((p) => p.split('='))) as Record<string, string | undefined>
const age = Math.abs(Date.now() / 1000 - Number(parts.t))
if (!parts.t || !parts.v1 || age > toleranceSeconds) return false
const expected = createHmac('sha256', secret).update(`${parts.t}.${rawBody}`).digest('hex')
const a = Buffer.from(expected), b = Buffer.from(parts.v1)
return a.length === b.length && timingSafeEqual(a, b)
}import hmac, hashlib, time
def verify(raw_body: bytes, header: str, secret: str, tolerance=300) -> bool:
parts = dict(p.split("=", 1) for p in header.split(","))
if "t" not in parts or "v1" not in parts or abs(time.time() - int(parts["t"])) > tolerance:
return False
expected = hmac.new(secret.encode(), f"{parts['t']}.".encode() + raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, parts["v1"])import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.util.HashMap;
import java.util.HexFormat;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
public class Webhook {
public static boolean verify(String rawBody, String header, String secret, long toleranceSeconds) throws Exception {
var parts = new HashMap<String, String>();
for (String p : header.split(",")) {
String[] kv = p.split("=", 2);
if (kv.length == 2) parts.put(kv[0], kv[1]);
}
if (!parts.containsKey("t") || !parts.containsKey("v1")) return false;
if (Math.abs(System.currentTimeMillis() / 1000 - Long.parseLong(parts.get("t"))) > toleranceSeconds) return false;
Mac mac = Mac.getInstance("HmacSHA256");
mac.init(new SecretKeySpec(secret.getBytes(StandardCharsets.UTF_8), "HmacSHA256"));
byte[] expected = mac.doFinal((parts.get("t") + "." + rawBody).getBytes(StandardCharsets.UTF_8));
return MessageDigest.isEqual(
HexFormat.of().formatHex(expected).getBytes(StandardCharsets.UTF_8),
parts.get("v1").getBytes(StandardCharsets.UTF_8));
}
}require "openssl"
def verify(raw_body, header, secret, tolerance = 300)
parts = header.split(",").map { |p| p.split("=", 2) }.to_h
return false unless parts["t"] && parts["v1"]
return false if (Time.now.to_i - parts["t"].to_i).abs > tolerance
expected = OpenSSL::HMAC.hexdigest("SHA256", secret, "#{parts['t']}.#{raw_body}")
expected.bytesize == parts["v1"].bytesize && OpenSSL.fixed_length_secure_compare(expected, parts["v1"])
end<?php
function verify(string $rawBody, string $header, string $secret, int $tolerance = 300): bool
{
parse_str(str_replace(',', '&', $header), $parts);
if (!isset($parts['t'], $parts['v1']) || abs(time() - (int) $parts['t']) > $tolerance) {
return false;
}
$expected = hash_hmac('sha256', $parts['t'] . '.' . $rawBody, $secret);
return hash_equals($expected, $parts['v1']);
}package webhook
import (
"crypto/hmac"
"crypto/sha256"
"encoding/hex"
"math"
"strconv"
"strings"
"time"
)
func Verify(rawBody []byte, header, secret string, tolerance time.Duration) bool {
parts := map[string]string{}
for _, p := range strings.Split(header, ",") {
if k, v, ok := strings.Cut(p, "="); ok {
parts[k] = v
}
}
t, err := strconv.ParseInt(parts["t"], 10, 64)
if err != nil || parts["v1"] == "" || math.Abs(float64(time.Now().Unix()-t)) > tolerance.Seconds() {
return false
}
mac := hmac.New(sha256.New, []byte(secret))
mac.Write([]byte(parts["t"] + "."))
mac.Write(rawBody)
return hmac.Equal([]byte(hex.EncodeToString(mac.Sum(nil))), []byte(parts["v1"]))
}# A one-off check from a shell. BODY is the exact raw request body, HEADER the X-NoBS-Signature value.
T=${HEADER#t=}; T=${T%%,*}
EXPECTED=$(printf '%s.%s' "$T" "$BODY" | openssl dgst -sha256 -hmac "$SECRET" -hex | sed 's/^.* //')
AGE=$(( $(date +%s) - T )) # reject anything more than 5 minutes old
[ "$EXPECTED" = "${HEADER##*v1=}" ] && [ "${AGE#-}" -le 300 ] && echo valid || echo invalidDelivery guarantees#
- At least once. Use the event
idto de-duplicate; it is stable across retries. - A
2xxis success. Anything else, or a timeout, is retried after 1 minute, 5 minutes, 30 minutes, 2 hours, then 12 hours. After 6 attempts the delivery isFAILED. - Redirects are not followed.
- See history at
GET /webhook-endpoints/{id}/deliveries, and test withPOST /webhook-endpoints/{id}/ping.
Event catalog#
GET /event-types returns this list.
| Type | When | data |
|---|---|---|
course.created |
Course created | slug |
course.version.created |
New draft started | version |
course.published |
Draft published | slug, version |
license.created |
License granted | organizationId, productId |
invitation.created |
Invitation sent | organizationId, email |
invitation.accepted |
Invitee joined | organizationId, userId |
member.updated |
Access or role changed | organizationId, userId, access, roleId |
member.removed |
Member removed | organizationId, userId |
enrollment.created |
Learner enrolled | userId, courseId, organizationId, source |
enrollment.withdrawn |
Enrollment withdrawn | userId, courseId |
enrollment.completed |
Completion rule met | userId, courseId |
enrollment.expired |
Access ran past expiresAt |
userId, courseId |
lesson.completed |
Lesson completed | userId, courseId, lessonId |
attempt.submitted |
Quiz submitted or timed out | userId, assessmentId, attemptId, needsGrading |
attempt.graded |
Final score available | userId, assessmentId, attemptId, scorePercent, passed |
certificate.issued |
Certificate issued | userId, courseId, serial, enrollmentId |
certificate.revoked |
Certificate revoked | userId, serial, reason |
webhook.ping |
Test delivery | message |