Webhooks in Schoox

Review note: text in green is new or changed compared with the currently published article. Remove the green color before publishing.

Introduction

The Webhooks service lets Schoox provide third-party applications with real-time information. A webhook delivers data to your application as the event happens. With a typical API, you must poll for data frequently to stay close to real time. Webhooks are more efficient for both the producer (Schoox) and the consumers (your third-party applications).

Diagram comparing API polling with webhook delivery

Before You Start

  • Webhooks are off by default. Ask your Schoox representative to enable them for your academy.
  • Academy admins manage webhooks: endpoints and security policies.
  • Where to find them: Admin (top navigation bar) → Webhooks → Endpoints or Security Policies.
  • Some events are offered only when the matching feature is on: Skill, Skill Group and Skill Category events need Performance & Career; micro course and micro step association events need Microlearning; micro assessment association events need Micro Assessments.
  • Creating, editing, activating, deactivating and deleting endpoints and security policies is recorded in the academy audit log, under the Webhooks label.

Webhook Events

An endpoint subscribes to one or more of the events below. The Payload column lists the keys of the payload object for that event. Each key is described under Entity Payload Schema.

User

Event Triggered when Payload
user.created A user is created user
user.deactivated A user is deactivated user

Course

Event Triggered when Payload
course.created A course is created course
course.updated A course is updated course
course.updated.visibility A course’s visibility changes course
course.updated.status A course’s status changes course
course.user.assigned A course is assigned to a user course, user
course.user.progress A user makes progress on a course course, user, courseProgress
course.user.completed A user completes a course course, user, courseProgress
course.certificate.awarded A user earns a course certificate, including a renewal course, user, courseCertification
course.certificate.updated A certificate’s award or expiration date changes, or an expired certificate is reactivated course, user, courseCertification
course.certificate.expiring A certificate enters the course’s re-assign period before it expires course, user, courseCertification
course.certificate.expired A certificate expires, including when a renewal replaces it course, user, courseCertification
course.certificate.deleted A certificate is deleted course, user, courseCertificationDeleted

A renewal issues a new certificate with a new id. You receive course.certificate.awarded for the new certificate and, if the old one hadn’t expired yet, course.certificate.expired for the old one, in either order. Track certificates by courseCertification.id.

One action can send several events. For example, changing a completion date so that the certificate is already expired sends course.certificate.updated and course.certificate.expired.

Certificates created or removed by a transcript import, a user merge or a permanent user deletion don’t send certificate events.

Curriculum

Event Triggered when Payload
curriculum.created A curriculum is created curriculum
curriculum.updated A curriculum is updated curriculum
curriculum.updated.visibility A curriculum’s visibility changes curriculum
curriculum.updated.status A curriculum’s status changes curriculum
curriculum.deleted A curriculum is deleted curriculumDeleted
curriculum.user.assigned A curriculum is assigned to a user curriculum, user
curriculum.user.progress A user makes progress on a curriculum curriculum, user, curriculumProgress
curriculum.user.completed A user completes a curriculum curriculum, user, curriculumProgress

ILT Event

Event Triggered when Payload
ilt.event.created An ILT event is created iltEvent
ilt.event.updated An ILT event is updated iltEvent
ilt.event.updated.status An ILT event’s status changes iltEvent

On-the-Job Training

Event Triggered when Payload
ojt.trainee.signed A trainee signs an on-the-job training onTheJobTraining, user

Skill

Event Triggered when Payload
skill.created A skill is created skill
skill.updated A skill is updated skill
skill.deleted A skill is deleted skillDeleted
skill.user.assigned A skill is assigned to a user skill, user
skill.user.unassigned A skill is unassigned from a user skill, user

Skill Associations

