Webhook
Webhook Management

Introduction

A webhook (also called a web callback or HTTP push API) is a way for an app to provide other applications with real-time information. A webhook delivers data to other applications as it happens, meaning you get data immediately.
For using webhook service clients have to register an API application that will have an API key, api-admin credential, and an encryption file for further authentications. This is taken place for a successful webhook event subscription validation. For implementing the webhook service follow the given steps.
Available webhook event slugs and their provided data are listed at the end of the webhook document.

List Events

get
β€Ž
https://<domain>/<api prefix>/<version>/webhook/list/events/
List Provided Webhook Events

Sample Code

Node
1
var request = require('request');
2
var options = {
3
'method': 'GET',
4
'url': 'https://<domain>/<api prefix>/<version>/webhook/list/events/',
5
'headers': {
6
'apikey': '<apikey>',
7
'Authorization': 'Bearer <access-token>'
8
}
9
};
10
request(options, function (error, response) {
11
if (error) throw new Error(error);
12
console.log(response.body);
13
});
Copied!
PHP
1
<?php
2
​
3
$curl = curl_init();
4
​
5
curl_setopt_array($curl, array(
6
CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/webhook/list/events/',
7
CURLOPT_RETURNTRANSFER => true,
8
CURLOPT_ENCODING => '',
9
CURLOPT_MAXREDIRS => 10,
10
CURLOPT_TIMEOUT => 0,
11
CURLOPT_FOLLOWLOCATION => true,
12
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
13
CURLOPT_CUSTOMREQUEST => 'GET',
14
CURLOPT_HTTPHEADER => array(
15
'apikey: <apikey>',
16
'Authorization: Bearer <access-token>'
17
),
18
));
19
​
20
$response = curl_exec($curl);
21
​
22
curl_close($curl);
23
echo $response;
Copied!

Subscribe Event

post
β€Ž
https://<domain>/<api prefix>/<version>/webhook/subscribe/
Subscribe an event

Sample Code

Node
1
var request = require('request');
2
var options = {
3
'method': 'POST',
4
'url': 'https://<domain>/<api prefix>/<version>/webhook/subscribe/',
5
'headers': {
6
'apikey': '<apikey>',
7
'Authorization': 'Bearer <access_token>',
8
},
9
body: JSON.stringify({"events":["event_slug",..],"url":"<endpoit_url>"})
10
};
11
request(options, function (error, response) {
12
if (error) throw new Error(error);
13
console.log(response.body);
14
});
Copied!
PHP
1
<?php
2
​
3
$curl = curl_init();
4
​
5
curl_setopt_array($curl, array(
6
CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/webhook/subscribe/',
7
CURLOPT_RETURNTRANSFER => true,
8
CURLOPT_ENCODING => '',
9
CURLOPT_MAXREDIRS => 10,
10
CURLOPT_TIMEOUT => 0,
11
CURLOPT_FOLLOWLOCATION => true,
12
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
13
CURLOPT_CUSTOMREQUEST => 'POST',
14
CURLOPT_POSTFIELDS =>' {
15
"events": ["<event_slug>",...],
16
"url": "<endpoint_url>"
17
}',
18
CURLOPT_HTTPHEADER => array(
19
'apikey: <apikey>',
20
'Authorization: Bearer <access_token>',
21
),
22
));
23
​
24
$response = curl_exec($curl);
25
​
26
curl_close($curl);
27
echo $response;
Copied!
Error Responses
Status Code
Error Type
Field
Description
400
Validation Error
events
This field is required.
This list may not be empty.
'<event-slug>' this webhook event is already subscribed for this API User.
400
Validation Error
url
This field is required.
This field may not be blank.
Enter a valid URL.
Protocol of recipient URL not allowed (('https://',) only).

Webhook Subscriber Validation

post
β€Ž
https://<domain>/<api prefix>/<version>/webhook/subscribe/validate/<uuid>/
Webhook Validation

Sample Code

Node
1
var request = require('request');
2
var options = {
3
'method': 'POST',
4
'url': 'https://<domain>/<api prefix>/<version>/webhook/subscribe/validate/<uuid>/',
5
'headers': {
6
'apikey': '<apikey>',
7
'Authorization': 'Bearer <access-token>',
8
}
9
};
10
request(options, function (error, response) {
11
if (error) throw new Error(error);
12
console.log(response.body);
13
});
Copied!
PHP
1
<?php
2
​
3
$curl = curl_init();
4
​
5
curl_setopt_array($curl, array(
6
CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/webhook/subscribe/validate/<uuid>/',
7
CURLOPT_RETURNTRANSFER => true,
8
CURLOPT_ENCODING => '',
9
CURLOPT_MAXREDIRS => 10,
10
CURLOPT_TIMEOUT => 0,
11
CURLOPT_FOLLOWLOCATION => true,
12
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
13
CURLOPT_CUSTOMREQUEST => 'POST',
14
CURLOPT_HTTPHEADER => array(
15
'apikey: <apikey>',
16
'Authorization: Bearer <access-token>',
17
),
18
));
19
​
20
$response = curl_exec($curl);
21
​
22
curl_close($curl);
23
echo $response;
Copied!

