Create a webhook endpoint
curl --request POST \
--url https://api.sendbaze.com/v1/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://api.yourshop.co.za/webhooks/sendbaze",
"description": "Production CRM sync",
"events": [
"email.bounced",
"email.complained",
"email.unsubscribed"
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'https://api.yourshop.co.za/webhooks/sendbaze',
description: 'Production CRM sync',
events: ['email.bounced', 'email.complained', 'email.unsubscribed']
})
};
fetch('https://api.sendbaze.com/v1/webhooks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.sendbaze.com/v1/webhooks"
payload = {
"url": "https://api.yourshop.co.za/webhooks/sendbaze",
"description": "Production CRM sync",
"events": ["email.bounced", "email.complained", "email.unsubscribed"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)require 'uri'
require 'net/http'
url = URI("https://api.sendbaze.com/v1/webhooks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://api.yourshop.co.za/webhooks/sendbaze\",\n \"description\": \"Production CRM sync\",\n \"events\": [\n \"email.bounced\",\n \"email.complained\",\n \"email.unsubscribed\"\n ]\n}"
response = http.request(request)
puts response.read_body<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sendbaze.com/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([
'url' => 'https://api.yourshop.co.za/webhooks/sendbaze',
'description' => 'Production CRM sync',
'events' => [
'email.bounced',
'email.complained',
'email.unsubscribed'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api.sendbaze.com/v1/webhooks"
payload := strings.NewReader("{\n \"url\": \"https://api.yourshop.co.za/webhooks/sendbaze\",\n \"description\": \"Production CRM sync\",\n \"events\": [\n \"email.bounced\",\n \"email.complained\",\n \"email.unsubscribed\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}{
"id": "whk_01j9x7k2r4m8q3v5n6b7c8d9e0",
"url": "<string>",
"description": "<string>",
"events": [
"<string>"
],
"enabled": true,
"disabledReason": "<string>",
"secretPrefix": "whsec_a1b2c3",
"failingSince": "2023-11-07T05:31:56Z",
"lastSuccessAt": "2023-11-07T05:31:56Z",
"lastFailureAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"secret": "<string>"
}{
"error": {
"code": "validation_error",
"message": "<string>",
"docs": "<string>",
"fields": {},
"limit": 123,
"upgradeUrl": "<string>",
"topUpUrl": "<string>",
"settingsUrl": "<string>",
"domainsUrl": "<string>"
}
}{
"error": {
"code": "validation_error",
"message": "The request has invalid fields.",
"docs": "https://docs.sendbaze.com/errors#validation_error",
"fields": {
"to.1": [
"must be a valid email address"
]
}
}
}{
"error": {
"code": "validation_error",
"message": "<string>",
"docs": "<string>",
"fields": {},
"limit": 123,
"upgradeUrl": "<string>",
"topUpUrl": "<string>",
"settingsUrl": "<string>",
"domainsUrl": "<string>"
}
}Webhooks
Create a webhook endpoint
The response includes secret exactly once; it is stored encrypted and never returned again. Requires webhooks:write.
POST
/
v1
/
webhooks
Create a webhook endpoint
curl --request POST \
--url https://api.sendbaze.com/v1/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://api.yourshop.co.za/webhooks/sendbaze",
"description": "Production CRM sync",
"events": [
"email.bounced",
"email.complained",
"email.unsubscribed"
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'https://api.yourshop.co.za/webhooks/sendbaze',
description: 'Production CRM sync',
events: ['email.bounced', 'email.complained', 'email.unsubscribed']
})
};
fetch('https://api.sendbaze.com/v1/webhooks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.sendbaze.com/v1/webhooks"
payload = {
"url": "https://api.yourshop.co.za/webhooks/sendbaze",
"description": "Production CRM sync",
"events": ["email.bounced", "email.complained", "email.unsubscribed"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)require 'uri'
require 'net/http'
url = URI("https://api.sendbaze.com/v1/webhooks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://api.yourshop.co.za/webhooks/sendbaze\",\n \"description\": \"Production CRM sync\",\n \"events\": [\n \"email.bounced\",\n \"email.complained\",\n \"email.unsubscribed\"\n ]\n}"
response = http.request(request)
puts response.read_body<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sendbaze.com/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([
'url' => 'https://api.yourshop.co.za/webhooks/sendbaze',
'description' => 'Production CRM sync',
'events' => [
'email.bounced',
'email.complained',
'email.unsubscribed'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api.sendbaze.com/v1/webhooks"
payload := strings.NewReader("{\n \"url\": \"https://api.yourshop.co.za/webhooks/sendbaze\",\n \"description\": \"Production CRM sync\",\n \"events\": [\n \"email.bounced\",\n \"email.complained\",\n \"email.unsubscribed\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}{
"id": "whk_01j9x7k2r4m8q3v5n6b7c8d9e0",
"url": "<string>",
"description": "<string>",
"events": [
"<string>"
],
"enabled": true,
"disabledReason": "<string>",
"secretPrefix": "whsec_a1b2c3",
"failingSince": "2023-11-07T05:31:56Z",
"lastSuccessAt": "2023-11-07T05:31:56Z",
"lastFailureAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"secret": "<string>"
}{
"error": {
"code": "validation_error",
"message": "<string>",
"docs": "<string>",
"fields": {},
"limit": 123,
"upgradeUrl": "<string>",
"topUpUrl": "<string>",
"settingsUrl": "<string>",
"domainsUrl": "<string>"
}
}{
"error": {
"code": "validation_error",
"message": "The request has invalid fields.",
"docs": "https://docs.sendbaze.com/errors#validation_error",
"fields": {
"to.1": [
"must be a valid email address"
]
}
}
}{
"error": {
"code": "validation_error",
"message": "<string>",
"docs": "<string>",
"fields": {},
"limit": 123,
"upgradeUrl": "<string>",
"topUpUrl": "<string>",
"settingsUrl": "<string>",
"domainsUrl": "<string>"
}
}Authorizations
An API key from the dashboard. sk_live_… sends; sk_test_… validates and returns ids without sending.
Body
application/json
https URL that answers 2xx within 10 seconds. Private and local addresses are refused.
Maximum string length:
200Omit or send [] for every event.
Available options:
email.sent, email.delivered, email.bounced, email.complained, email.failed, email.unsubscribed, sms.sent, sms.delivered, sms.failed, sms.opted_out, usage.threshold, credits.low, billing.payment_failed Response
Created, with the signing secret
Example:
"whk_01j9x7k2r4m8q3v5n6b7c8d9e0"
Empty means every event.
Example:
"whsec_a1b2c3"
Shown once. Verify signatures with it.