curl --request GET \
--url https://api.wabox.me/account/webhooks \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.wabox.me/account/webhooks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.wabox.me/account/webhooks"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.wabox.me/account/webhooks",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.wabox.me/account/webhooks"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"received_url": null,
"delivery_url": null,
"message_status_url": null,
"instance_status_url": null,
"chat_presence_url": null,
"single_url_enabled": true,
"single_url": "https://app.example/wabox/events",
"notify_sent_by_me": true,
"notify_status": false,
"ignore_groups": false,
"ignore_private": false,
"ignore_text": false,
"ignore_image": false,
"ignore_video": false,
"ignore_audio": false,
"ignore_document": false,
"ignore_received_callback": false,
"ignore_delivery_callback": false,
"ignore_message_status_callback": false,
"ignore_instance_status_callback": false,
"ignore_chat_presence_callback": true,
"secret": "whsec_4b1d9e8f7a6c5d4e3f2a1b0c9d8e7f6a",
"configured": true,
"used_by_instances": 42
}{
"error": {
"code": "api_key_required",
"message": "Invalid API key"
}
}Webhooks do workspace
URLs, filtros e secret que toda instância do workspace com use_workspace_webhooks: true herda (é o padrão de instância criada sem webhooks). Configure uma vez aqui em vez de repetir por instância. O Wabox assina as entregas dessas instâncias com este secret, um só para o workspace. configured: false indica que a configuração nunca foi salva, então nada é entregue para quem herda. used_by_instances é o número de instâncias ativas que herdam agora.
Permissão da API key: webhooks:read.
curl --request GET \
--url https://api.wabox.me/account/webhooks \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.wabox.me/account/webhooks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.wabox.me/account/webhooks"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.wabox.me/account/webhooks",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.wabox.me/account/webhooks"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"received_url": null,
"delivery_url": null,
"message_status_url": null,
"instance_status_url": null,
"chat_presence_url": null,
"single_url_enabled": true,
"single_url": "https://app.example/wabox/events",
"notify_sent_by_me": true,
"notify_status": false,
"ignore_groups": false,
"ignore_private": false,
"ignore_text": false,
"ignore_image": false,
"ignore_video": false,
"ignore_audio": false,
"ignore_document": false,
"ignore_received_callback": false,
"ignore_delivery_callback": false,
"ignore_message_status_callback": false,
"ignore_instance_status_callback": false,
"ignore_chat_presence_callback": true,
"secret": "whsec_4b1d9e8f7a6c5d4e3f2a1b0c9d8e7f6a",
"configured": true,
"used_by_instances": 42
}{
"error": {
"code": "api_key_required",
"message": "Invalid API key"
}
}Authorizations
API key do workspace (painel › Segurança › API keys), enviada em Authorization: Bearer wbx_key_…. Cada key tem permissões. As rotas /account/* pedem a permissão da rota. Nas rotas de instância, a key só é exigida quando o workspace liga "Exigir API key" e precisa de instances:operate.
Response
Configuração do workspace.
URL http(s) ou null (desligado).
URL http(s) ou null (desligado).
URL http(s) ou null (desligado).
URL http(s) ou null (desligado).
URL http(s) ou null (desligado).
Com true, todos os eventos vão para single_url e as *_url por tipo são ignoradas.
URL única para todos os eventos (quando single_url_enabled).
Entrega received dos status (stories) dos contatos (status@broadcast).
Chave HMAC do X-Wabox-Signature para toda instância que herda esta configuração (use_workspace_webhooks). Gerada no primeiro PUT.
false até o primeiro PUT (nada a herdar ainda).
Instâncias ativas que herdam esta configuração no momento.
-9007199254740991 <= x <= 9007199254740991