Riferimento API

Endpoint webhook

Un endpoint webhook è un tuo URL che riceve gli eventi di Okaymate nel momento in cui accadono. Un'attività può averne 10. Leggi Webhook per gli eventi, i loro payload e come verificare una firma.

L'oggetto endpoint webhook

Un tuo URL a cui Okaymate invia gli eventi. Vedi Webhook per gli eventi e come verificarli.

Attributi

  • idstring
    Identificatore univoco dell'endpoint.
  • objectstring
    Sempre webhook_endpoint.
  • urlstring
    L'URL HTTPS a cui vengono inviati gli eventi.
  • descriptionstring o null
    La tua nota sull'endpoint.
  • eventsarray di strings
    I tipi di evento che riceve.
    lead.createdmessage.receivedmessage.sent
  • statusstring
    Se gli vengono inviati gli eventi.
    enableddisabled
  • created_atstring
    Quando è stato creato l'endpoint, ISO 8601.
  • last_deliveryobject o null
    L'ultimo evento che gli è stato inviato, null prima del primo.
  • secretstring
    Il segreto di firma, whsec_ e 32 caratteri. Solo nella risposta di creazione, mostrato una sola volta.
L'oggetto endpoint webhook
{
  "id": "wh3LpX9dKe",
  "object": "webhook_endpoint",
  "url": "https://example.com/webhooks/okaymate",
  "description": "Helpdesk sync",
  "events": ["lead.created", "message.received"],
  "status": "enabled",
  "created_at": "2026-11-02T10:14:22.000Z",
  "last_delivery": {
    "status": "succeeded",
    "at": "2026-11-24T09:12:44.000Z",
    "status_code": 200
  }
}

Elenca gli endpoint webhook

GET/v1/webhook_endpointsAccesso in lettura

Restituisce gli endpoint webhook dell'attività, dal più recente, senza i loro segreti.

Restituisce

Un elenco di oggetti endpoint webhook. has_more è sempre false.

GET/v1/webhook_endpoints
curl https://okaymate.ai/api/v1/webhook_endpoints \
  -H "Authorization: Bearer $OKAYMATE_API_KEY"
Risposta200
{
  "object": "list",
  "data": [
    {
      "id": "wh3LpX9dKe",
      "object": "webhook_endpoint",
      "url": "https://example.com/webhooks/okaymate",
      "description": "Helpdesk sync",
      "events": ["lead.created", "message.received"],
      "status": "enabled",
      "created_at": "2026-11-02T10:14:22.000Z",
      "last_delivery": {
        "status": "succeeded",
        "at": "2026-11-24T09:12:44.000Z",
        "status_code": 200
      }
    }
  ],
  "has_more": false,
  "next_cursor": null
}

Crea un endpoint webhook

POST/v1/webhook_endpointsAccesso in lettura e scrittura

Registra un URL per uno o più tipi di evento. Salva il secret della risposta, perché è l'unica volta che lo vedrai.

Parametri del body

  • urlstringObbligatorio
    Un URL HTTPS su un indirizzo pubblico.
  • eventsarray di stringsObbligatorio
    I tipi di evento da inviare.
    lead.createdmessage.receivedmessage.sent
  • descriptionstring
    Una nota per te.

Restituisce

Il nuovo oggetto endpoint webhook con il suo secret.

Errori

  • Manca un parametro obbligatorio. param lo indica.
  • Un parametro ha un valore che l'API non accetta, come un URL che non è HTTPS o che punta a un indirizzo privato, oppure l'attività ha già 10 endpoint. param lo indica.
POST/v1/webhook_endpoints
curl -X POST https://okaymate.ai/api/v1/webhook_endpoints \
  -H "Authorization: Bearer $OKAYMATE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/webhooks/okaymate",
    "events": ["lead.created", "message.received"],
    "description": "Helpdesk sync"
  }'
Risposta201
{
  "id": "wh3LpX9dKe",
  "object": "webhook_endpoint",
  "url": "https://example.com/webhooks/okaymate",
  "description": "Helpdesk sync",
  "events": ["lead.created", "message.received"],
  "status": "enabled",
  "created_at": "2026-11-24T09:20:03.000Z",
  "last_delivery": null,
  "secret": "whsec_4QeX7nP2kR9tLm3Vb8YzC1dF6hJ0sWuA"
}

