Adding Webhooks for Custom Integration

If you have another system (such as a CRM) and want automated notifications to be sent to this external system when something happens in AOM, you can set up Webhooks.  Academy of Mine (AOM) allows integrating with other systems by notifying and sending them data on certain events/triggers using Webhook Endpoints. Events that trigger that data to be sent include things like a new account being created, a quiz being submitted, or an order being placed, as well as many others which are all listed in this article. 

With Webhooks set up, the AOM platform will call the Webhook endpoint added by you for a certain event/trigger. It sends an http POST request with a JSON payload to the endpoint which can then be utilized to do any processing as needed. One example could be utilizing the "New Account Created" event/trigger to add that user in your own CRM system (.e.g Hubspot, Salesforce etc). Every time a new account is created in the platform, the endpoint will be called by AOM. 

In this guide, we will go over the events that can be triggered using Webhooks, how to set up the Webhooks integration, as well as the Sample Payload JSON for each event.

In this article:


Webhook Events

The events in AOM that are available to send notifications using  are:

  • New Account Created
  • Enrolled in a course
  • Submitted a Quiz
  • Submitted an assignment
  • Evaluated an assignment
  • Rejected an assignment
  • Submitted a discussion
  • New Order Placed
  • Order Failed
  • Order Refused
  • Payment Pending
  • New Announcement

Enabling Webhooks in AOM

Below are the steps to enable and setup Webhooks in your platform:

  1. From the Admin Dashboard, navigate to the Integrations tab
  2. Find the Webhooks tile, and click manage to open the Webhooks integration settings
  3. Enable the Webhook option by activating the toggle
  4. Click on Add Endpoint to add the Endpoint URL.
  5. Add details into the fields- Endpoint URLDescription (optional), and then select Events (one or more). You can select one or multiple events. Then click on Save. You have successfully added a webhook URL.
  6. The endpoint URL(s) added in the previous step can be seen in the list (as shown in the below figure.)
  7. To search an endpoint URL from the list, use the Select events menu. This enables you to search for a URL by events.


Sample Payload JSON for Each Event


New Account Created:

Sample JSON :
{
"id":4,
"first_name":"John",
"last_name":"Doe",
"email":"johnDoe@academyofmine.com",
"date_registered":"Aug 11, 2020 04:58 PM"
}

Enrolled in a Course

Sample JSON :
{
"userList":
[{
"id":1,
"first_name":"Aom",
"last_name":"Staff",
"email":"dev@academyofmine.com"
}],
"enrolled_courses_list":
[{
"id":2,
"name":"test course to test all the events"
}
]}
<br>

Submitted a Quiz

Sample JSON :
{
"id":3,
"first_name":"Demo",
"last_name":"Student",
"email":"student@app.com",
"date_submitted":"Aug 11, 2020 01:37 PM",
"quiz":{
"id":3,
"name":"quiz 1"
},
"course":
{
"id":2,
"name":"test course to test all the evnts"},
"course_instructor_name":
{
"id":1,
"name":"Aom Staff"
}}
<br>

Submitted an Assignment

Sample JSON :
{
"first_name":"Demo",
"last_name":"Student",
"email":"student@app.com",
"date_submitted":"Aug 11, 2020 01:45 PM",
"assignment":
{
"id":"1",
"name":"assignment 1"
},
"course":
{
"id":2,
"name":"test course to test all the evnts"},
"course_instructor":
{
"id":1,
"name":"Aom Staff"
}}
<br>

Submitted a Discussion

Sample JSON :
{
"id":3,
"first_name":"Demo",
"last_name":"Student",
"email":"student@app.com",
"discussion":
{
"id":6,
"name":"Discussion Board"
},
"course":
{
"id":1,
"name":"Professional Development and Training"},
"course_instructor":
{
"id":1,
"name":"Aom Staff"
},
"date_submitted":"Aug 11, 2020 05:03 PM"}
<br>

New Announcement

Sample JSON :
{
"receivers":
[{
"first_name":"Demo",
"last_name":"Student",
"name":"Demo Student",
"email":"student@app.com"
},
{
"first_name":"Site",
"last_name":"Admin",
"name":"Site Admin",
"email":"ehj@academyofmine.com"
}],
"annoucement_date":"Aug 11, 2020 02:23 PM",
"announcement_content":"We have just released a new course on Professional Development. You can purchase it in the course catalog",
"announcement_title":"Test announcement",
"created_by":"Aom Staff"
}
<br>

New Order Placed (Successful payment)

Sample JSON :
{
"id":19,
"date_created":"Aug 11, 2020 07:45 PM",
"status":"COMPLETED",
"currency":"United States (US) dollar",
"order_total":220,
"sub_total":220,
"transaction_ref":null,
"payment_gateway":
{
"id":"Unknown",
"name":"Manual order"},
"customer":
{
"id":3,
"first_name":"Demo",
"last_name":"Student",
"email":"student@app.com",
"billing_address":
{
"full_name":"John doe",
"address_line_1":"123 John St",
"address_line_2":"Suite 309",
"city":"New York",
"country":"US",
"state":"NY",
"zipcode":"10017"
}
},
"line_items":
[{
"product_id":1,
"product_name":"Product",
"quantity":1,
"price_per_qty":"110.00",
"total":"110.00"
},
{
"product_id":2,
"product_name":"Prod 2",
"quantity":1,
"price_per_qty":"110.00",
"total":"110.00"}
],
"coupons":[],
"notes":[]
}
<br>

Failed Order (payment did not go through)

Sample JSON :
{
"id":19,
"date_created":"Aug 11, 2020 07:45 PM",
"status":"FAILED",
"currency":"United States (US) dollar",
"order_total":220,
"sub_total":220,
"transaction_ref":null,
"payment_gateway":
{
"id":"Unknown",
"name":"Manual order"},
"customer":
{
"id":3,
"first_name":"Demo",
"last_name":"Student",
"email":"student@app.com",
"billing_address":
{
"full_name":"John doe",
"address_line_1":"123 John St",
"address_line_2":"Suite 309",
"city":"New York",
"country":"US",
"state":"NY",
"zipcode":"10017"
}
},
"line_items":
[{
"product_id":1,
"product_name":"Product",
"quantity":1,
"price_per_qty":"110.00",
"total":"110.00"
},
{
"product_id":2,
"product_name":"Prod 2",
"quantity":1,
"price_per_qty":"110.00",
"total":"110.00"}
],
"coupons":[],
"notes":[]
}
<br>

Order Refunded

Sample JSON :
{
"id":19,
"date_created":"Aug 11, 2020 07:45 PM",
"status":"REFUNDED",
"currency":"United States (US) dollar",
"order_total":220,
"sub_total":220,
"transaction_ref":null,
"payment_gateway":
{
"id":"Unknown",
"name":"Manual order"},
"customer":
{
"id":3,
"first_name":"Demo",
"last_name":"Student",
"email":"student@app.com",
"billing_address":
{
"full_name":"John doe",
"address_line_1":"test",
"address_line_2":"test",
"city":"Durg",
"country":"US",
"state":"AL",
"zipcode":"491001"
}
},
"line_items":
[{
"product_id":1,
"product_name":"Product",
"quantity":1,
"price_per_qty":"110.00",
"total":"110.00"
},
{
"product_id":2,
"product_name":"Prod 2",
"quantity":1,
"price_per_qty":"110.00",
"total":"110.00"}
],
"coupons":[],
"notes":[]
}