Delete an existing webhoook subscription
With this endpoint you will be able to delete webhooks you have previously created using this API.
Requirements
The query path in the invocation URL must have the ID of the webhook you want to delete. This ID always start with
WHK
followed by 36 characters. For example: WHK530c9d58-2259-4ce2-82a8-1941f3a60665
.
If you want to obtain the ID required to delete a webhook, you can do so using the List All Webhooks endpoint.
Invocation
Using the webhook ID WHK530c9d58-2259-4ce2-82a8-1941f3a60665
as example:
- cURL
- Python
- NodeJS
curl --location --request DELETE 'https://api.p.2chat.io/open/webhooks/WHK530c9d58-2259-4ce2-82a8-1941f3a60665' \
--header 'X-User-API-Key: your_api_key_here' \
--data ''
import requests
url = "https://api.p.2chat.io/open/webhooks/WHK530c9d58-2259-4ce2-82a8-1941f3a60665"
payload = ""
headers = {
'X-User-API-Key': 'your_api_key_here'
}
response = requests.request("DELETE", url, headers=headers, data=payload)
print(response.text)
const axios = require('axios');
let data = '';
let config = {
method: 'delete',
maxBodyLength: Infinity,
url: 'https://api.p.2chat.io/open/webhooks/WHK530c9d58-2259-4ce2-82a8-1941f3a60665',
headers: {
'X-User-API-Key': 'your_api_key_here'
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
Response
The API will return a successful respond if the webhook was correctly deleted
{
"success": true
}