Criar webhook
curl --request POST \
--url https://api.aideskbr.com/api/public/v1/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://example.com/hooks/aidesk",
"event_types": [
"message.delivered",
"message.read",
"message.failed"
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'https://example.com/hooks/aidesk',
event_types: ['message.delivered', 'message.read', 'message.failed']
})
};
fetch('https://api.aideskbr.com/api/public/v1/webhooks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.aideskbr.com/api/public/v1/webhooks"
payload = {
"url": "https://example.com/hooks/aidesk",
"event_types": ["message.delivered", "message.read", "message.failed"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"secret": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"url": "<string>",
"status": "healthy",
"event_types": [
"message.sent"
],
"created_at": "2023-11-07T05:31:56Z"
}{
"error": {
"code": "api_key_required",
"message": "<string>"
}
}{
"error": {
"code": "api_key_required",
"message": "API key ausente"
}
}{
"error": {
"code": "missing_scope",
"message": "Scope insuficiente"
}
}{
"error": {
"code": "rate_limited",
"message": "Rate limit exceeded"
}
}Webhooks
Criar webhook
Cria endpoint de webhook. O secret (whsec_...) é retornado uma vez.
Scope webhooks:manage (não vem no default da key — peça na criação).
POST
https://api.aideskbr.com
/
api
/
public
/
v1
/
webhooks
Criar webhook
curl --request POST \
--url https://api.aideskbr.com/api/public/v1/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://example.com/hooks/aidesk",
"event_types": [
"message.delivered",
"message.read",
"message.failed"
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'https://example.com/hooks/aidesk',
event_types: ['message.delivered', 'message.read', 'message.failed']
})
};
fetch('https://api.aideskbr.com/api/public/v1/webhooks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.aideskbr.com/api/public/v1/webhooks"
payload = {
"url": "https://example.com/hooks/aidesk",
"event_types": ["message.delivered", "message.read", "message.failed"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"secret": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"url": "<string>",
"status": "healthy",
"event_types": [
"message.sent"
],
"created_at": "2023-11-07T05:31:56Z"
}{
"error": {
"code": "api_key_required",
"message": "<string>"
}
}{
"error": {
"code": "api_key_required",
"message": "API key ausente"
}
}{
"error": {
"code": "missing_scope",
"message": "Scope insuficiente"
}
}{
"error": {
"code": "rate_limited",
"message": "Rate limit exceeded"
}
}Authorizations
bearerAuthapiKeyAuth
Authorization: Bearer ak_live_
Body
application/json