Webhook (API di gestione)
Gli endpoint a cui Tolinku invia gli eventi. Per leggerli serve Lettura e scrittura; per modificarli serve Completo. Il segreto di firma viene restituito una sola volta, quando crei l’endpoint o generi un nuovo segreto, e non viene mai più restituito. Per sapere cosa fa ogni impostazione, consulta la guida utente.
Ogni percorso funziona anche sotto /v1/manage/appspaces/{appspace}, che ti serve quando un token OAuth raggiunge più di un Appspace. Consulta la panoramica dell’API di gestione per l’accesso, gli errori, le prove a secco e l’impaginazione.
| Metodo | Percorso | Cosa fa | Permesso |
|---|---|---|---|
GET | /v1/manage/webhooks | Elenca gli endpoint webhook | Lettura e scrittura |
POST | /v1/manage/webhooks | Aggiungi un endpoint webhook | Completo |
GET | /v1/manage/webhooks/{webhook} | Leggi un endpoint webhook | Lettura e scrittura |
PATCH | /v1/manage/webhooks/{webhook} | Modifica un endpoint webhook | Completo |
DELETE | /v1/manage/webhooks/{webhook} | Elimina un endpoint webhook | Completo |
POST | /v1/manage/webhooks/{webhook}/activate | Attiva un endpoint webhook | Completo |
POST | /v1/manage/webhooks/{webhook}/deactivate | Disattiva un endpoint webhook | Completo |
POST | /v1/manage/webhooks/{webhook}/rotate-secret | Genera un nuovo segreto di firma | Completo |
POST | /v1/manage/webhooks/{webhook}/test | Invia un evento di test | Completo |
POST | /v1/manage/webhooks/{webhook}/restore | Ripristina un endpoint webhook eliminato | Completo |
Elenca gli endpoint webhook
Sezione intitolata “Elenca gli endpoint webhook”/v1/manage/webhooksPermesso: Lettura e scrittura.
Gli endpoint webhook dell’Appspace, dal più vecchio, impaginati con cursor. Non restituisce mai i segreti di firma.
Parametri di query:
| Parametro | Tipo | Obbligatorio | Descrizione |
|---|---|---|---|
limit | integer | No | Quanti restituirne, da 1 a 100 (predefinito 50). |
cursor | string | No | Il valore next_cursor della pagina precedente, per ottenere la pagina successiva. |
Risposta 200: una pagina di risultati in data, e next_cursor per la pagina successiva (vedi Impaginazione). Ogni elemento:
| Campo | Tipo | Descrizione |
|---|---|---|
id | string | L’id del webhook. Ogni endpoint che accetta {webhook} accetta anche il suo nome. |
name | string | |
url | string | |
host | string | |
events | array di link.clicked, deferred_link.claimed, install.tracked, referral.created, referral.completed, ecommerce.purchase, ecommerce.refund, ecommerce.cart_abandoned, ecommerce.add_to_cart, ecommerce.begin_checkout, ecommerce.add_to_wishlist, ecommerce.fraud_flagged | |
active | boolean | |
last_triggered_at | string o null | |
last_status_code | number o null | |
has_secret | boolean | Indica se ha un segreto di firma. Il segreto stesso compare solo nella risposta che lo ha creato. |
created | string | |
updated_at | string | Invialo come expected_updated_at quando modifichi l’endpoint. |
Aggiungi un endpoint webhook
Sezione intitolata “Aggiungi un endpoint webhook”/v1/manage/webhooksPermesso: Completo. Modifica dati: accetta dry_run e Idempotency-Key, e richiede il piano Standard o superiore.
Valgono le regole della dashboard: un nome, un indirizzo HTTPS pubblico (niente localhost, indirizzi IP o nomi interni), almeno un evento e il singolo webhook del piano Free. Un nuovo endpoint è attivo, a meno che active non sia false. La risposta contiene il segreto di firma, una sola volta. Invia Idempotency-Key perché un tentativo ripetuto non ne crei due. Con dry_run non cambia nulla: la risposta è { dry_run: true, before, after, changes, warnings }.
Parametri di query:
| Parametro | Tipo | Obbligatorio | Descrizione |
|---|---|---|---|
dry_run | true, false | No | true: verifica e mostra l’anteprima della modifica senza applicarla (come dry_run nel corpo). |
Corpo della richiesta (JSON):
| Campo | Tipo | Obbligatorio | Descrizione |
|---|---|---|---|
name | string | Sì | Un nome per il tuo team, ad esempio “Production server”. |
url | string | Sì | Dove vengono inviati gli eventi: un indirizzo HTTPS pubblico. Deve rispondere con 2xx entro 10 secondi. |
events | array di link.clicked, deferred_link.claimed, install.tracked, referral.created, referral.completed, ecommerce.purchase, ecommerce.refund, ecommerce.cart_abandoned, ecommerce.add_to_cart, ecommerce.begin_checkout, ecommerce.add_to_wishlist, ecommerce.fraud_flagged | Sì | Quali eventi vengono inviati a questo endpoint, almeno uno: link.clicked, deferred_link.claimed, install.tracked, referral.created, referral.completed, ecommerce.purchase, ecommerce.refund, ecommerce.cart_abandoned, ecommerce.add_to_cart, ecommerce.begin_checkout, ecommerce.add_to_wishlist, ecommerce.fraud_flagged. |
active | boolean | No | Indica se gli eventi vengono inviati subito. Predefinito true, come nella dashboard. |
Risposta 201: il risultato in data, con warnings. Con dry_run, invece, un’anteprima.
| Campo | Tipo | Descrizione |
|---|---|---|
id | string | L’id del webhook. Ogni endpoint che accetta {webhook} accetta anche il suo nome. |
name | string | |
url | string | |
host | string | |
events | array di link.clicked, deferred_link.claimed, install.tracked, referral.created, referral.completed, ecommerce.purchase, ecommerce.refund, ecommerce.cart_abandoned, ecommerce.add_to_cart, ecommerce.begin_checkout, ecommerce.add_to_wishlist, ecommerce.fraud_flagged | |
active | boolean | |
last_triggered_at | string o null | |
last_status_code | number o null | |
has_secret | boolean | Indica se ha un segreto di firma. Il segreto stesso compare solo nella risposta che lo ha creato. |
created | string | |
updated_at | string | Invialo come expected_updated_at quando modifichi l’endpoint. |
secret | string | Il segreto di firma (whsec_…): ogni richiesta porta X-Webhook-Signature, cioè l’HMAC-SHA256 del corpo grezzo, calcolato con questo segreto, in esadecimale. Compare solo in questa risposta; salvalo subito. |
Leggi un endpoint webhook
Sezione intitolata “Leggi un endpoint webhook”/v1/manage/webhooks/{webhook}Permesso: Lettura e scrittura.
Un solo endpoint: tutti i campi che accetta una modifica, con gli stessi nomi. Mai il suo segreto di firma.
Parametri di percorso:
| Parametro | Descrizione |
|---|---|
webhook | Il webhook: il suo id o il suo nome. Codifica il nome in URL. |
Risposta 200: il risultato in data.
| Campo | Tipo | Descrizione |
|---|---|---|
id | string | L’id del webhook. Ogni endpoint che accetta {webhook} accetta anche il suo nome. |
name | string | |
url | string | |
host | string | |
events | array di link.clicked, deferred_link.claimed, install.tracked, referral.created, referral.completed, ecommerce.purchase, ecommerce.refund, ecommerce.cart_abandoned, ecommerce.add_to_cart, ecommerce.begin_checkout, ecommerce.add_to_wishlist, ecommerce.fraud_flagged | |
active | boolean | |
last_triggered_at | string o null | |
last_status_code | number o null | |
has_secret | boolean | Indica se ha un segreto di firma. Il segreto stesso compare solo nella risposta che lo ha creato. |
created | string | |
updated_at | string | Invialo come expected_updated_at quando modifichi l’endpoint. |
Modifica un endpoint webhook
Sezione intitolata “Modifica un endpoint webhook”/v1/manage/webhooks/{webhook}Permesso: Completo. Modifica dati: accetta dry_run e Idempotency-Key, e richiede il piano Standard o superiore.
Cambiano solo i campi inviati. Un nuovo indirizzo viene verificato di nuovo. Se invii expected_updated_at e nel frattempo è stata fatta un’altra modifica, la richiesta viene rifiutata con 412. Con dry_run non cambia nulla: la risposta è { dry_run: true, before, after, changes, warnings }.
Parametri di percorso:
| Parametro | Descrizione |
|---|---|
webhook | Il webhook: il suo id o il suo nome. Codifica il nome in URL. |
Parametri di query:
| Parametro | Tipo | Obbligatorio | Descrizione |
|---|---|---|---|
dry_run | true, false | No | true: verifica e mostra l’anteprima della modifica senza applicarla (come dry_run nel corpo). |
Corpo della richiesta (JSON):
| Campo | Tipo | Obbligatorio | Descrizione |
|---|---|---|---|
name | string | No | Un nuovo nome. |
url | string | No | Un nuovo indirizzo, verificato di nuovo: solo HTTPS pubblico. |
events | array di link.clicked, deferred_link.claimed, install.tracked, referral.created, referral.completed, ecommerce.purchase, ecommerce.refund, ecommerce.cart_abandoned, ecommerce.add_to_cart, ecommerce.begin_checkout, ecommerce.add_to_wishlist, ecommerce.fraud_flagged | No | Quali eventi vengono inviati a questo endpoint, almeno uno: link.clicked, deferred_link.claimed, install.tracked, referral.created, referral.completed, ecommerce.purchase, ecommerce.refund, ecommerce.cart_abandoned, ecommerce.add_to_cart, ecommerce.begin_checkout, ecommerce.add_to_wishlist, ecommerce.fraud_flagged. |
active | boolean | No | true: gli eventi vengono inviati. false: non vengono inviati, né messi in coda. |
expected_updated_at | string | No | Il valore updated_at che hai letto. Se nel frattempo l’endpoint è cambiato, non salvi nulla e la risposta è 412 precondition_failed: rileggi l’endpoint e riprova. |
Risposta 200: il risultato in data, con warnings. Con dry_run, invece, un’anteprima.
| Campo | Tipo | Descrizione |
|---|---|---|
id | string | L’id del webhook. Ogni endpoint che accetta {webhook} accetta anche il suo nome. |
name | string | |
url | string | |
host | string | |
events | array di link.clicked, deferred_link.claimed, install.tracked, referral.created, referral.completed, ecommerce.purchase, ecommerce.refund, ecommerce.cart_abandoned, ecommerce.add_to_cart, ecommerce.begin_checkout, ecommerce.add_to_wishlist, ecommerce.fraud_flagged | |
active | boolean | |
last_triggered_at | string o null | |
last_status_code | number o null | |
has_secret | boolean | Indica se ha un segreto di firma. Il segreto stesso compare solo nella risposta che lo ha creato. |
created | string | |
updated_at | string | Invialo come expected_updated_at quando modifichi l’endpoint. |
Elimina un endpoint webhook
Sezione intitolata “Elimina un endpoint webhook”/v1/manage/webhooks/{webhook}Permesso: Completo. Modifica dati: accetta dry_run e Idempotency-Key, e richiede il piano Standard o superiore.
Gli eventi smettono subito di arrivare. L’endpoint finisce nel cestino e si può ripristinare per 30 giorni, con il suo segreto di firma; il suo registro delle consegne viene eliminato. Con dry_run non cambia nulla: la risposta è { dry_run: true, before, after, changes, warnings }.
Parametri di percorso:
| Parametro | Descrizione |
|---|---|
webhook | Il webhook: il suo id o il suo nome. Codifica il nome in URL. |
Parametri di query:
| Parametro | Tipo | Obbligatorio | Descrizione |
|---|---|---|---|
dry_run | true, false | No | true: verifica e mostra l’anteprima della modifica senza applicarla (come dry_run nel corpo). |
Risposta 200: il risultato in data, con warnings. Con dry_run, invece, un’anteprima.
| Campo | Tipo | Descrizione |
|---|---|---|
deleted | true | |
id | string | |
name | string | |
trash_id | string | La voce nel cestino: con POST /webhooks/{webhook}/restore la ripristini. |
restorable_until | string |
Attiva un endpoint webhook
Sezione intitolata “Attiva un endpoint webhook”/v1/manage/webhooks/{webhook}/activatePermesso: Completo. Modifica dati: accetta dry_run e Idempotency-Key, e richiede il piano Standard o superiore.
Da ora gli eventi vengono inviati. Con dry_run non cambia nulla: la risposta è { dry_run: true, before, after, changes, warnings }.
Parametri di percorso:
| Parametro | Descrizione |
|---|---|
webhook | Il webhook: il suo id o il suo nome. Codifica il nome in URL. |
Parametri di query:
| Parametro | Tipo | Obbligatorio | Descrizione |
|---|---|---|---|
dry_run | true, false | No | true: verifica e mostra l’anteprima della modifica senza applicarla (come dry_run nel corpo). |
Risposta 200: il risultato in data, con warnings. Con dry_run, invece, un’anteprima.
| Campo | Tipo | Descrizione |
|---|---|---|
id | string | L’id del webhook. Ogni endpoint che accetta {webhook} accetta anche il suo nome. |
name | string | |
url | string | |
host | string | |
events | array di link.clicked, deferred_link.claimed, install.tracked, referral.created, referral.completed, ecommerce.purchase, ecommerce.refund, ecommerce.cart_abandoned, ecommerce.add_to_cart, ecommerce.begin_checkout, ecommerce.add_to_wishlist, ecommerce.fraud_flagged | |
active | boolean | |
last_triggered_at | string o null | |
last_status_code | number o null | |
has_secret | boolean | Indica se ha un segreto di firma. Il segreto stesso compare solo nella risposta che lo ha creato. |
created | string | |
updated_at | string | Invialo come expected_updated_at quando modifichi l’endpoint. |
Disattiva un endpoint webhook
Sezione intitolata “Disattiva un endpoint webhook”/v1/manage/webhooks/{webhook}/deactivatePermesso: Completo. Modifica dati: accetta dry_run e Idempotency-Key, e richiede il piano Standard o superiore.
Gli eventi smettono subito di essere inviati, e non vengono messi in coda. Con dry_run non cambia nulla: la risposta è { dry_run: true, before, after, changes, warnings }.
Parametri di percorso:
| Parametro | Descrizione |
|---|---|
webhook | Il webhook: il suo id o il suo nome. Codifica il nome in URL. |
Parametri di query:
| Parametro | Tipo | Obbligatorio | Descrizione |
|---|---|---|---|
dry_run | true, false | No | true: verifica e mostra l’anteprima della modifica senza applicarla (come dry_run nel corpo). |
Risposta 200: il risultato in data, con warnings. Con dry_run, invece, un’anteprima.
| Campo | Tipo | Descrizione |
|---|---|---|
id | string | L’id del webhook. Ogni endpoint che accetta {webhook} accetta anche il suo nome. |
name | string | |
url | string | |
host | string | |
events | array di link.clicked, deferred_link.claimed, install.tracked, referral.created, referral.completed, ecommerce.purchase, ecommerce.refund, ecommerce.cart_abandoned, ecommerce.add_to_cart, ecommerce.begin_checkout, ecommerce.add_to_wishlist, ecommerce.fraud_flagged | |
active | boolean | |
last_triggered_at | string o null | |
last_status_code | number o null | |
has_secret | boolean | Indica se ha un segreto di firma. Il segreto stesso compare solo nella risposta che lo ha creato. |
created | string | |
updated_at | string | Invialo come expected_updated_at quando modifichi l’endpoint. |
Genera un nuovo segreto di firma
Sezione intitolata “Genera un nuovo segreto di firma”/v1/manage/webhooks/{webhook}/rotate-secretPermesso: Completo. Modifica dati: accetta dry_run e Idempotency-Key, e richiede il piano Standard o superiore.
Il segreto attuale smette di funzionare subito. La risposta contiene il nuovo segreto, una sola volta. Con dry_run non cambia nulla: la risposta è { dry_run: true, before, after, changes, warnings }.
Parametri di percorso:
| Parametro | Descrizione |
|---|---|
webhook | Il webhook: il suo id o il suo nome. Codifica il nome in URL. |
Parametri di query:
| Parametro | Tipo | Obbligatorio | Descrizione |
|---|---|---|---|
dry_run | true, false | No | true: verifica e mostra l’anteprima della modifica senza applicarla (come dry_run nel corpo). |
Risposta 200: il risultato in data, con warnings. Con dry_run, invece, un’anteprima.
| Campo | Tipo | Descrizione |
|---|---|---|
id | string | L’id del webhook. Ogni endpoint che accetta {webhook} accetta anche il suo nome. |
name | string | |
url | string | |
host | string | |
events | array di link.clicked, deferred_link.claimed, install.tracked, referral.created, referral.completed, ecommerce.purchase, ecommerce.refund, ecommerce.cart_abandoned, ecommerce.add_to_cart, ecommerce.begin_checkout, ecommerce.add_to_wishlist, ecommerce.fraud_flagged | |
active | boolean | |
last_triggered_at | string o null | |
last_status_code | number o null | |
has_secret | boolean | Indica se ha un segreto di firma. Il segreto stesso compare solo nella risposta che lo ha creato. |
created | string | |
updated_at | string | Invialo come expected_updated_at quando modifichi l’endpoint. |
secret | string | Il segreto di firma (whsec_…): ogni richiesta porta X-Webhook-Signature, cioè l’HMAC-SHA256 del corpo grezzo, calcolato con questo segreto, in esadecimale. Compare solo in questa risposta; salvalo subito. |
Invia un evento di test
Sezione intitolata “Invia un evento di test”/v1/manage/webhooks/{webhook}/testPermesso: Completo. Modifica dati: accetta dry_run e Idempotency-Key, e richiede il piano Standard o superiore.
Invia subito un evento di test (evento “test”) all’endpoint, firmato con il suo segreto, esattamente come fa il pulsante Invia test della dashboard, e risponde con quello che è tornato indietro. Compare nel registro delle consegne (tentativo 0). Con dry_run non viene inviato nulla.
Parametri di percorso:
| Parametro | Descrizione |
|---|---|
webhook | Il webhook: il suo id o il suo nome. Codifica il nome in URL. |
Parametri di query:
| Parametro | Tipo | Obbligatorio | Descrizione |
|---|---|---|---|
dry_run | true, false | No | true: verifica e mostra l’anteprima della modifica senza applicarla (come dry_run nel corpo). |
Risposta 200: il risultato in data, con warnings. Con dry_run, invece, un’anteprima.
| Campo | Tipo | Descrizione |
|---|---|---|
delivered | boolean | |
status_code | number o null | |
error | string o null | |
response_time_ms | number o null |
Ripristina un endpoint webhook eliminato
Sezione intitolata “Ripristina un endpoint webhook eliminato”/v1/manage/webhooks/{webhook}/restorePermesso: Completo. Modifica dati: accetta dry_run e Idempotency-Key, e richiede il piano Standard o superiore.
Riporta un endpoint eliminato negli ultimi 30 giorni, con lo stesso id, gli stessi eventi e lo stesso segreto di firma, attivo o disattivo come prima. {webhook} è il suo vecchio id o nome, oppure l’id della voce nel cestino. Sul piano Free la richiesta viene rifiutata con 409 conflict finché c’è un altro webhook. Con dry_run non cambia nulla: la risposta è { dry_run: true, before, after, changes, warnings }.
Parametri di percorso:
| Parametro | Descrizione |
|---|---|
webhook | Il webhook: il suo id o il suo nome. Codifica il nome in URL. |
Parametri di query:
| Parametro | Tipo | Obbligatorio | Descrizione |
|---|---|---|---|
dry_run | true, false | No | true: verifica e mostra l’anteprima della modifica senza applicarla (come dry_run nel corpo). |
Risposta 200: il risultato in data, con warnings. Con dry_run, invece, un’anteprima.
| Campo | Tipo | Descrizione |
|---|---|---|
id | string | L’id del webhook. Ogni endpoint che accetta {webhook} accetta anche il suo nome. |
name | string | |
url | string | |
host | string | |
events | array di link.clicked, deferred_link.claimed, install.tracked, referral.created, referral.completed, ecommerce.purchase, ecommerce.refund, ecommerce.cart_abandoned, ecommerce.add_to_cart, ecommerce.begin_checkout, ecommerce.add_to_wishlist, ecommerce.fraud_flagged | |
active | boolean | |
last_triggered_at | string o null | |
last_status_code | number o null | |
has_secret | boolean | Indica se ha un segreto di firma. Il segreto stesso compare solo nella risposta che lo ha creato. |
created | string | |
updated_at | string | Invialo come expected_updated_at quando modifichi l’endpoint. |