Skip to content
Help
Go to Learnient(opens in a new tab)

Sending webhooks to your systems

A webhook is Learnient calling you. When something happens — a user is created, a course is published — Learnient sends an HTTP request to an address you own, so your system finds out immediately instead of asking repeatedly.

The Learnient webhook reference lists every event with its exact payload, how to verify the signature on each request, and how retries work. This article covers setting webhooks up in Learnient; the reference is what your developers build against.

Choose Admin, then Integrations and Webhooks.

  1. Choose New webhook.
  2. Give it a name that says which system it feeds.
  3. Enter the URL Learnient should call. It has to be reachable from the internet — a machine on your office network is not.
  4. Choose the events that should trigger it.
  5. Save.

Learnient then shows the webhook’s Signing secret, once. Copy it into the system receiving the webhook, which uses it to check that each request really came from Learnient. It won’t be shown again; if you lose it, rotate it.

Events are grouped by what they are about:

GroupEvents
PeopleCreated, updated, deactivated, reactivated, deleted
Your organisationDepartments, locations, job titles, skills, groups and course categories: created, updated, deleted
CoursesCreated, updated, published, unpublished, archived, deleted
EnrolmentsEnrolled, removed, deadline missed
LearningStarted, completed, passed, failed, certificate awarded, completion held for sign-off, sign-off rejected
Learning pathsEnrolled, unenrolled, completed
PracticeA practice session completed, in a course or with Lenni. The payload says which in started_from (course or lenni), with the course in course_id for course practice

While Skills is Off in Features, the skills events can’t be chosen and aren’t sent. A webhook already subscribed to them keeps its subscription and sends again once Skills is back, but nothing is sent for skills changed meanwhile. See Choosing which features your organisation uses.

A person archived automatically on their leaving date sends the deactivated event, just as one you archive yourself does.

Every people event carries the person’s mobile number beside their email, in international format such as +447911123456, or empty when they have none. Changing someone’s number sends the updated event.

Enrolment, course, learning path and practice events carry the learner’s mobile number the same way, as user_mobile_number beside user_email (learner_mobile_number beside learner_email on practice events).

The exact event names and every field each one sends are in the webhook reference.

Webhook events for course completion and sign-off

Section titled “Webhook events for course completion and sign-off”

Learning events tell you what happens on a learner’s course. Two cover the post-course process:

EventFires when
course.completion_heldA learner finished the content, and the course is waiting for a sign-off or attestation — useful for booking the observation
course.signoff_rejectedA qualified person did not sign the learner off; the reason is included. The attempt closes as failed, so course.failed is sent too, with completion_release_source set to not_signed_off, and the learner takes the course again

course.completed and course.passed fire when a course actually completes — for a held course, that is when it is signed off, not when the content was finished. Their payloads include completion_release_source, which says how it was completed: not_required, process_completed, requirement_withdrawn, imported_with_signoff or imported_without_signoff. On course.failed it can also be not_signed_off.

Subscribe to what you will act on. A webhook firing into a system that ignores it is a queue of deliveries nobody reads and a source of noise when one fails.

Deliveries, and what happens when one fails

Section titled “Deliveries, and what happens when one fails”

Every send is recorded with the attempt number, the response code your endpoint returned, and whether it succeeded.

A failed delivery is retried rather than dropped, with a time recorded for the next attempt.

Two consequences worth designing for:

Your endpoint must answer quickly. Learnient is waiting on a response, so do the minimum — accept the payload, put it on your own queue, answer. Work done before answering is work done while a timeout runs.

Your endpoint must tolerate the same event arriving twice. A retry after a response that never arrived delivers an event you already processed. Each delivery carries an event identifier, so the safe pattern is to record what you have handled and ignore repeats.

Choose View log in a webhook’s actions menu to see its deliveries. Open a delivery to see what was sent and what came back.

  • Delete log entry, the red bin at the foot of an open delivery, removes that one entry from the webhook’s history.
  • Delete all log entries, the red bin at the foot of the log, removes every entry. Its confirmation asks first and counts what goes under Deleted, as Log entries.

Both end with “This can’t be undone.” Deleting log entries doesn’t change the webhook or stop it sending.

Choose Delete in the webhook’s actions menu. Delete webhook names it, says events are no longer sent to its endpoint URL, and that it can’t be undone.

Rotate a webhook’s signing secret when it may have been exposed, when someone who knew it has left, or when you have lost it. Choose Rotate secret in the webhook’s actions menu. Rotate signing secret names the webhook and warns that the current secret stops working, so every system that checks it needs the new one.

Choose Rotate secret to confirm. The new Signing secret is shown once: copy it into your receiving system straight away. Until you do, that system will reject Learnient’s requests, because they are signed with the new secret.

Point a new webhook at a service that echoes what it receives before pointing it at anything real. That tells you the shape of the payload and confirms the address is reachable, which are the two things that go wrong first.

Use a webhook when you want to know the moment something happens and you own an address Learnient can reach. Use the Learnient Public API with an API key when your system needs to ask Learnient questions on its own schedule, or when nothing of yours is reachable from the internet.

Most integrations end up using both: webhooks to know something changed, the API to fetch the detail.

The webhook starts firing on the next matching event. Nothing is sent for events that happened before you created it, so a webhook is not a way to backfill — that is what the API is for.