Skip to content

Create webhook

Creates a new webhook with specified URL and topic.

HTTP method: POST

https://api.sender.net/v2/account/webhooks


ParameterTypeDescription
urlstring requiredWebhook endpoint URL.
topicstring requiredAvailable topics to create webhook:
relation_idstringRelation ID is required only if topic is groups/new-subscriber or groups/unsubscribed. Please provide the group which want to be tracked.

const url = new URL("https://api.sender.net/v2/account/webhooks");
let headers = {
"Authorization": "Bearer [your-token]",
"Content-Type": "application/json",
"Accept": "application/json",
};
let bodyContent = {
"url": "https://webhook.site/da83f596-5bc3-48d3-8bab-f8203a5847af",
"topic": "groups/new-subscriber",
"relation_id": "eZVD4w"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(bodyContent)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));

Example Response
{
"id": "QbY0Wa",
"account_id": "Eqqve",
"url": "https://webhook.site/da83f596-5bc3-48d3-8bab-f8203a5847af",
"topic": "groups/new-subscriber",
"group": "eZVD4w",
"total_deliveries": 0,
"total_failures": 0,
"response_time": 0,
"status": "ACTIVE"
}