API
Iniciar sesión
Documentación › Webhook de estado › Webhook de estado — SMS
POST

Webhook de estado — SMS

POSThttps://app.sendapp.ai/api/sms/set_webhook
Registra (POST) una URL en tu servidor para recibir eventos SMS en tiempo real (sms_received, device.disconnected, device.reconnected, device.deleted). Cada evento se reenvía a tu URL mediante HTTP POST. Usa DELETE para eliminar el webhook.
Tu servidor debe responder con HTTP 200 en un plazo de 5 segundos. Los errores en tu endpoint se ignoran silenciosamente.
Parámetros
apikey obligatorio
Tu API Key.
token obligatorio
Token de la cuenta.
url opcional
La URL de tu servidor (HTTPS). No necesaria para DELETE.
Solicitud
# Registrar el webhook
curl -X POST 'https://app.sendapp.ai/api/sms/set_webhook' \
  -H 'Content-Type: application/json' \
  -d '{ "apikey": "YOUR_API_KEY", "token": "YOUR_ACCOUNT_TOKEN", "url": "https://your-server.com/sms-webhook" }'

# Eliminar el webhook
curl -X DELETE 'https://app.sendapp.ai/api/sms/set_webhook' \
  -H 'Content-Type: application/json' \
  -d '{ "apikey": "YOUR_API_KEY", "token": "YOUR_ACCOUNT_TOKEN" }'
<?php
$ch = curl_init('https://app.sendapp.ai/api/sms/set_webhook');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
    CURLOPT_POSTFIELDS => json_encode([
        'apikey' => 'YOUR_API_KEY',
        'token'  => 'YOUR_ACCOUNT_TOKEN',
        'url'    => 'https://your-server.com/sms-webhook',
    ]),
]);
echo curl_exec($ch);
curl_close($ch);
const res = await fetch('https://app.sendapp.ai/api/sms/set_webhook', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    apikey: 'YOUR_API_KEY',
    token: 'YOUR_ACCOUNT_TOKEN',
    url: 'https://your-server.com/sms-webhook'
  })
});
console.log(await res.json());
Respuesta (200 OK)
{
  "status": "success",
  "message": "Webhook URL saved successfully."
}
Error
{
  "status": "error",
  "message": "Instance not found"
}