All Categories Developers How to use Webhooks

How to use Webhooks

Intro

With Webhooks, you can integrate your own Academy to trigger special actions within your external or internal systems, which helps you automate a lot more even further. In order to use Webhooks, you need to have a basic technical understanding of how software and servers work. If you don't, you are going to need external help.

Technical Details

How It Works

When a certain event happens (e.g. new user signup, completion of a course etc), our system sends an HTTP POST to your server endpoint, with detailed information about the respective event (you will have the provision to set the endpoint URL, events to trigger etc.), in JSON format.

You can add a new endpoint by following below steps:

  1. Login to https://app.acadle.com and open your Academy or directly login to your Academy as admin

  2. Navigate to Admin > Webhooks

  3. On the right side, you can see an option to add your endpoint URL, and select the events you want to get triggered

  4. Click on 'Add'

If your webhook script performs complex logic or makes network calls, it’s possible that the script would time out before our system sees its complete execution. Ideally, your webhook handler code (acknowledging receipt of an event by returning a 2xx status code) is separate of any other logic you do for that event.

Retry System

Upon sending an HTTP POST to your URL, the Webhooks engine expects to receive HTTP status 200 in order to consider the delivery a success. If your server returns an HTTP error code, our system attempts to deliver your webhooks for up to three days with an exponential back off. In each Webhook URL details sheet, you can view when the next retry will occur.

If you have a Webhooks error, that can also be seen from the webhooks menu.

Payload Examples

User Registered Payload

{
"id": "a3MwZHNVWDNSczZuVXVTMTQy",
"version": "2020-12-04",
"type": "user_registered",
"data": {
"user": {
"id": 17,
"name": “john Doe",
"email": “johndoe@email.com",
"created_at": "2020-12-04 10:43:17",
"timezone": "UTC"
}
}
}

Course Completed Payload

{
"id": "bDJOU0M0MQ==",
"version": "2020-12-04",
"type": "user_course_completed",
"data": {
"user": {
"id": 17,
"name": “John Doe",
"email": “johndoe@email.com",
"created_at": "2020-12-04 10:43:17",
"timezone": "UTC"
},
"course": {
"id": 1,
"name": “Sample Course",
"description": “Sample Course Description",
"duration": "01:00",
"competed_at": "2020-12-04T11:19:19.385163Z",
"timezone": "UTC"
}
}
}

User Lesson Completed Payload

{
"id": "bTVHMUtLWU91OEM5SjZMNzE1Mg==",
"version": "2020-12-04",
"type": "user_lessons_completed",
"data": {
"user": {
"id": 17,
"name": “John Doe",
"email": “johndoe@email.com",
"created_at": "2020-12-04 10:43:17",
"timezone": "UTC"
},
"course": {
"id": 1,
"name": “Sample Course",
"description": “Sample Course Description",
"duration": "01:00"
},
"lesson": {
"id": 2,
"name": “Sample Lesson",
"competed_at": "2020-12-04T11:19:19.340004Z",
"timezone": "UTC"
}
}
}

User Certificate Issued Payload

{
"id": "bnljZmc0MQ==",
"version": "2020-12-04",
"type": "user_certificate_issued",
"data": {
"user": {
"id": 17,
"name": “John Doe",
"email": “johndoe@email.com",
"created_at": "2020-12-04 10:43:17",
"timezone": "UTC"
},
"certificate": {
"id": 1,
"name": “Sample Certificate",
"issued_at": "2020-12-04T11:53:56.327213Z",
"timezone": "UTC"
}
}
}

User Badge updated Payload

{
"id": "b2c2eUgzU2lWcTkx",
"version": "2020-12-04",
"type": "user_badge_updated",
"data": {
"user": {
"id": 17,
"name”:’John Doe',
"email": “johndoe@email.com",
"created_at": "2020-12-04 10:43:17",
"timezone": "UTC"
},
"badge": {
"id": 21,
"name”:’Certification Badge 5',
"category": "Certification Badge"
}
}
}

Please write to support@acadle.com if you have any questions or if you need any clarification.

Was this article helpful?

Thanks for your feedback!