Cron triggers run a function on a recurring schedule without an external scheduler. Microfn evaluates cron schedules in UTC and calls the exported cron handler with null.
Add a cron handler
Create a function and add both a manual entry point and a scheduled entry point:
async function runDailyTask() {
const timestamp = new Date().toISOString();
console.log(`Daily task started at ${timestamp}`);
return { ok: true, timestamp };
}
export async function main() {
return runDailyTask();
}
export async function cron(_input: null) {
return runDailyTask();
}
Keeping the work in one helper lets you test it manually through main before the schedule is active.
Set the schedule
Save the function, open Triggers, enable the cron trigger, and enter the schedule. For example, 0 9 * * * runs every day at 09:00 UTC. Convert local business times to UTC and account for daylight-saving changes yourself because a cron expression does not carry a time zone.
Verify the run
Run the function manually once. Then check Executions after the next scheduled time and confirm that the entry used the cron trigger. Logs and returned values are available in the execution detail.
For a scheduled workflow that calls another reusable function, use @microfn/fn. Store credentials with per-function secrets.
Build a daily report
Replace runDailyTask with a small pipeline that calls an external API, reduces the response to the fields you need, and passes the result to a reusable Slack, Discord, or Telegram notifier. Keep main available so you can test the report on demand before waiting for the next scheduled run.