Event Triggered when Payload
skill.course.association.created A skill is linked to a course skill, course, skillCourseAssociation
skill.course.association.deleted A skill is unlinked from a course skill, course
skill.job.association.created A skill is linked to a job skill, job, skillJobAssociation
skill.job.association.updated A skill–job link changes skill, job, skillJobAssociation
skill.job.association.deleted A skill is unlinked from a job skill, job
skill.exam.question.association.created A skill is linked to an exam question skill, examQuestion, skillExamQuestionAssociation
skill.exam.question.association.deleted A skill is unlinked from an exam question skill, examQuestion
skill.category.association.created A skill is added to a skill category skill, skillCategory
skill.category.association.deleted A skill is removed from a skill category skill, skillCategory
skill.micro.course.association.created A skill is linked to a micro course skill, microCourse, skillMicroCourseAssociation
skill.micro.course.association.updated A skill–micro course link changes skill, microCourse, skillMicroCourseAssociation
skill.micro.course.association.deleted A skill is unlinked from a micro course skill, microCourse
skill.micro.step.association.created A skill is linked to a micro step skill, microStep, skillMicroStepAssociation
skill.micro.step.association.updated A skill–micro step link changes skill, microStep, skillMicroStepAssociation
skill.micro.step.association.deleted A skill is unlinked from a micro step skill, microStep
skill.micro.assessment.association.created A skill is linked to a micro assessment skill, microAssessment, skillMicroAssessmentAssociation
skill.micro.assessment.association.updated A skill–micro assessment link changes skill, microAssessment, skillMicroAssessmentAssociation
skill.micro.assessment.association.deleted A skill is unlinked from a micro assessment skill, microAssessment
skill.micro.assessment.step.association.created A skill is linked to a micro assessment step skill, microAssessmentStep, skillMicroAssessmentStepAssociation
skill.micro.assessment.step.association.updated A skill–micro assessment step link changes skill, microAssessmentStep, skillMicroAssessmentStepAssociation
skill.micro.assessment.step.association.deleted A skill is unlinked from a micro assessment step skill, microAssessmentStep

Skill Group

Event Triggered when Payload
skill.group.created A skill group is created skillGroup
skill.group.updated A skill group is updated skillGroup
skill.group.deleted A skill group is deleted skillGroupDeleted
skill.group.skill.added A skill is added to a skill group skillGroup, skill
skill.group.skill.removed A skill is removed from a skill group skillGroup, skill

Skill Category

Event Triggered when Payload
skill.category.created A skill category is created skillCategory
skill.category.updated A skill category is updated skillCategory
skill.category.deleted A skill category is deleted skillCategoryDeleted

Security Policies

A security policy tells Schoox how to authenticate to your endpoint. An academy can have several security policies, and each endpoint can use one of them (optional).

Creating a Security Policy

  1. Select Admin in the top navigation bar. Under Webhooks on the left, select Security Policies, then click Add New.
  2. Enter a Name (required) and, optionally, a Description.
  3. Choose the Authentication Type and fill in its fields (see below).
  4. Click Save.

Authentication Types

Type Fields What Schoox sends
BASIC Username, Password HTTP Basic authentication: Authorization: Basic <base64(username:password)>
DIGEST Username, Password HTTP Digest authentication (challenge–response)
NTLM Username, Password NTLM authentication (challenge–response)
TOKEN Token, Token prefix (optional, for example Bearer) Authorization: <prefix> <token>, or just the token when no prefix is set
OAUTH See OAuth Configuration Authorization: Bearer <access_token>, using a token obtained with the client credentials grant

Passwords, tokens and client secrets are stored encrypted.

A security policy can’t be deleted while an endpoint uses it. Remove it from those endpoints, or delete them, first.

OAuth Configuration

Field Required Description
OAuth URL Yes The token endpoint URL
Client ID Yes Sent as client_id
Client Secret Yes Sent as client_secret
Grant Type Yes client_credentials, sent as grant_type
Audience No Sent as audience when set
Scope No Sent as scope when set
Resource No Saved with the policy, but currently not sent in the token request
Extra Headers No Additional HTTP headers (key/value pairs) added to the token request

Schoox requests the token with a POST to the OAuth URL, sending the fields above as an application/x-www-form-urlencoded body. The response must be JSON containing access_token and expires_in (seconds). Schoox reuses the token until expires_in has passed, then requests a new one.

Each time you save an OAuth security policy, and each time you open one for editing, Schoox requests a token to check the settings. The page then shows either A token has been successfully generated! or A token has not been created. Please check your credentials!

If Schoox can’t get a token while sending a webhook, that attempt counts as failed and is retried (see Request Failure Handling).

Webhook Endpoints

Endpoints are the URLs that Schoox sends events to. Every endpoint is bound to one or more events. When an event happens, Schoox sends it to every active endpoint subscribed to that event.

Creating an Endpoint

  1. Select Admin in the top navigation bar. Under Webhooks on the left, select Endpoints, then click Add New.
  2. Fill in the fields below and select each event the endpoint should receive.
  3. Click Save.
  4. Turn on the status toggle in the endpoints list. Endpoints are inactive by default, and an inactive endpoint receives nothing.
