4.4. Track Completions with the Enrollment Complete Webhook

Get notified of all your learner completions via a single Enrollment Complete Webhook

Overview

The Enrollment Complete Webhook fires near real-time notifications anytime your learners complete Go1 content, and is the most efficient, accurate method of capturing Go1 completion events.

These completion events can then be recorded in your application, ensuring your system always reflects the most up-to-date course completion status.

If you're a Go1 partner, the Go1 Enrollment Complete Webhook fires completion events for all your customer portals to a single endpoint. Configure it just once, and get notified of all your customers' completions.

How it works

There are three steps to successfully set up and utilise the Enrollment Complete Webhook:

  1. Create an Enrollment Complete webhook.
  2. Receive webhooks for Enrollment Complete events.
  3. Request secure enrollment data from Go1.

Track completions with the Enrollment Complete Webhook

These steps are detailed below.

1. Create an Enrollment Complete webhook

Create your Enrollment Complete Webhook in Go1’s Partner Hub or API.

Before creating a webhook, ensure you have an Endpoint URL to which you wish Go1 to send event notifications. It must be a valid URL.

Create a webhook in Go1 Partner Hub

Use Go1’s Partner Hub webhook manager to create your new Enrollment Complete Webhook.

  1. Open the Go1 Partner Hub Webhooks page.
  2. Click Add webhook.
  3. Enter a Name, that best describes the webhook.
  4. Enter your Endpoint URL, to which Go1 will send completion event notifications.
  5. Enter an optional Secret Key.
  6. Ensure the Enrollment complete event type is selected.
  7. Click Add webhook.

Once saved, your new Enrollment Complete Webhook is Active immediately, and will begin firing completion events for all your customer portals to your Endpoint URL.

Create a webhook using Go1's API (V3)

The Enrollment Complete Webhook can be configured only on the newest version of Go1’s API (V3).

See our Go1 API Reference (V3) for further details.

Sample Request

curl --location --request POST 'https://gateway.go1.com/webhooks' \
--header "Content-Type: application/json" \
--header "Authorization: {access_token}" \
--header "Api-Version: 2022-07-01" \
--data-raw '{
    "name": "My webhook for course completion",
    "url": "https://webhook-consumer.com",
    "secret_key": "MyS3cretK#y",
    "event_types": ["enrollment.complete"],
}'

The Header

When sending an V3 API request, you are required to explicitly set the API version by sending an Api-Version header with your request (see line 4 below).

This is an example of header included in a POST request to V3 of Go1’s API:

curl --location --request POST 'https://gateway.go1.com/webhooks' \
--header "Content-Type: application/json" \
--header "Authorization: {access_token}" \
--header "Api-Version: 2022-07-01" \

The access_token sent in the Authorization parameter determines the Go1 portal for which you’ll receive webhook events.

For partners, provide your partner portal access token to receive events from child portals

See Authentication and Authorization for details on generating access tokens.

The Body

The following POST request creates an Enrollment Complete Webhook .

{
    "name": "My webhook for course completion",
    "url": "https://webhook-consumer.com",
    "secret_key": "MyS3cretK#y",
    "event_types": ["enrollment.complete"],
}

The name and secret_key parameters are optional.

2. Receive webhooks for Enrollment Complete events

When any of your learners complete a Go1 course the enrollment.complete event will fire a payload.

{
  "id": "hg4JWUDbT55B",
  "event_type": "enrollment.complete",
  "webhook_version": "3.0.0",
  "sent": "2022-03-29T01:29:36.676Z",
  "attempt_number": 1,
  "url": "https://your.webhook.endpoint.com",
  "webhook_id": "auto generated uuid will be here",
  "data": {
    "id": "101916887",
    "lo_id": "741712",
    "portal_id": "11861197",
    "event_time": "2022-03-29T01:29:36.000Z"
  }
}

See Webhook Events for further details on the included attributes and the webhook event object itself.

3. Request secure enrollment data from Go1

Using the Enrollment ID, call the Go1 API to retrieve the enrollment details you need to identify the user, and then action the completion in your own system.

The Enrollment ID can be found in the data.id parameter of the webhook payload, which in this sample is 101916887.

"data": {
    "id": "101916887",
    "lo_id": "741712",
    "portal_id": "11861197",
    "event_time": "2022-03-29T01:29:36.000Z"
  }

Depending on your implementation, one of these payloads will contain the details you require to action the completion:

  1. Enrollment Object
  2. Learning Activity

Learning Activities are only captured if you’re using Go1 SCORM packages to surface content in your application. If you’re using Authenticated Links, retrieve an Enrollment Object.

Retrieve an Enrollment Object

Call the API to retrieve the entire Enrollment Object relating to the event that has just occurred.

To retrieve the Enrollment Object, make a GET request to the /v2/enrollments endpoint with the Enrollment ID found in your webhook payload.

GET /v2/enrollments/{enrollment-id}

If the completion event relates to a customer portal, your master portal will not have permission to make this call. Use the Go1 external API OAuth credentials belonging to the customer portal to make this call.

Further details on Enrollment Object itself can be found on the Go1 Developer API Reference.

Once you have retrieved the full Enrollment Object, you will have access to further Go1 user identification details, which you can use to identify the user in your system, and action the completion.

Retrieve a Learning Activity

If you’re surfacing Go1 content using SCORM packages, you can retrieve the SCORM payload we capture when users access a course via your application. We call these Learning Activities.

Learning Activities are only captured if you’re using Go1 SCORM packages to surface content in your application. If you’re using Authenticated Links, retrieve an Enrollment Object (see above).

While the Go1 Enrollment Object (above) contains Go1 user identification details, Learning Activities contain the raw payloads passed from your system via SCORM to Go1.

Because of this, you can use standard or custom SCORM fields to store your own IDs and data, which you can later retrieve from Go1’s Learning Activity endpoint to action a completion.

The benefit of this, is that you’re not required to map Go1 user IDs to your own internal IDs to facilitate a completion process.

When you receive an Enrollment Complete Webhook, just make a GET request to the /v2/learning-activity endpoint with the Enrollment ID found in your webhook payload.

GET /v2/learning-activity?enrollment-id=<enrollment_id>

Further details on the Learning Activity payload itself can be found on the Go1 Developer API Reference.

Once you have retrieved the Learning Activity, you will have access to your own user identification details, which you can use to identify the user in your system, and action the completion.