Guides
GuideScheduled Functions
Scheduled Functions
Put any backend function on a timer: weekly digests, reminder emails, content drip, expiry sweeps, nightly clean-ups. Create schedules in Config → Monetization → Schedules, or just ask the AI (“run weeklyDigest every Monday at 9”).
A schedule = a cron expression + a function name. Runs are queued and cluster-safe (exactly one fire per tick, even across multiple servers). Timezone is per-schedule.
What your function receives
// params on a scheduled run:
// params.event = { type: 'schedule', scheduleId, cron, firedAt }
// params.config = the params object saved on the schedule (if any)
const { rows } = await ctx.service.tables.getRows('Reminders', { limit: 100 });
for (const r of rows.filter((x) => x.dueToday)) {
await ctx.email.send({ to: r.email, subject: 'Reminder', html: r.body });
}
return { sent: rows.length };Cron cheat-sheet
| Expression | Meaning |
|---|---|
| */15 * * * * | Every 15 minutes |
| 0 * * * * | Every hour |
| 0 9 * * * | Daily at 9:00 |
| 0 9 * * 1 | Mondays at 9:00 |
| 0 0 1 * * | Monthly, on the 1st |
Write scheduled functions to be safe if a run is delayed or repeated — check state in tables instead of assuming exact timing. Retries follow the function’s own maxRetries setting (default: run once).