Production guide
Default architecture​
- Create jobs with
conduit.reports.create(...). - Persist
jobIdand request metadata. - Process completion in your webhook endpoint.
- Fetch final data with
conduit.reports.get(reportId).
Why webhook-first​
Report generation can take around 150s. Blocking waits increase worker time and reduce throughput.
Idempotent creation​
await conduit.reports.create({
source: { mediaId },
output: { template: "sales_playbook" },
target: { strategy: "dominant" },
webhook: { url: "https://your-app.com/webhooks/conduit" },
idempotencyKey: `report:${userId}:${mediaHash}`,
requestId,
})
Webhook verification​
const payload = await req.text()
await conduit.webhooks.verifySignature({
payload,
headers: Object.fromEntries(req.headers),
secret: process.env.CONDUIT_WEBHOOK_SECRET!,
})
const event = conduit.webhooks.parseEvent(payload)
Fallback only when needed​
const report = await receipt.handle?.wait({ timeoutMs: 10 * 60_000 })
Use this only for low-volume scripts, not as your default app flow.
Observability​
- Always pass
requestIdfor correlation. - Enable telemetry hooks in the client for request/response/error metrics.
- Track webhook lag and completion rate.
Security​
- Keep
CONDUIT_API_KEYserver-side only. - Rotate API keys regularly.
- Reject unsigned webhook payloads.