WebhookRegistrare un webhook

Webhook

Registrare un webhook

Registra un URL https che Sofia chiama con un evento JSON firmato, ritentato fino a cinque volte se fallisce. Secret mostrato una volta; massimo 10 webhook.

POSThttps://api.sofia-post.com/api/v1/webhooks
POST/v1/webhooks

Questa richiesta agisce sul tuo account reale.

curl -X POST 'https://api.sofia-post.com/api/v1/webhooks' \
  -H "Authorization: Bearer $SOFIA_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"url":"https://crm.example.com/hooks/sofia","events":["post.published"]}'

Autorizzazioni

  • Authorizationstringobbligatorio

    La tua chiave personale o il token di accesso OAuth, inviato come Bearer <token>.

Body

application/json

  • urlstringobbligatorio

    L'indirizzo https che Sofia chiama. Un host che risolve a un indirizzo privato, loopback o link-local viene rifiutato

  • eventsstring[]obbligatorio

    Gli eventi da ricevere

Risposta

201application/json

Il webhook e il suo secret di firma, mostrato una sola volta.

  • idstringobbligatorio

    Identificatore del webhook.

  • urlstringobbligatorio

    Indirizzo chiamato da Sofia

  • eventsstring[]obbligatorio

    Gli eventi sottoscritti

  • createdAtstring<date-time>obbligatorio

    Quando il webhook è stato registrato

  • secretstringobbligatorio

    La chiave HMAC-SHA256 che firma ogni consegna (Sofia-Signature). Mostrata solo questa volta

400

webhook_url_invalid: non https, oppure host privato, loopback o link-local. webhook_event_invalid: evento sconosciuto, o nessuno.

401

Il token manca, è sconosciuto, scaduto o revocato.

403

Il token non ha il permesso webhooks:write.

409

webhook_limit_reached: ci sono già 10 webhook.

4XXapplication/json

Qualsiasi altro errore, nella busta di errore.