API
Accedi
Documentazione › Webhook di stato › Webhook di stato — WhatsApp Meta
POST

Webhook di stato — WhatsApp Meta

POSThttps://app.sendapp.ai/api/whatsapp-meta/set_webhook
Registra (POST) un URL sul tuo server per ricevere in tempo reale gli eventi di stato dei messaggi Meta (sent, delivered, read, failed) e gli eventi inbound. Ogni evento webhook di Meta viene inoltrato così com'è al tuo URL via HTTP POST. Usa DELETE per rimuovere il webhook registrato.
Il tuo server deve rispondere con HTTP 200 entro 5 secondi. Gli errori sul tuo endpoint vengono ignorati silenziosamente.
Parametri
apikey obbligatorio
La tua API Key.
token obbligatorio
Token dell'account.
url opzionale
Il tuo URL server (HTTPS). Non necessario per la DELETE.
Richiesta
# Registra il webhook
curl -X POST 'https://app.sendapp.ai/api/whatsapp-meta/set_webhook' \
  -H 'Content-Type: application/json' \
  -d '{ "apikey": "YOUR_API_KEY", "token": "YOUR_ACCOUNT_TOKEN", "url": "https://your-server.com/webhook" }'

# Rimuovi il webhook
curl -X DELETE 'https://app.sendapp.ai/api/whatsapp-meta/set_webhook' \
  -H 'Content-Type: application/json' \
  -d '{ "apikey": "YOUR_API_KEY", "token": "YOUR_ACCOUNT_TOKEN" }'
<?php
// Registra il webhook
$ch = curl_init('https://app.sendapp.ai/api/whatsapp-meta/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/webhook',
    ]),
]);
echo curl_exec($ch);
curl_close($ch);
// Registra il webhook
const res = await fetch('https://app.sendapp.ai/api/whatsapp-meta/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/webhook'
  })
});
console.log(await res.json());
Risposta (200 OK)
{
  "status": "success",
  "message": "Webhook URL saved successfully."
}
Errore
{
  "status": "error",
  "message": "Instance not found"
}