useMongocampWebhooks
Outbound webhooks of server 3.0 (administrators). Used by MongocampWebhooks.
ts
const { list, create, update, remove, deliveries } = useMongocampWebhooks()
const { row, secret } = await create({ url: 'https://hooks.example.org/orders', events: ['document:create'], collections: ['orders'] })
await update(row.id, { active: false })
const latest = await deliveries(row.id) // newest firstlist()—GET /system/webhooksas rows (utils/webhooks.tswebhookRow:collections: []= every collection,declared,disabledAtin ms).create(request)— answers{ row, secret }: the only time the server sends the secret.update(id, changes)—PATCHwith the fields to change (url,events,collections,active,includeDocuments);collections: []= every collection; no events is a400.remove(id)—DELETE;404counts as removed.deliveries(id, { rowsPerPage = 50 })—GET …/deliveries(7 days), newest first:{ id, event, collection, attempt, ok, status, error, durationMs, at, jobId }.
All calls have a 15 s timeout. Form helpers in utils/webhooks.ts: webhookFormProblems (http(s), no credentials, an event), webhookRequest(form, original?) (create body / only the changes), normalizeEvents (* wins).