Field Required Notes
Endpoint Name Yes A visual identifier for telling endpoints apart
Endpoint URL Yes The URL that receives the events. Must start with https://
Description No  
Events Yes At least one event
Security Policy No How Schoox authenticates to the URL

Signing Secret

Every endpoint has its own signing secret, generated automatically when the endpoint is created. It has the form whsec_ followed by 32 characters. Use it to verify messages (see Verifying Webhook Messages).

To see it, open the endpoint from the endpoints list and click Edit. The Secret field is hidden: click the eye icon to show it, or the copy icon to copy it.

The secret can’t be changed or regenerated. To rotate it, replace the endpoint:

  1. Create a new endpoint with the same URL, events and security policy. It starts inactive. Copy its secret.
  2. Update your receiver to accept a signature made with either the old or the new secret.
  3. Activate the new endpoint, then delete the old one. While both are active, each event arrives twice with the same wh-id, so your duplicate check drops the second copy.
  4. Remove the old secret from your receiver.

Managing Endpoints

  • Open an endpoint from the endpoints list to Edit or Delete it. Use the status toggle in the list to activate or deactivate it.
  • Events that happen while an endpoint is inactive are not sent to it, and are not sent later when you activate it again.
  • Deactivating or deleting an endpoint also stops the deliveries still pending for it, including retries.
  • Changes to an endpoint’s URL, events or security policy also apply to its pending deliveries and retries.
  • Deleting an endpoint can’t be undone. Deactivate it instead if you might need it again.

Delivery

  • Schoox sends an HTTP POST with a JSON body (Content-Type: application/json, User-Agent: SchooxWebhooks/1.0), the three signature headers, and the authentication from the endpoint’s security policy.
  • A response with a 2xx status code within 60 seconds counts as delivered.
  • Any other status code, a timeout or a connection error counts as failed. Redirects are not followed, so a 3xx response also counts as failed.
  • Respond with 2xx as soon as you have received the message, and do any heavy processing asynchronously.

Source IP Addresses

Schoox sends webhooks from fixed IP addresses. If your endpoint accepts traffic only from known addresses, allow the address for the region your academy is hosted in.

Region Production Staging
United States 18.214.29.122 18.208.1.244
United Kingdom 35.177.213.13 3.11.78.75
Canada 15.222.227.57 52.60.245.18

Request Failure Handling

A failed event is attempted at most 5 times in total: the first attempt plus up to 4 retries, 5 minutes apart. Retries are picked up by a scheduler that runs every minute, so the actual gap can be slightly longer. After the fifth failed attempt the event is not sent again.

  • Every attempt carries the same wh-id, but a new wh-timestamp and wh-signature.
  • Delivery is at-least-once: the same event can arrive more than once. Use wh-id to skip duplicates.
  • Events are not guaranteed to arrive in the order they happened.

Consuming Webhooks

Base Schema

Every webhook has the same JSON body:

{
    "event": "course.updated.visibility",
    "payload": {
        ...
    }
}
  • event is the name of the event that happened.
  • payload holds one key per entity, as listed for each event under Webhook Events.

Example

A course.user.completed webhook. The body is shown formatted for reading; the real body is compact JSON with no extra whitespace.

{
    "event": "course.user.completed",
    "payload": {
        "course": {
            "id": 412345,
            "title": "Food Safety Basics",
            "description": "Introduction to safe food handling.",
            "externalId": "FS-101",
            "image": "https://example.com/images/food-safety.jpg",
            "status": "ACTIVE",
            "visibilityStatus": "PUBLIC"
        },
        "user": {
            "id": 9876543,
            "firstName": "Jane",
            "lastName": "Doe",
            "userName": "jdoe",
            "email": "jane.doe@example.com",
            "externalIds": ["EMP-0042"]
        },
        "courseProgress": {
            "progress": 100,
            "completionDate": "2026-10-30T14:05:00+00:00",
            "certificationVerificationCode": null
        }
    }
}

General Rules

  • Any field can be null, for example externalId when it is not set.
  • Fields of type datetime are ISO 8601 strings with a UTC offset, for example 2026-10-30T14:05:00+00:00.
  • Fields of type date string are passed through as stored in the database (YYYY-MM-DD HH:MM:SS, no timezone). They appear on Job, Exam Question and the four micro entities.
  • Delete events carry only the id of the deleted item (curriculumDeleted, skillDeleted, skillGroupDeleted, skillCategoryDeleted, courseCertificationDeleted). The course.certificate.deleted event also includes course and user.
  • Association “deleted” events carry the two items that were linked, but no association object.
  • Ignore fields you do not recognise.

