Nairi APIAutomationsScheduled jobsOverview

Overview

What scheduled jobs are and how to run agent prompts on a cron schedule or once at a set time. Create, list, update, and delete jobs through the Nairi REST API.

A scheduled job is a prompt that runs on a recurring cron schedule, or once at a set time, and posts its result to a Slack or Discord channel. Each job pairs a timing (a cron schedule or a one-time run_at), a timezone, a prompt, and a target channel - Nairi handles dispatch, agent assignment, and posting the response.

How it works

  1. Discover the platform channel_id of your target Slack/Discord channel via Channels.
  2. Create the job with POST /scheduled-jobs, passing either a schedule (5-field cron) or a run_at (RFC 3339 timestamp, runs once), plus timezone (IANA name), prompt, connected_channel_id, and job_type (slack or discord).
  3. At each scheduled tick, Nairi starts a conversation, assigns it to the default agent for the channel, and posts the result back. Set is_threaded: true to post each run inside a Slack thread.
  4. Toggle is_enabled to pause or resume the job without deleting it.
  5. Fire it off-schedule with POST /scheduled-jobs/{id}/run, and read what each tick produced with GET /scheduled-jobs/{id}/runs. Each job also reports next_run_at and its last_run.

See Schedule rules for the cron format and minimum-granularity constraints.

When to use it

  • Ship recurring content into Slack or Discord. Daily PR digests, weekly summaries, customer-facing newsletters - straight to the channel on a cron.
  • Automate the periodic checks your team runs by hand. Error-log scans, on-call rotations, status reports - once-an-hour or once-a-day.
  • Schedule a one-off for later. A release announcement on launch morning, a reminder before a deadline - set run_at and the job runs once, then pauses itself.

Tips

  • Minimum granularity is 5 minutes. Anything more frequent (* * * * *) is rejected.
  • A one-time job (run_at) fires once and then has is_enabled: false. To run it again, send a new run_at with is_enabled: true in one update.
  • connected_channel_id is the platform channel ID (Slack Cxxx…, Discord numeric snowflake), not the internal cc_… record ID.
  • On create, last_executed_at is set to creation time even when the job is disabled - this prevents an immediate fire the moment you flip is_enabled to true.

On this page