Webhook Models

This page documents the webhook data and payload.

Webhook

Each webhook comprises a JSON object in the form of a WebHookNotification. Within this object, different events have different payloads, see below.

interface WebHookNotification<T> {
  payload: T;
  webhook: WebHookNotificationData;
  timestamp: string; // DateTimeOffset
}

Webhook data

The WebhookNotificationData object has the form:

interface WebHookNotificationData {
  domainkey: number; // long
  eventkey: WebHookEventEnum;
  eventname:
    | "None"
    | "User_Create"
    | "User_Delete"
    | "Module_Start"
    | "Module_Complete"
    | "Module_Expiring"
    | "Module_Expired"
    | "Course_Complete"
    | "Course_Expiring"
    | "Course_Expired";
  target: string;
  created: string; // DateTimeOffset
}

Event enum

Events may be referred to by their name (e.g. Module_Complete) or the enum (e.g. Module_Complete = 4).

enum WebHookEventEnum {
  None = 0,
  User_Create = 1,
  User_Delete = 2,
  Module_Start = 3,
  Module_Complete = 4,
  Module_Expiring = 5,
  Module_Expired = 6,
  Course_Complete = 7,
  Course_Expiring = 8,
  Course_Expired = 9,
  Course_Published = 10,
}

Event payload

Each event type has a payload containing information to the event.

Event nameDetailsPayload type
Course_CompleteCompleted courseCourseCertificateNotificationData
Course_ExpiredExpired courseCourseCertificateNotificationData
Course_ExpiringExpiring courseCourseCertificateNotificationData
Course_PublishedPublished courseCoursePublishedNotificationData
Module_CompleteCompleted moduleModuleCertificateNotificationData
Module_ExpiredExpired moduleModuleCertificateNotificationData
Module_ExpiringExpiring moduleModuleCertificateNotificationData
Module_StartStarted modulePortfolioNotificationData
User_CreateDeleted userUserNotificationData
User_DeleteNew userUserNotificationData

Course Certificate payload

This payload applies to Course_Complete, Course_Expiring, and Course_Expired webhook events.

interface CourseCertificateNotificationData {
  userkey: number;
  username: string;
  coursekey: number;
  completed: string; // DateTimeOffset
  expires: string; // DateTimeOffset
}

Course Published payload

This payload applies to Course_Published webhook event.

interface CoursePublishedNotificationData {
  coursekey: number; // long;
  courseversion: number; // long;
  title: string;
  published: string; // DateTimeOffset;
}

Module Certificate payload

This payload applies to Module_Complete, Module_Expiring, and Module_Expired webhook events.

interface ModuleCertificateNotificationData {
  userkey: number;
  username: string;
  modulekey: number;
  completed: string; // DateTimeOffset
  expires: string; // DateTimeOffset
}

Portfolio payload

This payload applies to Module_Start webhook event.

interface PortfolioNotificationData {
    username: string;
    userkey: number; // long;
    modulekey: number; // long;
    layer: number; // int;

User payload

This payload applies to User_Create and User_Delete webhook events.

interface UserNotificationData {
  domainkey: number; // long;
  userkey: number; // long;
  username: string;
}