Create Webhook
curl --request POST \
--url https://webhooks.sbx.moduluslabs.io/v1/webhooks \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"request": {
"Token": "eyJhbGciOiJBMjU2S1ciLCJlbmMiOiJBMjU2Q0JDLUhTNTEyIn0..."
}
}
'import requests
url = "https://webhooks.sbx.moduluslabs.io/v1/webhooks"
payload = { "request": { "Token": "eyJhbGciOiJBMjU2S1ciLCJlbmMiOiJBMjU2Q0JDLUhTNTEyIn0..." } }
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({request: {Token: 'eyJhbGciOiJBMjU2S1ciLCJlbmMiOiJBMjU2Q0JDLUhTNTEyIn0...'}})
};
fetch('https://webhooks.sbx.moduluslabs.io/v1/webhooks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://webhooks.sbx.moduluslabs.io/v1/webhooks",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'request' => [
'Token' => 'eyJhbGciOiJBMjU2S1ciLCJlbmMiOiJBMjU2Q0JDLUhTNTEyIn0...'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://webhooks.sbx.moduluslabs.io/v1/webhooks"
payload := strings.NewReader("{\n \"request\": {\n \"Token\": \"eyJhbGciOiJBMjU2S1ciLCJlbmMiOiJBMjU2Q0JDLUhTNTEyIn0...\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://webhooks.sbx.moduluslabs.io/v1/webhooks")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"request\": {\n \"Token\": \"eyJhbGciOiJBMjU2S1ciLCJlbmMiOiJBMjU2Q0JDLUhTNTEyIn0...\"\n }\n}")
.asString();using RestSharp;
var options = new RestClientOptions("https://webhooks.sbx.moduluslabs.io/v1/webhooks");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Basic <encoded-value>");
request.AddJsonBody("{\n \"request\": {\n \"Token\": \"eyJhbGciOiJBMjU2S1ciLCJlbmMiOiJBMjU2Q0JDLUhTNTEyIn0...\"\n }\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
{
"id": "<string>",
"webhookAction": "QRPH_SUCCESS",
"webhookStatus": "ENABLED",
"callbackUrl": "<string>"
}{
"code": "20000003",
"error": "<string>",
"referenceNumber": "<string>"
}{
"code": "20000003",
"error": "<string>",
"referenceNumber": "<string>"
}Webhooks API
Create Webhook
Register a webhook endpoint
POST
/
v1
/
webhooks
Create Webhook
curl --request POST \
--url https://webhooks.sbx.moduluslabs.io/v1/webhooks \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"request": {
"Token": "eyJhbGciOiJBMjU2S1ciLCJlbmMiOiJBMjU2Q0JDLUhTNTEyIn0..."
}
}
'import requests
url = "https://webhooks.sbx.moduluslabs.io/v1/webhooks"
payload = { "request": { "Token": "eyJhbGciOiJBMjU2S1ciLCJlbmMiOiJBMjU2Q0JDLUhTNTEyIn0..." } }
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({request: {Token: 'eyJhbGciOiJBMjU2S1ciLCJlbmMiOiJBMjU2Q0JDLUhTNTEyIn0...'}})
};
fetch('https://webhooks.sbx.moduluslabs.io/v1/webhooks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://webhooks.sbx.moduluslabs.io/v1/webhooks",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'request' => [
'Token' => 'eyJhbGciOiJBMjU2S1ciLCJlbmMiOiJBMjU2Q0JDLUhTNTEyIn0...'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://webhooks.sbx.moduluslabs.io/v1/webhooks"
payload := strings.NewReader("{\n \"request\": {\n \"Token\": \"eyJhbGciOiJBMjU2S1ciLCJlbmMiOiJBMjU2Q0JDLUhTNTEyIn0...\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://webhooks.sbx.moduluslabs.io/v1/webhooks")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"request\": {\n \"Token\": \"eyJhbGciOiJBMjU2S1ciLCJlbmMiOiJBMjU2Q0JDLUhTNTEyIn0...\"\n }\n}")
.asString();using RestSharp;
var options = new RestClientOptions("https://webhooks.sbx.moduluslabs.io/v1/webhooks");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Basic <encoded-value>");
request.AddJsonBody("{\n \"request\": {\n \"Token\": \"eyJhbGciOiJBMjU2S1ciLCJlbmMiOiJBMjU2Q0JDLUhTNTEyIn0...\"\n }\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
{
"id": "<string>",
"webhookAction": "QRPH_SUCCESS",
"webhookStatus": "ENABLED",
"callbackUrl": "<string>"
}{
"code": "20000003",
"error": "<string>",
"referenceNumber": "<string>"
}{
"code": "20000003",
"error": "<string>",
"referenceNumber": "<string>"
}The request and response are encrypted
{Token} envelopes. The decrypted request contains webhookAction (QRPH_SUCCESS or QRPH_DECLINED) and callbackUrl (an HTTPS URL). Registering the same action twice returns 400 with code 10000031.Authorizations
HTTP Basic Authentication using your Secret Key as the username and an empty password
Body
application/json
Show child attributes
Show child attributes
Response
Webhook created.
Unique identifier for the webhook
The transaction event this webhook receives.
Available options:
QRPH_SUCCESS, QRPH_DECLINED Current status of the webhook
Available options:
ENABLED, DISABLED The HTTPS URL where notifications are sent
Was this page helpful?