Error Responses

Status Code
Error Type
Field
Description
400
Validation Error
uuid
This subscription is blocked due to maximum validation attempt (<maxattemptcount>), Please contact admin for unblocking your subscription.
​
This subscription is already verified.
404
Not Found
​
The requested resource not found.
​
​
​

Update Subscription

post
β€Ž
https://<domain>/<api prefix>/<version>/webhook/update/<uuid>/
Update a subscription

Sample Code

Node
1
var request = require('request');
2
var options = {
3
'method': 'POST',
4
'url': 'https://<domain>/<api prefix>/<version>/webhook/update/<uuid>/',
5
'headers': {
6
'apikey': '<apikey>',
7
'Authorization': 'Bearer <access_token>',
8
},
9
body: JSON.stringify({"events":["event_slug",..],"url":"<endpoit_url>","is_disabled":<boolean>})
10
};
11
request(options, function (error, response) {
12
if (error) throw new Error(error);
13
console.log(response.body);
14
});
Copied!
PHP
1
<?php
2
​
3
$curl = curl_init();
4
​
5
curl_setopt_array($curl, array(
6
CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/webhook/update/<uuid>/',
7
CURLOPT_RETURNTRANSFER => true,
8
CURLOPT_ENCODING => '',
9
CURLOPT_MAXREDIRS => 10,
10
CURLOPT_TIMEOUT => 0,
11
CURLOPT_FOLLOWLOCATION => true,
12
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
13
CURLOPT_CUSTOMREQUEST => 'POST',
14
CURLOPT_POSTFIELDS =>' {
15
"events": ["<event_slug>",...],
16
"url": "<endpoint_url>",
17
"is_disabled":<boolean>
18
}',
19
CURLOPT_HTTPHEADER => array(
20
'apikey: <apikey>',
21
'Authorization: Bearer <access_token>',
22
),
23
));
24
​
25
$response = curl_exec($curl);
26
​
27
curl_close($curl);
28
echo $response;p
Copied!
Note:- Error Responses are the same as an event subscription.

Webhook Info

get
β€Ž
https://<domain>/<api prefix>/<version>/webhook/info/<uuid>/
Webhook Info

Sample Code

Node
1
var request = require('request');
2
var options = {
3
'method': 'GET',
4
'url': 'https://<domain>/<api prefix>/<version>/webhook/info/<uuid>/',
5
'headers': {
6
'apikey': '<apikey>',
7
'Authorization': 'Bearer <access-token>',
8
}
9
};
10
request(options, function (error, response) {
11
if (error) throw new Error(error);
12
console.log(response.body);
13
});
Copied!
PHP
1
<?php
2
​
3
$curl = curl_init();
4
​
5
curl_setopt_array($curl, array(
6
CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/webhook/info/<uuid>/',
7
CURLOPT_RETURNTRANSFER => true,
8
CURLOPT_ENCODING => '',
9
CURLOPT_MAXREDIRS => 10,
10
CURLOPT_TIMEOUT => 0,
11
CURLOPT_FOLLOWLOCATION => true,
12
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
13
CURLOPT_CUSTOMREQUEST => 'GET',
14
CURLOPT_HTTPHEADER => array(
15
'apikey: <apikey>',
16
'Authorization: Bearer <access-token>',
17
),
18
));
19
​
20
$response = curl_exec($curl);
21
​
22
curl_close($curl);
23
echo $response;
24
​
Copied!

Unsubscribe Event

delete
β€Ž
https://<domain>/<api prefix>/<version>/webhook/unsubscribe/<uuid>/
Unsubscribe webhook event

Sample Code

Node
1
var request = require('request');
2
var options = {
3
'method': 'DELETE',
4
'url': 'https://<domain>/<api prefix>/<version>/webhook/unsubscribe/<uuid>/',
5
'headers': {
6
'apikey': '<apikey>',
7
'Authorization': 'Bearer <access token>',
8
}
9
};
10
request(options, function (error, response) {
11
if (error) throw new Error(error);
12
console.log(response.body);
13
});
14
​
Copied!
PHP
1
<?php
2
​
3
$curl = curl_init();
4
​
5
curl_setopt_array($curl, array(
6
CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/webhook/unsubscribe/<uuid>/',
7
CURLOPT_RETURNTRANSFER => true,
8
CURLOPT_ENCODING => '',
9
CURLOPT_MAXREDIRS => 10,
10
CURLOPT_TIMEOUT => 0,
11
CURLOPT_FOLLOWLOCATION => true,
12
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
13
CURLOPT_CUSTOMREQUEST => 'DELETE',
14
CURLOPT_HTTPHEADER => array(
15
'apikey: <apikey>',
16
'Authorization: Bearer <access-token>',
17
),
18
));
19
​
20
$response = curl_exec($curl);
21
​
22
curl_close($curl);
23
echo $response;
Copied!