Entity Payload Schema

Course (key: course)

Field Type Values / notes
id int  
title string  
description string  
externalId string  
image string Image URL
status string ACTIVE, ARCHIVED, RETIRED, DELETED
visibilityStatus string PUBLIC, PRIVATE

Course Progress (key: courseProgress)

Field Type Values / notes
progress int Completion percentage, 0–100
completionDate datetime  
certificationVerificationCode string Verification code of the certificate, when there is one

Course Certification (key: courseCertification)

Field Type Values / notes
id int Id of the certificate. A renewal issues a new certificate with a new id
verificationCode string Verification code of the certificate
certificationDate datetime When the certificate was awarded
expirationDate datetime When the certificate expires; null when it never expires
expired boolean true once the certificate has expired
expiring boolean true while the certificate is in the course’s re-assign period before it expires

Deleted Course Certification (key: courseCertificationDeleted)

Field Type Values / notes
id int Id of the deleted certificate

Curriculum (key: curriculum)

Field Type Values / notes
id int  
title string  
description string  
externalId string  
image string Image URL
status string ACTIVE, ARCHIVED
visibilityStatus string PUBLIC, PRIVATE

Curriculum Progress (key: curriculumProgress)

Field Type Values / notes
progress int Completion percentage, 0–100
completionDate datetime  
certificationVerificationCode string Verification code of the certificate, when there is one

Deleted Curriculum (key: curriculumDeleted)

Field Type Values / notes
id int Id of the deleted curriculum

ILT Event (key: iltEvent)

Field Type Values / notes
id int  
title string  
description string  
image string Image URL; a default image when none is set
status string ACTIVE, ARCHIVED, CANCELED, DELETED

On-the-Job Training (key: onTheJobTraining)

Field Type Values / notes
id int  
title string  

User (key: user)

Field Type Values / notes
id int  
firstName string  
lastName string  
userName string  
email string  
externalIds string array  

Skill (key: skill)

Field Type Values / notes
id int  
status string ACTIVE, ARCHIVED, DELETED
externalId string  
academyId int  
createdAt datetime  
updatedAt datetime  
translations array Skill Translation objects (below)

Skill Translation (items of skill.translations)

Field Type Values / notes
languageId int  
languageName string  
skillId int  
name string  
description string  

Deleted Skill (key: skillDeleted)

Field Type Values / notes
id int Id of the deleted skill

Skill Group (key: skillGroup)

Field Type Values / notes
id int  
name string  
externalId string  
academyId int  

Deleted Skill Group (key: skillGroupDeleted)

Field Type Values / notes
id int Id of the deleted skill group

Skill Category (key: skillCategory)

Field Type Values / notes
id int  
name string  
externalId string  
academyId int  

Deleted Skill Category (key: skillCategoryDeleted)

Field Type Values / notes
id int Id of the deleted skill category

Skill Course Association (key: skillCourseAssociation)

Field Type Values / notes
sourceType string Always COURSE
sourceId int Course id
academyId int  
skillId int  
createdAt datetime  

Skill Job Association (key: skillJobAssociation)

Field Type Values / notes
sourceType string Always JOB
sourceId int Job id
skillId int  
weight float  
createdAt datetime  

Skill Exam Question Association (key: skillExamQuestionAssociation)

Field Type Values / notes
sourceType string Always EXAM_QUESTION
sourceId int Id of the association record
examQuestionId int  
metricId int Skill id
academyId int  

Skill Micro Associations

Keys: skillMicroCourseAssociation, skillMicroStepAssociation, skillMicroAssessmentAssociation, skillMicroAssessmentStepAssociation. All four share this schema.

Field Type Values / notes
id int Id of the association record
sourceType string MICRO_COURSE, MICRO_STEP, MICRO_ASSESSMENT or MICRO_ASSESSMENT_STEP, matching the key
sourceId int Id of the micro course, micro step, micro assessment or micro assessment step
academyId int  
skillId int  
createdAt datetime  
creatorId int Id of the user who created the link

Job (key: job)

Field Type Values / notes
id int  
title string  
externalId string  
type string SIMPLE_JOB, ABOVE_MANAGERIAL_JOB, UNIT_MANAGERIAL_JOB
deletable boolean  
createdAt date string  
updatedAt date string  

Exam Question (key: examQuestion)

Field Type Values / notes
id int  
type string MULTIPLE_CHOICE, MULTIPLE_ANSWERS, TRUE_FALSE, FILL_IN_BLANKS, MATCHING, OPEN_ENDED, REVIEW
question string  
details string  
points int  
creatorId int  
academyId int  
modifiedAt date string  

