Aller au contenu

Gérer les webhooks via l'API

Vous pouvez gérer les webhooks par programmation avec la même API publique que pour les enveloppes et les espaces de travail : requêtes POST signées via le tunnel Oak (ou via les SDK TypeScript / Python).

  • Clé API d’équipe dans Paramètres → Clés API avec les permissions Webhook (par ex. Gérer pour tout le CRUD, ou Créer / Lire / Modifier / Supprimer de façon granulaire).
  • Le forfait doit inclure les webhooks (comme pour la création dans l’application).
  • Utilisez le proxy de chiffrement ou un SDK pour un chiffrement de bout en bout.

Toutes les routes sont en POST (corps JSON). Les chemins ci-dessous sont ceux utilisés par le SDK :

ActionCheminPermission (typique)
Créer/public/webhook/createCréer ou Gérer sur Webhook
Lister/public/webhook/listLire ou Gérer sur Webhook
Mettre à jour/public/webhook/updateModifier ou Gérer sur Webhook
Supprimer/public/webhook/deleteSupprimer ou Gérer sur Webhook

Les schémas requête/réponse sont alignés sur l’API session webhooks ; voir la spécification OpenAPI.

Chaque équipe peut avoir au plus 20 webhooks. Un appel create lorsque la limite est atteinte renvoie WEBHOOK_LIMIT_REACHED (HTTP 400).

import { SubnotoClient } from "@subnoto/api-client";
const client = new SubnotoClient({
accessKey: process.env.API_ACCESS_KEY!,
secretKey: process.env.API_SECRET_KEY!
});
const { data: created } = await client.POST("/public/webhook/create", {
body: {
url: "https://api.exemple.com/subnoto-webhook",
contentType: "application/json",
sslVerify: true,
active: true,
events: ["ENVELOPE_COMPLETED"],
title: "Webhook production"
}
});
const { data: listed } = await client.POST("/public/webhook/list", {
body: { page: 1, limit: 50 }
});
await client.POST("/public/webhook/update", {
body: {
uuid: created.webhook.uuid,
active: false,
title: "Webhook en pause"
}
});
await client.POST("/public/webhook/delete", {
body: { uuid: created.webhook.uuid }
});
from subnoto_api_client import SubnotoSyncClient, SubnotoConfig
with SubnotoSyncClient(SubnotoConfig()) as client:
r = client.post(
"/public/webhook/create",
json={
"url": "https://api.exemple.com/subnoto-webhook",
"contentType": "application/json",
"sslVerify": True,
"active": True,
"events": ["ENVELOPE_COMPLETED"],
"title": "Webhook production",
},
)
uuid = r.json()["webhook"]["uuid"]
client.post("/public/webhook/list", json={"page": 1, "limit": 50})
client.post(
"/public/webhook/update",
json={"uuid": uuid, "active": False, "title": "Webhook en pause"},
)
client.post("/public/webhook/delete", json={"uuid": uuid})