List all existing webhooks
This endpoint will return all configured and enabled webhooks you have in your 2Chat account.
Invocation
- cURL
- Python
- NodeJS
curl -L -G 'https://api.p.2chat.io/open/webhooks' \
--header 'X-User-API-Key: your_api_key_here'
import requests
url = "https://api.p.2chat.io/open/webhooks"
payload = ""
headers = {
'X-User-API-Key': 'your_api_key_here'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
var axios = require('axios');
var data = '';
var config = {
method: 'get',
url: 'https://api.p.2chat.io/open/webhooks',
headers: {
'X-User-API-Key': 'your_api_key_here'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Response
A list of enabled webhooks will be returned together with their corresponding information
{
"success": true,
"webhooks": [
{
"uuid": "WHKdc78c87e-5b18-47c7-9183-5bf527fd6c69",
"event_name": "whatsapp.message.received",
"channel_uuid": "WPN95841312-b54d-46e3-b0bc-6414f4a5296b",
"hook_url": "https://www.toptal.com/developers/postbin/1681755466939-3421728690154",
"hook_params": {
"waweb_uuid": "WPN95841312-b54d-46e3-b0bc-6414f4a5296b"
},
"created_at": "2023-04-17T18:50:50Z"
},
{
"uuid": "WHKe768c62c-d41f-49a9-82ff-8982a0683902",
"event_name": "whatsapp.message.sent",
"channel_uuid": "WPN95841312-b54d-46e3-b0bc-6414f4a5296b",
"hook_url": "https://www.toptal.com/developers/postbin/1681755466939-3421728690154",
"hook_params": {
"waweb_uuid": "WPN95841312-b54d-46e3-b0bc-6414f4a5296b"
},
"created_at": "2023-04-17T18:50:45Z"
}
]
}
Field | Description | Example values |
---|---|---|
uuid | The unique identifier of the webhook that you will need to make changes to it | WHKdc78c87e-5b18-47c7-9183-5bf527fd6c69 |
event_name | The name of the event this webhook is subscribed to | whatsapp.call.received . |
channel_uuid | The unique UUID of the channel this webhook is subscribed to | WPN95841312-b54d-46e3-b0bc-6414f4a5296b |
hook_url | The URL 2Chat will call when a event is triggered | https://my-dev-server |
hook_params | Custom parameters 2Chat sets to make the webhook functional | {} |
created_at | UTC timestamp for when the webhook was created | 2023-04-17T18:50:45Z |