Create a webhook
curl --request POST \
--url https://api.bigco.ai/api/v1/webhooks \
--header 'Content-Type: application/json' \
--header 'x-bigco-hmac-sha256: <api-key>' \
--data '
{
"webhook": {
"topic": "user/opt-in",
"address": "https://example.com/webhooks/callback"
}
}
'import requests
url = "https://api.bigco.ai/api/v1/webhooks"
payload = { "webhook": {
"topic": "user/opt-in",
"address": "https://example.com/webhooks/callback"
} }
headers = {
"x-bigco-hmac-sha256": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-bigco-hmac-sha256': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
webhook: {topic: 'user/opt-in', address: 'https://example.com/webhooks/callback'}
})
};
fetch('https://api.bigco.ai/api/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://api.bigco.ai/api/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([
'webhook' => [
'topic' => 'user/opt-in',
'address' => 'https://example.com/webhooks/callback'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-bigco-hmac-sha256: <api-key>"
],
]);
$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.bigco.ai/api/v1/webhooks"
payload := strings.NewReader("{\n \"webhook\": {\n \"topic\": \"user/opt-in\",\n \"address\": \"https://example.com/webhooks/callback\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-bigco-hmac-sha256", "<api-key>")
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://api.bigco.ai/api/v1/webhooks")
.header("x-bigco-hmac-sha256", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"webhook\": {\n \"topic\": \"user/opt-in\",\n \"address\": \"https://example.com/webhooks/callback\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bigco.ai/api/v1/webhooks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-bigco-hmac-sha256"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"webhook\": {\n \"topic\": \"user/opt-in\",\n \"address\": \"https://example.com/webhooks/callback\"\n }\n}"
response = http.request(request)
puts response.read_body{
"webhook": {
"topic": "user/opt-in",
"address": "https://example.com/webhooks/callback",
"id": "123e4567-e89b-12d3-a456-426614174000",
"date_created": "2024-01-01T12:00:00Z",
"date_last_updated": "2024-01-01T12:00:00Z",
"version": "v1"
}
}{
"detail": {
"type": "not_authenticated",
"msg": "HMAC signature verification failed"
}
}{
"detail": {
"type": "not_authenticated",
"msg": "HMAC signature verification failed"
}
}{
"detail": {
"type": "UNCAUGHT_ERROR",
"msg": "Internal server error"
}
}Registers a new webhook subscription. A brand may have multiple webhooks, and the same address may subscribe to the same topic more than once. In non-development environments the address must be an HTTPS URL.
POST
/
webhooks
Create a webhook
curl --request POST \
--url https://api.bigco.ai/api/v1/webhooks \
--header 'Content-Type: application/json' \
--header 'x-bigco-hmac-sha256: <api-key>' \
--data '
{
"webhook": {
"topic": "user/opt-in",
"address": "https://example.com/webhooks/callback"
}
}
'import requests
url = "https://api.bigco.ai/api/v1/webhooks"
payload = { "webhook": {
"topic": "user/opt-in",
"address": "https://example.com/webhooks/callback"
} }
headers = {
"x-bigco-hmac-sha256": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-bigco-hmac-sha256': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
webhook: {topic: 'user/opt-in', address: 'https://example.com/webhooks/callback'}
})
};
fetch('https://api.bigco.ai/api/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://api.bigco.ai/api/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([
'webhook' => [
'topic' => 'user/opt-in',
'address' => 'https://example.com/webhooks/callback'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-bigco-hmac-sha256: <api-key>"
],
]);
$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.bigco.ai/api/v1/webhooks"
payload := strings.NewReader("{\n \"webhook\": {\n \"topic\": \"user/opt-in\",\n \"address\": \"https://example.com/webhooks/callback\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-bigco-hmac-sha256", "<api-key>")
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://api.bigco.ai/api/v1/webhooks")
.header("x-bigco-hmac-sha256", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"webhook\": {\n \"topic\": \"user/opt-in\",\n \"address\": \"https://example.com/webhooks/callback\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bigco.ai/api/v1/webhooks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-bigco-hmac-sha256"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"webhook\": {\n \"topic\": \"user/opt-in\",\n \"address\": \"https://example.com/webhooks/callback\"\n }\n}"
response = http.request(request)
puts response.read_body{
"webhook": {
"topic": "user/opt-in",
"address": "https://example.com/webhooks/callback",
"id": "123e4567-e89b-12d3-a456-426614174000",
"date_created": "2024-01-01T12:00:00Z",
"date_last_updated": "2024-01-01T12:00:00Z",
"version": "v1"
}
}{
"detail": {
"type": "not_authenticated",
"msg": "HMAC signature verification failed"
}
}{
"detail": {
"type": "not_authenticated",
"msg": "HMAC signature verification failed"
}
}{
"detail": {
"type": "UNCAUGHT_ERROR",
"msg": "Internal server error"
}
}Authorizations
Base64-encoded HMAC-SHA256 signature of the request. Every request must also include the x-bigco-hmac-username and x-date headers, and POST/PUT requests must include x-digest. See the Authentication guide for the full signing procedure.
Body
application/json
Show child attributes
Show child attributes
Response
The created webhook subscription.
Show child attributes
Show child attributes
⌘I