Wake Schedules and Authorizations
Schedule recurring, DKIM-signed wake commands to your own Primitive Functions from the CLI, and manage the allowlist that authorizes who can trigger them.
Wake scheduling sends a typed wake command to one of your own Primitive Functions over real DKIM-signed email, on a cron cadence you control. Use it when a Function needs to run on a timer rather than only in response to inbound mail, for example a daily digest or a recurring status check.
Two command groups cover the feature:
primitive wake-schedules-*creates, lists, updates, runs, and deletes the scheduled wake-ups themselves.primitive wake-authorizations-*manages the per-target allowlist that authorizes which senders may wake a given function.
Because each wake arrives as an ordinary DKIM-signed email to the target function, the allowlist is what decides whether that mail is allowed to wake it. Set up the authorization before you rely on a schedule.
Prerequisites#
- The CLI installed and authenticated. See Authentication: login, signup, logout, whoami.
- A deployed Primitive Function you want to wake on a schedule. Note its function id (a UUID, not its name).
- 1
Discover the exact flags for your installed version#
Both command groups are generated from the OpenAPI spec, so the flag surface tracks your installed CLI version. List the subcommands and their flags before scripting anything:
primitive --help primitive wake-schedules-list --help primitive wake-authorizations-list --helpEvery generated command also accepts
--jsonfor a machine-readable payload. - 2
Authorize the sender that may wake the function#
Wake commands arrive as email, so the target function needs an authorization entry allowing the sender that will wake it. Inspect the current allowlist first:
primitive wake-authorizations-listThen add an entry with the flags
primitive wake-authorizations-list --helpand the create command's--helpreport for your version. - 3
Create the wake schedule#
Create a schedule that sends a wake command to the function on a cron cadence:
primitive wake-schedules-create --helpThe create command reports the new schedule's id in its JSON output. Save that id: the update, run, and delete commands all address a schedule by id.
- 4
List and inspect schedules#
primitive wake-schedules-listThe list shows each schedule's id and its cron cadence, so you can confirm the schedule you just created is registered.
- 5
Run a schedule on demand#
Trigger a schedule immediately, without waiting for its next cron tick, to verify the target function handles the wake command:
primitive wake-schedules-run --helpRun this right after creating a schedule, so you confirm the function is reachable and authorized before trusting the cron cadence to fire it unattended.
- 6
Update or delete a schedule#
Updating a schedule changes only the fields you pass; deleting it removes it permanently. Check the flag names for your version:
primitive wake-schedules-update --help primitive wake-schedules-delete --help - 7
Inspect dispatch history#
The wake command group also exposes the dispatch history, so you can check whether a schedule's runs actually reached the function. Find the dispatch command for your version in the top-level help:
primitive --help | grep wake
Deleting a wake authorization does not delete schedules that target the affected function. Those schedules keep firing on their cron cadence, but the wake email is no longer authorized for that target. Check the dispatch history after changing an authorization if you still expect that function to be woken.
Function scope is always addressed by the function id UUID, not the function name. Grab it from primitive functions-list before creating a schedule or an authorization.
Next steps#
Scaffold, deploy, and route the Function a wake schedule targets.
Direct API Access and Generic CommandsList every generated operation and inspect its parameters from the terminal.
Primitive Functions and Recipient RoutingUnderstand how inbound mail reaches a function in the first place.
What is the Primitive CLI?See how the wake command groups fit the rest of the CLI surface.
Was this page helpful?