Recupera un endpoint webhook

GET/v1/webhook_endpoints/:idAccesso in lettura

Restituisce un endpoint webhook, senza il suo segreto.

Parametri di percorso

  • idstringObbligatorio
    L'ID dell'endpoint webhook.

Restituisce

Un oggetto endpoint webhook.

Errori

GET/v1/webhook_endpoints/:id
curl https://okaymate.ai/api/v1/webhook_endpoints/wh3LpX9dKe \
  -H "Authorization: Bearer $OKAYMATE_API_KEY"
Risposta200
{
  "id": "wh3LpX9dKe",
  "object": "webhook_endpoint",
  "url": "https://example.com/webhooks/okaymate",
  "description": "Helpdesk sync",
  "events": ["lead.created", "message.received"],
  "status": "enabled",
  "created_at": "2026-11-02T10:14:22.000Z",
  "last_delivery": {
    "status": "succeeded",
    "at": "2026-11-24T09:12:44.000Z",
    "status_code": 200
  }
}

Aggiorna un endpoint webhook

PATCH/v1/webhook_endpoints/:idAccesso in lettura e scrittura

Modifica un endpoint. Cambiano solo i campi che invii. Un endpoint disattivato non riceve eventi.

Parametri di percorso

  • idstringObbligatorio
    L'ID dell'endpoint webhook.

Parametri del body

  • urlstring
    Un nuovo URL HTTPS.
  • eventsarray di strings
    I tipi di evento da inviare.
    lead.createdmessage.receivedmessage.sent
  • descriptionstring
    Una nota per te.
  • statusstring
    Attiva o disattiva l'endpoint.
    enableddisabled

Restituisce

L'oggetto endpoint webhook aggiornato.

Errori

PATCH/v1/webhook_endpoints/:id
curl -X PATCH \
  https://okaymate.ai/api/v1/webhook_endpoints/wh3LpX9dKe \
  -H "Authorization: Bearer $OKAYMATE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "status": "disabled"
  }'
Risposta200
{
  "id": "wh3LpX9dKe",
  "object": "webhook_endpoint",
  "url": "https://example.com/webhooks/okaymate",
  "description": "Helpdesk sync",
  "events": ["lead.created", "message.received"],
  "status": "disabled",
  "created_at": "2026-11-02T10:14:22.000Z",
  "last_delivery": {
    "status": "succeeded",
    "at": "2026-11-24T09:12:44.000Z",
    "status_code": 200
  }
}

Elimina un endpoint webhook

DELETE/v1/webhook_endpoints/:idAccesso in lettura e scrittura

Elimina un endpoint. Non riceve più eventi.

Parametri di percorso

  • idstringObbligatorio
    L'ID dell'endpoint webhook.

Restituisce

Un oggetto con l'id dell'endpoint e deleted impostato su true.

Errori

DELETE/v1/webhook_endpoints/:id
curl -X DELETE \
  https://okaymate.ai/api/v1/webhook_endpoints/wh3LpX9dKe \
  -H "Authorization: Bearer $OKAYMATE_API_KEY"
Risposta200
{
  "id": "wh3LpX9dKe",
  "object": "webhook_endpoint",
  "deleted": true
}

Invia un evento di test

POST/v1/webhook_endpoints/:id/testAccesso in lettura e scrittura

Invia subito all'endpoint un evento message.received di esempio, con test impostato su true. Un solo tentativo, senza ripetizioni.

Parametri di percorso

  • idstringObbligatorio
    L'ID dell'endpoint webhook.

Restituisce

Un oggetto con lo status della consegna, succeeded o failed, e lo status_code con cui ha risposto il tuo endpoint.

Errori

POST/v1/webhook_endpoints/:id/test
curl -X POST \
  https://okaymate.ai/api/v1/webhook_endpoints/wh3LpX9dKe/test \
  -H "Authorization: Bearer $OKAYMATE_API_KEY"
Risposta200
{
  "status": "succeeded",
  "status_code": 200
}