List Subscriptions

get
β€Ž
https://<domain>/<api prefix>/<version>/webhook/list/
List event subscriptions

Sample Code

Node
1
var request = require('request');
2
var options = {
3
'method': 'GET',
4
'url': 'https://<domain>/<api prefix>/<version>/webhook/list/',
5
'headers': {
6
'apikey': '<apikey>',
7
'Authorization': 'Bearer <access token>',
8
}
9
};
10
request(options, function (error, response) {
11
if (error) throw new Error(error);
12
console.log(response.body);
13
});
Copied!
PHP
1
<?php
2
​
3
$curl = curl_init();
4
​
5
curl_setopt_array($curl, array(
6
CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/webhook/list/',
7
CURLOPT_RETURNTRANSFER => true,
8
CURLOPT_ENCODING => '',
9
CURLOPT_MAXREDIRS => 10,
10
CURLOPT_TIMEOUT => 0,
11
CURLOPT_FOLLOWLOCATION => true,
12
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
13
CURLOPT_CUSTOMREQUEST => 'GET',
14
CURLOPT_HTTPHEADER => array(
15
'apikey: <apikey>',
16
'Authorization: Bearer <access token>',
17
),
18
));
19
​
20
$response = curl_exec($curl);
21
​
22
curl_close($curl);
23
echo $response;
Copied!

Provided Webhook Events

These are available webhook events in the system and the data given by the event.
Event Name
Event Slug
Data (JSON)
User Registration
user-registration
1
{
2
'email': '<user_email_address>',
3
'sponsor': '<sponsor_user_name>',
4
'username': '<username>',
5
'is_active': <user_status>,
6
'last_name': '<last_name>',
7
'unique_id': '<unique_id>',
8
'user_role':
9
[
10
{
11
'name': '<user_role_name>'
12
}
13
],
14
'first_name': '<first_name>',
15
'phone_code': <phone_code>,
16
'phone_number': '<phone_number>'
17
}
Copied!
Event Name
Event Slug
Data (JSON)
Order Creation
order-creation
if the order type is Commerce,
1
{
2
'uid': '<user_unique_id>',
3
'status': '<order_status>',
4
'products': [
5
{
6
'bv': <bv>,
7
'cv': <cv>,
8
'point': <points>
9
'total': <product_total_price>,
10
'quantity': <quantity>,
11
'product_name': '<product_name>',
12
'product_base_price': '<product_base_price>',
13
'product_id': '<product_id>'
14
},
15
...
16
],
17
'username': '<username>',
18
'last_name': '<last_name>',
19
'first_name': '<first_name>',
20
'order_type': '<order_type>',
21
'order_total': '<order_total>',
22
'currency_code': '<currency_code>',
23
'order_number': '<order_number>'
24
}
Copied!
if the order type is Enrollment,
1
{
2
'bv': '<bv>',
3
'cv': '<cv>',
4
'uid': '<user_unique_id>',
5
'points': '<points>',
6
'status': '<order_status>',
7
'username': '<username>',
8
'last_name': '<last_name>',
9
'first_name': '<first_name>',
10
'order_type': 'ENROLLMENT',
11
'product_id': '<product_id>',
12
'amount_paid': '<amount_paid>',
13
'order_total': '<order_total>',
14
'product_name': '<product_name>',
15
'actual_amount': '<actual_amount>',
16
'currency_code': '<currency_code>',
17
'payment_status': '<payment_status>',
18
'product_base_price': '<product_base_price>',
19
'order_number': '<order_number>'
20
}
Copied!
Event Name
Event Slug
Data (JSON)
Block User
block-user
1
[
2
{'unique_id': '<blocked_user_unique_id>'},
3
...
4
]
Copied!
Event Name
Event Slug
Data (JSON)
Unblock User
unblock-user
1
[
2
{'unique_id': '<blocked_user_unique_id>'},
3
...
4
]
Copied!
Event Name
Event Slug
Data (JSON)
Product Creation
product-creation
1
{
2
'bundle_id': '<bundle_id>'
3
}
Copied!
Event Name
Event Slug
Data (JSON)
Product Update
product-update
1
{
2
'bundle_id': '<bundle_id>'
3
}
Copied!
Event Name
Event Slug
Data (JSON)
Product Delete
product-delete
1
{
2
'bundle_id': '<bundle_id>'
3
}
Copied!
Event Name
Event Slug
Data (JSON)
Profile Update
profile-update
1
{
2
'unique_id': '<unique_id>'
3
}
Copied!
Last modified 1mo ago