4.5. Track newly created enrollments with the Enrollment Create Webhook

Get notified of your learners new enrollments into content via the Enrollment Create Webhook Event.

Overview

The enrollment.create webhook event fires near real-time notifications anytime a new enrollment is created. New enrollments are typically created when a user begins a new learning object, in other words, when a learner starts consuming some new Go1 learning content. This event is used to keep your external application up to date with the latest learning that is started within the Go1 system.

How it works

There are three steps to set up a new webhook with the enrollment.create event, and be ready to consume the payload:

  1. Create a webhook with the enrollment.create event enabled.
  2. Receive the enrollment.create events.
  3. Retrieve the enrollment details using the Go1 API.

These steps are detailed below.

1. Create a webhook with the enrollment.create event enabled

Create your Enrollment Create Webhook via the Go1 API.

Before creating a webhook, ensure you have an Endpoint URL ready, to which you wish Go1 to send event notifications.

The 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 new enrollments",
    "url": "https://your-webhook-consumer-url.com",
    "event_types": ["enrollment.create"]
}'

Notes:

  • When sending a V3 API request, you are required to explicitly set the API version by sending an Api-Version header with your request (see line 4 above).
  • Webhooks can also be configured with additional security measures, using our secret key parameter, see the Go1 API Reference (V3) for further details.
  • The access_token sent in the Authorization parameter determines the Go1 portal for which you’ll receive webhook events. See Authentication and Authorization for details on generating access tokens.

2. Receive the enrollment.create events

When any of your learners begin new Go1 content (learning objects), the enrollment.create event will fire a payload. Here is an example of the enrollment.create webhook event object:

{
  "id": "hg4JWUDbT55B",
  "event_type": "enrollment.create",
  "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": "123",
    "lo_id": "764",
    "portal_id": "534",
    "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. Retrieve the enrollment details using the Go1 API

Using the Enrollment ID provided in the event payload, call the Go1 API to retrieve the details of the enrollment. The API will return the full Enrollment Object, and enable you to sync this record with your system. The Enrollment ID can be found in the data.id parameter of the webhook payload, which in the sample below is 123.

To retrieve the Enrollment Object, make a GET request to the /enrollments endpoint:

curl --location -g 'https://gateway.go1.com/enrollments/{id}' \
--header 'Authorization: {access_token}' \
--header 'Api-Version: {version_eg_2022-07-01}'

Further details on Enrollment Object itself can be found on the API Reference. Once you have retrieved the full Enrollment Object, you will have all the information you need about the enrollment record to sync this with your system.