curl --request POST \
--url https://api.routa.chat/v1/webhook_endpoints \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://exemplo.com/webhooks/routa",
"subscribed_types": [
"message.*",
"channel.status_changed"
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'https://exemplo.com/webhooks/routa',
subscribed_types: ['message.*', 'channel.status_changed']
})
};
fetch('https://api.routa.chat/v1/webhook_endpoints', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.routa.chat/v1/webhook_endpoints"
payload = {
"url": "https://exemplo.com/webhooks/routa",
"subscribed_types": ["message.*", "channel.status_changed"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.routa.chat/v1/webhook_endpoints",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'url' => 'https://exemplo.com/webhooks/routa',
'subscribed_types' => [
'message.*',
'channel.status_changed'
]
]),
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.routa.chat/v1/webhook_endpoints"
payload := strings.NewReader("{\n \"url\": \"https://exemplo.com/webhooks/routa\",\n \"subscribed_types\": [\n \"message.*\",\n \"channel.status_changed\"\n ]\n}")
req, _ := http.NewRequest("POST", 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))
}{
"id": "whe_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"url": "https://exemplo.com/webhooks/routa",
"subscribed_types": [
"<string>"
],
"api_version": "<string>",
"status": "enabled",
"consecutive_failures": 123,
"last_success_at": "2023-11-07T05:31:56Z",
"last_failure_at": "2023-11-07T05:31:56Z",
"created_at": "2026-09-04T13:22:41.031Z",
"secret": "whsec_..."
}{
"error": {
"type": "invalid_request_error",
"code": "channel_inactive",
"message": "Channel chan_01J8... is not active and cannot send messages.",
"request_id": "req_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"param": "<string>",
"doc_url": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request_error",
"code": "channel_inactive",
"message": "Channel chan_01J8... is not active and cannot send messages.",
"request_id": "req_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"param": "<string>",
"doc_url": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request_error",
"code": "channel_inactive",
"message": "Channel chan_01J8... is not active and cannot send messages.",
"request_id": "req_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"param": "<string>",
"doc_url": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request_error",
"code": "channel_inactive",
"message": "Channel chan_01J8... is not active and cannot send messages.",
"request_id": "req_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"param": "<string>",
"doc_url": "<string>",
"details": {}
}
}Criar endpoint de webhook
Registra uma URL para receber eventos. A resposta inclui o secret de assinatura, exibido uma única vez. Guarde-o para verificar as assinaturas.
A URL deve usar HTTPS e não pode apontar para endereços privados. http://localhost é aceito apenas em projetos de teste. Cada projeto pode ter até 5 endpoints.
curl --request POST \
--url https://api.routa.chat/v1/webhook_endpoints \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://exemplo.com/webhooks/routa",
"subscribed_types": [
"message.*",
"channel.status_changed"
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'https://exemplo.com/webhooks/routa',
subscribed_types: ['message.*', 'channel.status_changed']
})
};
fetch('https://api.routa.chat/v1/webhook_endpoints', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.routa.chat/v1/webhook_endpoints"
payload = {
"url": "https://exemplo.com/webhooks/routa",
"subscribed_types": ["message.*", "channel.status_changed"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.routa.chat/v1/webhook_endpoints",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'url' => 'https://exemplo.com/webhooks/routa',
'subscribed_types' => [
'message.*',
'channel.status_changed'
]
]),
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.routa.chat/v1/webhook_endpoints"
payload := strings.NewReader("{\n \"url\": \"https://exemplo.com/webhooks/routa\",\n \"subscribed_types\": [\n \"message.*\",\n \"channel.status_changed\"\n ]\n}")
req, _ := http.NewRequest("POST", 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))
}{
"id": "whe_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"url": "https://exemplo.com/webhooks/routa",
"subscribed_types": [
"<string>"
],
"api_version": "<string>",
"status": "enabled",
"consecutive_failures": 123,
"last_success_at": "2023-11-07T05:31:56Z",
"last_failure_at": "2023-11-07T05:31:56Z",
"created_at": "2026-09-04T13:22:41.031Z",
"secret": "whsec_..."
}{
"error": {
"type": "invalid_request_error",
"code": "channel_inactive",
"message": "Channel chan_01J8... is not active and cannot send messages.",
"request_id": "req_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"param": "<string>",
"doc_url": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request_error",
"code": "channel_inactive",
"message": "Channel chan_01J8... is not active and cannot send messages.",
"request_id": "req_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"param": "<string>",
"doc_url": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request_error",
"code": "channel_inactive",
"message": "Channel chan_01J8... is not active and cannot send messages.",
"request_id": "req_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"param": "<string>",
"doc_url": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request_error",
"code": "channel_inactive",
"message": "Channel chan_01J8... is not active and cannot send messages.",
"request_id": "req_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"param": "<string>",
"doc_url": "<string>",
"details": {}
}
}Authorizations
Chave de API do projeto, no formato rt_live_... ou rt_test_..., enviada como Authorization: Bearer <chave>.
Body
URL HTTPS que recebe os eventos. http:// é aceito apenas para localhost em projetos de teste.
"https://exemplo.com/webhooks/routa"
Tipos de evento ou curingas por recurso (message.*, channel.*, template.*). Pelo menos um.
1["message.*", "channel.status_changed"]
Response
Recurso criado
Identificador do endpoint.
"whe_01J8ZK9M3Q7XABCDEFGHJKMNPQ"
URL que recebe os eventos.
"https://exemplo.com/webhooks/routa"
Tipos de evento assinados, incluindo curingas como message.*.
Versão da API fixada na criação do endpoint.
Estado do endpoint: enabled, disabled_by_user ou disabled_by_system.
enabled, disabled_by_user, disabled_by_system Falhas consecutivas de entrega. Zera a cada sucesso.
Último sucesso de entrega, ou null.
Última falha de entrega, ou null.
Quando o endpoint foi criado.
"2026-09-04T13:22:41.031Z"
Segredo de assinatura. Exibido apenas na criação e na rotação. Guarde-o com segurança.
"whsec_..."