Crear webhook de línea
⚠️ Efecto real: esto NO es una simulación, ni siquiera desde el playground. Crea un webhook de líneas telefónicas y responde 201 con { "webhook": { … } }, incluido secret: el secreto de firma plwh_…. Es la única vez que se devuelve: guárdalo de inmediato (la respuesta se envía con Cache-Control: no-store). No hay rotación: para cambiarlo, crea un webhook nuevo, pasa tu receptor a su secreto y elimina el anterior.
Por OAuth/MCP la creación se registra primero en la auditoría; si ese registro no se puede escribir, el webhook igual se crea, pero secret vuelve null con secretWithheld: true, secretWithheldReason y secretWithheldCode: "OAUTH_SECRET_AUDIT_UNAVAILABLE".
No es idempotente: dos llamadas crean dos webhooks, cada uno con su propio secreto. Un workspace puede tener más de un webhook de líneas telefónicas; cada uno recibe los eventos a los que se suscribió. Los eventos nunca se reenvían a un webhook creado después de ellos.
Permisos: con una clave de cuenta (ps_account_) o un token OAuth / MCP, el usuario debe ser Owner o Admin (phone_lines:webhooks); en otro caso, 403 PERMISSION_DENIED.
Todo endpoint /v1/phone-lines acepta solo una clave con alcance de tenant: los webhooks de líneas telefónicas pertenecen al workspace, no a un número de WhatsApp, así que una clave con alcance de número (o un permiso OAuth por número) recibe 403 NUMBER_SCOPE_NOT_ALLOWED antes de revisar cualquier rol. Un 403 PERMISSION_DENIED / WORKSPACE_MEMBERSHIP_REQUIRED se envía con Cache-Control: no-store.
Estos son los webhooks de líneas telefónicas, un registro separado de /v1/webhooks: reciben solo eventos phone_line.*, y un webhook de número nunca recibe uno.
Requiere una clave con alcance de tenant.
curl --request POST \
--url https://pilotstatus.com.br/v1/phone-lines/webhooks \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"url": "https://hooks.example.com/pilot/phone-lines",
"events": [
"*"
]
}
'import requests
url = "https://pilotstatus.com.br/v1/phone-lines/webhooks"
payload = {
"url": "https://hooks.example.com/pilot/phone-lines",
"events": ["*"]
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({url: 'https://hooks.example.com/pilot/phone-lines', events: ['*']})
};
fetch('https://pilotstatus.com.br/v1/phone-lines/webhooks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://pilotstatus.com.br/v1/phone-lines/webhooks",
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://hooks.example.com/pilot/phone-lines',
'events' => [
'*'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://pilotstatus.com.br/v1/phone-lines/webhooks"
payload := strings.NewReader("{\n \"url\": \"https://hooks.example.com/pilot/phone-lines\",\n \"events\": [\n \"*\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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))
}HttpResponse<String> response = Unirest.post("https://pilotstatus.com.br/v1/phone-lines/webhooks")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://hooks.example.com/pilot/phone-lines\",\n \"events\": [\n \"*\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pilotstatus.com.br/v1/phone-lines/webhooks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://hooks.example.com/pilot/phone-lines\",\n \"events\": [\n \"*\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"webhook": {
"id": "cmh1w8b2k0001wh8example3d",
"name": "hooks.example.com",
"url": "https://hooks.example.com/pilot/phone-lines",
"events": [
"*"
],
"active": true,
"secret": "plwh_3f9c1a7e5b2d4c6e8a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d",
"createdAt": "2026-10-27T13:58:02.000Z"
}
}plwh_ solo esta vez: cópielo de la respuesta antes de salir de la página, porque nada vuelve a mostrarlo. Consulte Configurar.Encabezados
Cuerpo
Debe ser https y apuntar a una dirección pública. Una URL que apunta a una dirección de red interna o privada (localhost, una IP de loopback o privada, un host sin punto, o un nombre que resuelve a una de ellas) → 400 WEBHOOK_URL_REFUSED.
"https://hooks.example.com/pilot/phone-lines"
Uno o más de los eventos de líneas telefónicas, o "*" para todos (dentro de este registro "*" significa todos los eventos de líneas telefónicas, incluidos los que se agreguen después). Los duplicados se eliminan. Una lista vacía o un evento desconocido → 400 INVALID_WEBHOOK.
1phone_line.purchased, phone_line.audio_received, phone_line.code_received, phone_line.code_failed, phone_line.renewed, phone_line.payment_failed, phone_line.suspended, phone_line.returned, phone_line.canceled, phone_line.verification_updated, * ["*"]
¿Esta página le ayudó?
curl --request POST \
--url https://pilotstatus.com.br/v1/phone-lines/webhooks \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"url": "https://hooks.example.com/pilot/phone-lines",
"events": [
"*"
]
}
'import requests
url = "https://pilotstatus.com.br/v1/phone-lines/webhooks"
payload = {
"url": "https://hooks.example.com/pilot/phone-lines",
"events": ["*"]
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({url: 'https://hooks.example.com/pilot/phone-lines', events: ['*']})
};
fetch('https://pilotstatus.com.br/v1/phone-lines/webhooks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://pilotstatus.com.br/v1/phone-lines/webhooks",
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://hooks.example.com/pilot/phone-lines',
'events' => [
'*'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://pilotstatus.com.br/v1/phone-lines/webhooks"
payload := strings.NewReader("{\n \"url\": \"https://hooks.example.com/pilot/phone-lines\",\n \"events\": [\n \"*\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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))
}HttpResponse<String> response = Unirest.post("https://pilotstatus.com.br/v1/phone-lines/webhooks")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://hooks.example.com/pilot/phone-lines\",\n \"events\": [\n \"*\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pilotstatus.com.br/v1/phone-lines/webhooks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://hooks.example.com/pilot/phone-lines\",\n \"events\": [\n \"*\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"webhook": {
"id": "cmh1w8b2k0001wh8example3d",
"name": "hooks.example.com",
"url": "https://hooks.example.com/pilot/phone-lines",
"events": [
"*"
],
"active": true,
"secret": "plwh_3f9c1a7e5b2d4c6e8a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d",
"createdAt": "2026-10-27T13:58:02.000Z"
}
}