Micro Course (key: microCourse)

Field Type Values / notes
id int  
title string  
description string  
externalId string  
visibility string PUBLIC, PRIVATE
status string ACTIVE, ARCHIVED, DELETED, DRAFT, COURSE_PLAN, MULTI_FORMAT
image string  
createdAt date string  
updatedAt date string  

Micro Step (key: microStep)

Field Type Values / notes
id int  
microCourseId int  
stepType string TITLE, TEXT, ASSESSMENT, TEXT_ASSESSMENT, IMAGE, IMAGE_ASSESSMENT, VIDEO, ACCORDION, TABS, PROCESS_STEPS, FLASHCARDS
stepOrder int  
visibility string PUBLIC, PRIVATE
createdAt date string  
updatedAt date string  

Micro Assessment (key: microAssessment)

Field Type Values / notes
id int  
title string  
description string  
externalId string  
status string ACTIVE, ARCHIVED, DELETED
image string  
createdAt date string  
updatedAt date string  

Micro Assessment Step (key: microAssessmentStep)

Field Type Values / notes
id int  
microAssessmentId int  
stepType string TITLE, ASSESSMENT
stepOrder int  
visibility string PUBLIC, PRIVATE
createdAt date string  
updatedAt date string  

Verifying Webhook Messages

Why

Attackers can impersonate the webhook service by sending fake data to an endpoint. To prevent this, Schoox signs every webhook with the endpoint’s signing secret, so the receiver can confirm the message came from Schoox.

An attacker could also capture a valid message and send it again later (a replay attack). Every attempt includes the time it was sent, so the receiver can reject messages outside a tolerance it chooses.

Without verification, an endpoint accepts anything posted to it. Always verify webhooks.

Headers

Each webhook call includes three headers:

Header Description
wh-id Unique id of the webhook message (24 hexadecimal characters). The same on every retry, so use it to skip duplicates.
wh-timestamp When this attempt was sent, in seconds since the Unix epoch (January 1, 1970 00:00:00 UTC). New on every attempt.
wh-signature v1,<signature>, where v1 is the signature version and <signature> is base64-encoded.

Steps

  1. Check that wh-timestamp is within your tolerance of the current time (for example 5 minutes).
  2. Build the signable string: wh-id, wh-timestamp and the request body, joined with dots: {wh-id}.{wh-timestamp}.{body}. Use the body exactly as received. Parsing and re-serializing the JSON changes the bytes, and the signature will no longer match.
  3. Take the endpoint’s signing secret and remove the whsec_ prefix. Use the remaining characters as the key exactly as they are (as UTF-8 text); do not base64-decode them. For whsec_QEMBXPKpqJdcCNHgFqiFdz7G0apKrSNP the key is QEMBXPKpqJdcCNHgFqiFdz7G0apKrSNP.
  4. Compute the HMAC-SHA256 of the signable string with that key, and base64-encode the result.
  5. Compare it with the part of wh-signature after v1,, using a constant-time comparison.

Example signable string:

6721f0c3a1b2c3d4e5f60718.1761833100.{"event":"course.created","payload":{"course":{...}}}

Code Samples

Each sample reads the raw body, checks the timestamp and verifies the signature. Replace the secret with your endpoint’s signing secret, and keep the secret out of source control in real code.

PHP

<?php
const SIGNING_SECRET = 'whsec_QEMBXPKpqJdcCNHgFqiFdz7G0apKrSNP'; // your endpoint's secret
const TOLERANCE_SECONDS = 300; // 5 minutes

$id        = $_SERVER['HTTP_WH_ID'] ?? '';        // header "wh-id"
$timestamp = $_SERVER['HTTP_WH_TIMESTAMP'] ?? ''; // header "wh-timestamp"
$header    = $_SERVER['HTTP_WH_SIGNATURE'] ?? ''; // header "wh-signature"
$body      = file_get_contents('php://input');    // raw body, never re-encoded

// 1. Reject old or future messages
if (!ctype_digit($timestamp) || abs(time() - (int)$timestamp) > TOLERANCE_SECONDS) {
    http_response_code(400);
    exit('Timestamp outside tolerance');
}

// 2-4. Sign "{id}.{timestamp}.{body}" with the secret minus its whsec_ prefix
$key      = substr(SIGNING_SECRET, strlen('whsec_'));
$expected = base64_encode(hash_hmac('sha256', "{$id}.{$timestamp}.{$body}", $key, true));

