To begin utilizing webhooks and incorporating Webhooks into your application, the first step is to create a new Webhook using our APIs. In order to do this, you can send an POST request to the /v1/webhooks endpoint with your desired configuration:

curl --request POST \
  --url 'http://sandboxapi.givechariot.com/v1/webhooks' \
  --header 'content-type: application/json' \
  --header 'Authorization: Bearer <ACCESS_TOKEN>' \
  --data '{"url":"https://api.yourapi.com/chariot/webhooks","eventTypes":["grant.succeeded"],"description":"test webhook","disabled":false}'
using System.Net.Http;
using System.Net.Http.Headers;

HttpClient client = new HttpClient();

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

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

request.Content = new StringContent("{\"url\":\"https://api.yourapi.com/chariot/webhooks\",\"eventTypes\":[\"grant.succeeded\"],\"description\":\"test webhook\",\"disabled\":false}");
request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");

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

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

func main() {
	client := &http.Client{}
	var data = strings.NewReader(`{"url":"https://api.yourapi.com/chariot/webhooks","eventTypes":["grant.succeeded"],"description":"test webhook","disabled":false}`)
	req, err := http.NewRequest("POST", "http://sandboxapi.givechariot.com/v1/webhooks", data)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("content-type", "application/json")
	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.HttpRequest.BodyPublishers;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newHttpClient();

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("http://sandboxapi.givechariot.com/v1/webhooks"))
    .POST(BodyPublishers.ofString("{\"url\":\"https://api.yourapi.com/chariot/webhooks\",\"eventTypes\":[\"grant.succeeded\"],\"description\":\"test webhook\",\"disabled\":false}"))
    .setHeader("content-type", "application/json")
    .setHeader("Authorization", "Bearer <ACCESS_TOKEN>")
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
$.ajax({
  url: 'http://sandboxapi.givechariot.com/v1/webhooks',
  crossDomain: true,
  method: 'post',
  headers: {
    'Authorization': 'Bearer <ACCESS_TOKEN>'
  },
  contentType: 'application/json',
  data: JSON.stringify({
    'url': 'https://api.yourapi.com/chariot/webhooks',
    'eventTypes': [
      'grant.succeeded'
    ],
    'description': 'test webhook',
    'disabled': false
  })
}).done(function(response) {
  console.log(response);
});
var request = require('request');

var headers = {
    'content-type': 'application/json',
    'Authorization': 'Bearer <ACCESS_TOKEN>'
};

var dataString = '{"url":"https://api.yourapi.com/chariot/webhooks","eventTypes":["grant.succeeded"],"description":"test webhook","disabled":false}';

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

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');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'content-type: application/json',
    'Authorization: Bearer <ACCESS_TOKEN>',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"url":"https://api.yourapi.com/chariot/webhooks","eventTypes":["grant.succeeded"],"description":"test webhook","disabled":false}');

$response = curl_exec($ch);

curl_close($ch);
import http.client

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

payload = "{\"url\":\"https://api.yourapi.com/chariot/webhooks\",\"eventTypes\":[\"grant.succeeded\"],\"description\":\"test webhook\",\"disabled\":false}"

headers = {
    'content-type': "application/json",
    'Authorization': "Bearer <ACCESS_TOKEN>"
    }

conn.request("POST", "/v1/webhooks", payload, headers)

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

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

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

req.body = {
  'url' => 'https://api.yourapi.com/chariot/webhooks',
  'eventTypes' => [
    'grant.succeeded'
  ],
  'description' => 'test webhook',
  'disabled' => false
}.to_json

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

In the above example, you need to replace https://api.yourapi.com/chariot/webhooks with the actual URL where you want to receive webhook payloads. Additionally, you can specify the specific events you're interested in by modifying the eventTypes array according to your application's needs. See the Supported Events section below for a detailed list of our supported webhook event types.