Now that you've successfully configured your server to accept webhooks, it's time to test them. We provide a convenient testing capability to ensure the proper functionality of your webhooks. By making a POST request to /v1/webhooks/{webhookId}/test, you can simulate an event and have a request sent to your webhook with an example payload:

curl --request POST \
  --url 'http://sandboxapi.givechariot.com/v1/webhooks/ep_2RnZEJaiKHDTMoat2Hlm8JZuZpl/test' \
  --header 'Authorization: Bearer <ACCESS_TOKEN>'
using System.Net.Http;

HttpClient client = new HttpClient();

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, "http://sandboxapi.givechariot.com/v1/webhooks/ep_2RnZEJaiKHDTMoat2Hlm8JZuZpl/test");

request.Headers.Add("Authorization", "Bearer <ACCESS_TOKEN>");

HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
package main

import (
	"fmt"
	"io"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	req, err := http.NewRequest("POST", "http://sandboxapi.givechariot.com/v1/webhooks/ep_2RnZEJaiKHDTMoat2Hlm8JZuZpl/test", nil)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("Authorization", "Bearer <ACCESS_TOKEN>")
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	defer resp.Body.Close()
	bodyText, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newHttpClient();

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("http://sandboxapi.givechariot.com/v1/webhooks/ep_2RnZEJaiKHDTMoat2Hlm8JZuZpl/test"))
    .POST(HttpRequest.BodyPublishers.noBody())
    .setHeader("Authorization", "Bearer <ACCESS_TOKEN>")
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
$.ajax({
  url: 'http://sandboxapi.givechariot.com/v1/webhooks/ep_2RnZEJaiKHDTMoat2Hlm8JZuZpl/test',
  crossDomain: true,
  method: 'post',
  headers: {
    'Authorization': 'Bearer <ACCESS_TOKEN>'
  }
}).done(function(response) {
  console.log(response);
});
var request = require('request');

var headers = {
    'Authorization': 'Bearer <ACCESS_TOKEN>'
};

var options = {
    url: 'http://sandboxapi.givechariot.com/v1/webhooks/ep_2RnZEJaiKHDTMoat2Hlm8JZuZpl/test',
    method: 'POST',
    headers: headers
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://sandboxapi.givechariot.com/v1/webhooks/ep_2RnZEJaiKHDTMoat2Hlm8JZuZpl/test');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer <ACCESS_TOKEN>',
]);

$response = curl_exec($ch);

curl_close($ch);
import http.client

conn = http.client.HTTPConnection("sandboxapi.givechariot.com")

headers = { 'Authorization': "Bearer <ACCESS_TOKEN>" }

conn.request("POST", "/v1/webhooks/ep_2RnZEJaiKHDTMoat2Hlm8JZuZpl/test", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'net/http'

uri = URI('http://sandboxapi.givechariot.com/v1/webhooks/ep_2RnZEJaiKHDTMoat2Hlm8JZuZpl/test')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer <ACCESS_TOKEN>'

req_options = {
  use_ssl: uri.scheme == 'https'
}
res = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
  http.request(req)
end

The webhookId in this request is the id of the Webhook created in Creating Your First Webhook.

This process allows you to verify that your webhook endpoint accurately handles the payload and executes the desired actions.