Scheduled generation
Problem: A cron fires weekly. It should generate a branded status deck from yesterday’s KPIs and post the canvas URL to a Slack channel. No human in the loop.Primitives
POST /v1/taskswithcallback_url+idempotency_key- Webhook handler verifies signature and posts to Slack
- (Optional)
POST /v1/canvases/{id}/exportif you want a PPTX link, not just the canvas URL
Pattern
Cron → start task with a stableidempotency_key → return immediately. The webhook fires 2–10 minutes later and does the Slack post.
TypeScript (Node 20+)
Cron entry point:Python (FastAPI + httpx)
Cron entry point:Gotchas
Prefer: wait=30is the wrong tool here. Design tasks take 2–10 min. The cron would time out, and the webhook still fires anyway. Use the callback pattern.idempotency_keymust be stable and unique per cron fire."weekly-deck:2026-W17"is good."weekly-deck"alone is a landmine (every week reuses the same key → same task every time).callback_urlis API-key-auth only. The cron needs a realmoda_live_…key.- Slow webhook handlers get retried. Stay under 30s wall time by enqueueing async.
- On
task.failed, checkdata.error.retryable— transient failures may retry inside Moda automatically; permanent ones won’t. Either way, notify a channel — failures silently swallowed are the worst case.
See also
../references/webhooks.md— signing details, event types../references/idempotency.md— key designwebhook-receiver.md— the handler in isolation