Setting one up
There are two halves: the code, and the schedule that runs it.1
Write the task
Ask the Code agent for what you want — “add a scheduled task that sends tomorrow’s appointment reminders” — and it writes the file for you. Tasks live in
src/cron/.2
Deploy it
This step isn’t optional. Scheduled tasks only ever run your live code, so a task can’t point at a file you haven’t deployed yet. Paige won’t even let you create one — you’ll get “File not found in production. Deploy first.”
3
Add the schedule
Go to Tools → Scheduled Tasks, click Add Scheduled Task, and fill in the name, schedule, file path, and an optional description. Click Create.
Writing the schedule
Schedules use cron notation — five fields meaning minute, hour, day of month, month, and day of week.0 9 * * * is “every day at 9:00”.
There’s a Presets dropdown next to the field with the common ones — every hour, daily at 9am, weekdays at 9am, weekly on Monday, monthly on the 1st — which fills in the expression for you.
The shortest interval you can set is one minute, and a project can have at most five scheduled tasks.
What a task file looks like
A task exports a single function that takes no arguments:console.log shows up in Logs, which is how you check a task did what you expected.
A scheduled task doesn’t get quite the same environment as the rest of your bot. Your secrets are available, but Connector credentials aren’t — code that talks to Airtable or Slack through a Connector works when triggered by a message and fails on a schedule. If a task needs a third-party service, give it its own secret with a real API key.
Managing your tasks
Each task in the list shows its schedule, its description, its file, when it last ran, and — in red — the error from its last failure, if there was one. That error line is the first place to look when a task silently stops doing its job.- Enabled / Disabled — click to pause a task without deleting it.
- Run now — trigger it immediately, rather than waiting for the schedule.
- Edit — change the schedule or description. The name and file path are fixed once created.
- Delete — stops all future runs.
