Update webhook
Updates a webhook’s properties such as URL, topic, relation_id, or status.
Endpoint
Section titled “Endpoint”HTTP method: POST
https://api.sender.net/v2/account/webhooks/{id}
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
id | string required | The ID of the webhook you want to update. |
topic | string | The new topic for the webhook. Must be one of the supported topics. |
relation_id | string | Required if the selected topic is ‘groups/new-subscriber’ or ‘groups/unsubscribed’. |
url | string | The new webhook URL. |
status | string | The new status of the webhook. Can be ‘ACTIVE’ or ‘PAUSED’. |
Request Examples
Section titled “Request Examples”const url = new URL("https://api.sender.net/v2/account/webhooks/{id}");
let headers = { "Authorization": "Bearer [your-token]", "Content-Type": "application/json", "Accept": "application/json",};
let bodyContent = { "id": 1829, "topic": "campaigns/new", "url": "https://hooks.zapier.com/hooks/catch/12345", "status": "PAUSED"};
fetch(url, { method: "POST", headers, body: JSON.stringify(bodyContent)}).then(response => response.json()).then(data => console.log(data)).catch(error => console.error('Error:', error));$client = new \GuzzleHttp\Client();
$json = [ "id" => 1829, "topic" => "campaigns/new", "url" => "https =>//hooks.zapier.com/hooks/catch/12345", "status" => "PAUSED"];
$response = $client->post( 'https://api.sender.net/v2/account/webhooks/{id}', [ 'headers' => [ 'Authorization' => 'Bearer [your-token]', 'Content-Type' => 'application/json', 'Accept' => 'application/json', ], 'json' => $json ]);
$body = $response->getBody()->getContents();$data = json_decode($body, true);print_r($data);import requestsimport json
url = "https://api.sender.net/v2/account/webhooks/{id}"
headers = { "Authorization": "Bearer [your-token]", "Content-Type": "application/json", "Accept": "application/json",}
payload = { "id": 1829, "topic": "campaigns/new", "url": "https://hooks.zapier.com/hooks/catch/12345", "status": "PAUSED"}
response = requests.request('POST', url, headers=headers, json=payload)
print(response.json())curl -X POST \"https://api.sender.net/v2/account/webhooks/{id}" \-H "Authorization: Bearer [your-token]" \-H "Content-Type: application/json" \-H "Accept: application/json" \-d '{"id":1829,"topic":"campaigns/new","url":"https://hooks.zapier.com/hooks/catch/12345","status":"PAUSED"}'Response
Section titled “Response”{ "id": "1829", "account_id": "egy29b", "url": "https://hooks.zapier.com/hooks/catch/12345", "topic": "campaigns/new", "group": null, "total_deliveries": 117, "total_failures": 0, "response_time": 172, "status": "PAUSED"}