A webhook is a way for an app to provide other apps with real-time information. A webhook delivers data to other applications as it happens, meaning you can’t ignore this pretty cool feature, when you’re looking for immediate notifications and data synchronization.

How do webhooks work?

Webhooks are basically user defined HTTP callbacks (or small code snippets linked to a web app) which are triggered by specific events. Whenever that trigger event occurs in the source site, the webhook sees the event, collects the data, and sends it to the URL specified in the form of a HTTP request. 

To put it in a nutshell, the benefits of webhooks are instant, real-time notifications.

Do I need to use webhooks?

In case xApi or SCORM standards do not really suit your needs, and you have your own web server, webhooks can be a solution for you. You need to implement a HTTP endpoint on your web server where you will receive requests with learners’ results.

Note: You should implement your endpoint with the HTTPS protocol.

How do I add webhooks to my course?

Go to the Configure step > Results tracking > Advanced settings and choose the option “Report to: webhooks”. 

Fill in the "URL to be called" input field and click on Check URL. After you get the "URL successfully reached" status, the request will be sent with the following parameters:

  • Method: POST
  • Data type: application/json

Note: Publish / update your course after you configure the webhooks to apply the settings.

The following data will be sent to the provided URL when the course is finished by a learner:

Course status can have the following values:

Example: 

{

    "courseId": "2fc74749fe984bb9b23dfb02c30ccb8b",

    "learnerId": "[email protected]",

    "score": 100,

    "finishedOn": "2018-07-15T06:15:17.502Z",

    "status": "passed"

}

In case the webhooks can’t deliver data, the learner’s progress will still be reported to Easygenerator. After 11 failed attempts to send a webhook, a learner will get the following message and can just close the course:

NOTE: Webhooks are available in the Teach/Simple course, Test/Assessment and Personalized learning templates.

IMPORTANT: Cross-origin resource sharing (CORS)

To use Easygenerator webhooks, you need to make sure that your server endpoint supports CORS. Otherwise, browser's security policies will block your requests.

There are some helpful links on CORS and the ways to implement it:
https://en.wikipedia.org/wiki/Cross-origin_resource_sharing
https://enable-cors.org/server.html

Did this answer your question?