// 5. Constant-time compare with the part after "v1,"
[$version, $signature] = array_pad(explode(',', $header, 2), 2, '');
if ($version !== 'v1' || !hash_equals($expected, $signature)) {
    http_response_code(401);
    exit('Invalid signature');
}

$webhook = json_decode($body, true); // $webhook['event'], $webhook['payload']
http_response_code(200);

Node.js (Express)

const crypto = require('crypto');
const express = require('express');

const SIGNING_SECRET = 'whsec_QEMBXPKpqJdcCNHgFqiFdz7G0apKrSNP'; // your endpoint's secret
const TOLERANCE_SECONDS = 300; // 5 minutes

const app = express();

// express.raw keeps the body as the exact bytes Schoox sent
app.post('/schoox/webhooks', express.raw({ type: 'application/json' }), (req, res) => {
    const id = req.get('wh-id') || '';
    const timestamp = req.get('wh-timestamp') || '';
    const [version, signature = ''] = (req.get('wh-signature') || '').split(',');

    // 1. Reject old or future messages
    const now = Math.floor(Date.now() / 1000);
    if (!/^\d+$/.test(timestamp) || Math.abs(now - Number(timestamp)) > TOLERANCE_SECONDS) {
        return res.status(400).send('Timestamp outside tolerance');
    }

    // 2-4. Sign "{id}.{timestamp}.{body}" with the secret minus its whsec_ prefix
    const key = SIGNING_SECRET.slice('whsec_'.length);
    const expected = crypto.createHmac('sha256', key)
        .update(`${id}.${timestamp}.`)
        .update(req.body)
        .digest('base64');

    // 5. Constant-time compare with the part after "v1,"
    const a = Buffer.from(expected);
    const b = Buffer.from(signature);
    if (version !== 'v1' || a.length !== b.length || !crypto.timingSafeEqual(a, b)) {
        return res.status(401).send('Invalid signature');
    }

    const webhook = JSON.parse(req.body.toString('utf8')); // webhook.event, webhook.payload
    res.sendStatus(200);
});

app.listen(3000);

C# (ASP.NET Core)

using System.Security.Cryptography;
using System.Text;

const string SigningSecret = "whsec_QEMBXPKpqJdcCNHgFqiFdz7G0apKrSNP"; // your endpoint's secret
const long ToleranceSeconds = 300; // 5 minutes

var app = WebApplication.CreateBuilder(args).Build();

app.MapPost("/schoox/webhooks", async (HttpRequest request) =>
{
    var id = request.Headers["wh-id"].ToString();
    var timestamp = request.Headers["wh-timestamp"].ToString();
    var signatureHeader = request.Headers["wh-signature"].ToString();

    // 1. Reject old or future messages
    if (!long.TryParse(timestamp, out var sentAt)
        || Math.Abs(DateTimeOffset.UtcNow.ToUnixTimeSeconds() - sentAt) > ToleranceSeconds)
    {
        return Results.BadRequest("Timestamp outside tolerance");
    }

    // Read the raw body exactly as sent
    using var reader = new StreamReader(request.Body, Encoding.UTF8);
    var body = await reader.ReadToEndAsync();

    // 2-4. Sign "{id}.{timestamp}.{body}" with the secret minus its whsec_ prefix
    var key = Encoding.UTF8.GetBytes(SigningSecret["whsec_".Length..]);
    var expected = HMACSHA256.HashData(key, Encoding.UTF8.GetBytes($"{id}.{timestamp}.{body}"));

    // 5. Constant-time compare with the part after "v1,"
    var parts = signatureHeader.Split(',', 2);
    byte[] received;
    try { received = parts.Length == 2 ? Convert.FromBase64String(parts[1]) : Array.Empty<byte>(); }
    catch (FormatException) { received = Array.Empty<byte>(); }

    if (parts[0] != "v1" || !CryptographicOperations.FixedTimeEquals(expected, received))
    {
        return Results.Unauthorized();
    }

    // var webhook = System.Text.Json.JsonDocument.Parse(body);
    return Results.Ok();
});

app.Run();

Avoiding Webhook Loops

If your application calls the Schoox API in response to a webhook, that call can produce new webhooks. To stop this, send the header X-Schoox-Suppress-Webhooks: true on those API requests. The value must be exactly the lowercase string true; any other value is ignored. The header suppresses only the events your own request produces, including background work that request starts.

Was this article helpful?
0 out of 0 found this helpful