API
Anmelden
Dokumentation › Status-Webhook › Status-Webhook — SMS
POST

Status-Webhook — SMS

POSThttps://app.sendapp.ai/api/sms/set_webhook
Registrieren Sie (POST) eine URL auf Ihrem Server, um SMS-Ereignisse in Echtzeit zu empfangen (sms_received, device.disconnected, device.reconnected, device.deleted). Jedes Ereignis wird per HTTP POST an Ihre URL weitergeleitet. Verwenden Sie DELETE, um den Webhook zu entfernen.
Ihr Server muss innerhalb von 5 Sekunden mit HTTP 200 antworten. Fehler an Ihrem Endpunkt werden stillschweigend ignoriert.
Parameter
apikey erforderlich
Ihr API Key.
token erforderlich
Konto-Token.
url optional
Ihre Server-URL (HTTPS). Für DELETE nicht erforderlich.
Anfrage
# Webhook registrieren
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" }'

# Webhook entfernen
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());
Antwort (200 OK)
{
  "status": "success",
  "message": "Webhook URL saved successfully."
}
Fehler
{
  "status": "error",
  "message": "Instance not found"
}