Send Test Webhook
Testing allows you to validate the connectivity between AML Watcher and your webhook endpoint. To test a webhook, you'll need to send a test request to the specified endpoint. This test request simulates an actual event, and you should receive a response that confirms the webhook's ability to receive and process the request.
Endpoint: https://api.amlwatcher.com/api/test-webhook/:webhook_id
Method: GET
- HTTP
- Javascript
- PHP
- Python
- Ruby
- Java
- cURL
- C#
- Go
Sample Request
GET /api/test-webhook/:webhook_id HTTP/1.1
Host: api.amlwatcher.com
Authorization: Bearer Token
Sample Request
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer Token");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.amlwatcher.com/api/test-webhook/:webhook_id", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Sample Request
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.amlwatcher.com/api/test-webhook/:webhook_id',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer Token'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Sample Request
import requests
url = "https://api.amlwatcher.com/api/test-webhook/:webhook_id"
payload = ""
headers = {
'Authorization': 'Bearer Token'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
Sample Request
require "uri"
require "net/http"
url = URI("https://api.amlwatcher.com/api/test-webhook/:webhook_id")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer Token"
response = https.request(request)
puts response.read_body
Sample Request
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class Main {
public static void main(String[] args) {
try {
// Replace :webhook_id with the actual webhook ID
String webhookId = "your_webhook_id";
String urlString = "https://api.amlwatcher.com/api/test-webhook/" + webhookId;
// URL to the API endpoint
URL url = new URL(urlString);
// Establishing the connection
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
// Setting the request method to GET
httpURLConnection.setRequestMethod("GET");
// Setting the headers
httpURLConnection.setRequestProperty("Authorization", "Bearer Token");
// Getting the response code
int responseCode = httpURLConnection.getResponseCode();
System.out.println("Response Code: " + responseCode);
BufferedReader in;
if (responseCode >= 200 && responseCode < 300) {
// Reading the response
in = new BufferedReader(new InputStreamReader(httpURLConnection.getInputStream()));
} else {
// Reading the error response
in = new BufferedReader(new InputStreamReader(httpURLConnection.getErrorStream()));
}
String inputLine;
StringBuilder response = new StringBuilder();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
// Printing the response
System.out.println("Response: " + response.toString());
// Closing the connection
httpURLConnection.disconnect();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Sample Request
curl --location --request GET 'https://api.amlwatcher.com/api/test-webhook/:webhook_id'
--header 'Authorization: Bearer Token'
Sample Request
using RestSharp; // Import RestSharp namespace
using System;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
string webhookId = "your_webhook_id_here";
var url = "https://api.amlwatcher.com";
var options = new RestClientOptions(url)
{
ThrowOnAnyError = true,
Timeout = TimeSpan.FromMilliseconds(-1)
};
var client = new RestClient(options);
var requestUrl = $"/api/test-webhook/{webhookId}";
var request = new RestRequest(requestUrl, Method.Get);
request.AddHeader("Authorization", "Bearer Token");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);
}
}
Sample Request
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.amlwatcher.com/api/test-webhook/:webhook_id"
method := "GET"
payload := strings.NewReader(``)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Authorization", "Bearer Token")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Request
Parameters | Required | Type | Description |
---|---|---|---|
webhook_id | Yes | String | It is the unique Id, assigned with each webhook. |
Response
Parameters | Description |
---|---|
error | Whenever there is an error in your request, this param will have details of that error; otherwise it’ll remain empty. |
event | Defines event specific webhook type. Default: monitored_status_updated |
status | The status field is set to either “SUCCESS” or “FAIL”, indicating that the API request resulted in a successful or failure/error condition respectively. |
data | An array/object containing the actual response elements. |
Sample Respone
{
"error": "False",
"event": "monitored_status_updated",
"status": "SUCCESS",
"data": {
"_id": "",
"client_reference": "",
"comments": "Array",
"created_at": "",
"is_monitored": "",
"is_updated": "",
"match_status": "",
"name": "",
"organization_id": "",
"search_filters": "Object",
"search_reference": "",
"total_results": "",
"updated_at": "",
"user_id": ""
}
}