curl --request PUT \
--url https://api.wabox.me/account/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"single_url_enabled": true,
"single_url": "https://app.example/wabox/events",
"notify_sent_by_me": true
}
'const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
single_url_enabled: true,
single_url: 'https://app.example/wabox/events',
notify_sent_by_me: true
})
};
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"
payload = {
"single_url_enabled": True,
"single_url": "https://app.example/wabox/events",
"notify_sent_by_me": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, 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 => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'single_url_enabled' => true,
'single_url' => 'https://app.example/wabox/events',
'notify_sent_by_me' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.wabox.me/account/webhooks"
payload := strings.NewReader("{\n \"single_url_enabled\": true,\n \"single_url\": \"https://app.example/wabox/events\",\n \"notify_sent_by_me\": true\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
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"
}
}Atualizar webhooks do workspace (parcial)
Mesmos campos de PUT /webhooks da instância, menos use_workspace_webhooks. Só os campos enviados mudam. No primeiro PUT o Wabox gera o secret do workspace. Guarde-o para verificar X-Wabox-Signature das instâncias que herdam. Instâncias com URLs próprias (use_workspace_webhooks: false) não são afetadas.
Permissão da API key: webhooks:write.
curl --request PUT \
--url https://api.wabox.me/account/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"single_url_enabled": true,
"single_url": "https://app.example/wabox/events",
"notify_sent_by_me": true
}
'const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
single_url_enabled: true,
single_url: 'https://app.example/wabox/events',
notify_sent_by_me: true
})
};
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"
payload = {
"single_url_enabled": True,
"single_url": "https://app.example/wabox/events",
"notify_sent_by_me": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, 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 => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'single_url_enabled' => true,
'single_url' => 'https://app.example/wabox/events',
'notify_sent_by_me' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.wabox.me/account/webhooks"
payload := strings.NewReader("{\n \"single_url_enabled\": true,\n \"single_url\": \"https://app.example/wabox/events\",\n \"notify_sent_by_me\": true\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
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.
Body
Mudanças de status da instância (qr, connecting, connected, disconnected, logged_out…).
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).
Com true, também entrega received dos status (stories) publicados pelos contatos, com phone: "status@broadcast". Padrão false.
Response
Configuração após a alteração.
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