Scheduled actions

Run application tasks at the right time without maintaining workers

Schedule something once or run it repeatedly using RocketStack Scheduler, Cron, and Functions.

One-time

SchedulerFunction

Recurring

CronFunction
  • One-time scheduling
  • Recurring Cron jobs
  • Managed execution
  • Observable results

Choose the schedule your application needs

Run once

Scheduler

For a specific future date and time.

Trigger an action once at a specific date and time.

Example uses

  • Send a reminder in one hour
  • Expire a trial on a future date
  • Retry a payment tomorrow
  • Publish scheduled content
  • Run a deferred AI task
SchedulerFunction
Explore Scheduler

Run repeatedly

Cron

For work that follows a recurring expression.

Run recurring application work using a cron expression.

Example uses

  • Nightly data synchronization
  • Weekly report generation
  • Regular cleanup
  • Recurring notifications
  • Periodic maintenance
CronFunction
Explore Cron

Why scheduled work becomes fragile inside your application

Application-managed scheduling

  1. 1Application process
  2. 2Timer or cron library
  3. 3Task execution
  • Scheduling depends on an application process remaining available
  • Restarts can lose in-memory timers
  • Multiple application instances can run the same task
  • Long-running work blocks application capacity
  • Failures and retries become custom logic
  • Schedule state becomes difficult to inspect
  • Deployment changes can interrupt recurring jobs

RocketStack workflow

One-time flow

SchedulerFunction

Recurring flow

CronFunction
  • Schedule configuration is separate from application processes
  • Functions run outside frontend or API requests
  • One-time and recurring jobs use the same operating model
  • Execution activity remains visible
  • Failures can be investigated independently
  • Application deployments do not own the schedule lifecycle

A simple workflow for work that happens later

1

Scheduler or Cron

Define when the application action should run.

  • Store the scheduled time or cron expression
  • Select the delivery target
  • Include the required payload
  • Trigger execution at the configured time
2

Function

Run the backend logic when the scheduled action fires.

  • Read the invocation payload
  • Update application state
  • Call external services
  • Send notifications
  • Surface processing errors
3

Queue or KV

Optional

Add asynchronous processing or workflow state when the scheduled action needs it.

Queue

  • Move longer work outside the initial invocation
  • Retry supported temporary failures

KV

  • Store idempotency keys
  • Track workflow or completion state

Example workflow

See a scheduled action move from creation to execution

Simulated client-side demo with illustrative timings — no schedules are created in your account.

Example workflow

Mode

Illustrative timing — not a live schedule.

{
  "accountId": "acct_123",
  "type": "trial.reminder"
}

Activity timeline

Illustrative timings

Choose a schedule type and run the example workflow.

  1. 1Schedule created
  2. 2Execution time recorded
  3. 3Scheduler triggered
  4. 4Function invoked
  5. 5Action completed

Build the workflow

Use the RocketStack HTTP API or generated SDKs. Examples below use real request fields.

Mode

Step 1 of 4

Create the Function

Language

Deploy the backend logic that should run when the schedule fires.

Create the Function · JavaScript
// Deploy as ZIP: runtime nodejs20.x, handler index.handler
// Scheduler/Cron delivery includes payloadTemplate on the event.

export async function handler(event) {
  const data = event.payloadTemplate || {};
  const { accountId, type } = data;

  await sendTrialReminder({ accountId, type });
  return { sent: true, accountId };
}

Ready to schedule your first action?

Also see Scheduler, Cron and Functions product docs.

Schedule work from your existing application

Keep your application where it is. Create RocketStack schedules from server-side routes and keep API keys off the client.

Keep your Next.js application where it is and create RocketStack schedules from server-side routes or actions.

Next.js example
// app/api/schedule-reminder/route.ts — server-side only
export async function POST(request: Request) {
  const { accountId } = await request.json()
  const runAt = new Date(Date.now() + 60 * 60 * 1000).toISOString()

  const res = await fetch('https://api.rocketstack.sh/schedules', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.ROCKETSTACK_API_KEY}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      name: `trial-reminder-${accountId}`.replace(/[^a-zA-Z0-9-_]/g, '-'),
      runAt,
      deliveryTarget: {
        type: 'function',
        functionId: process.env.ROCKETSTACK_FUNCTION_ID
      },
      payloadTemplate: {
        accountId,
        type: 'trial.reminder'
      }
    })
  })

  const body = await res.json()
  return Response.json({ scheduleId: body.data.scheduleId, runAt }, { status: 201 })
}

Related reading: View the Next.js template

Next.js starter

Start from a working scheduled-actions example

Clone a Next.js application with one-time Scheduler actions, recurring Cron jobs, and typed Function processing.

Scheduled work should remain safe and predictable

Principle 1

Store times in UTC

Convert user-facing dates and time zones before creating a schedule. Scheduler runAt values must be RFC 3339 with a timezone; Cron uses an IANA timezone (default UTC).

Principle 2

Make actions idempotent

A repeated invocation should not send duplicate notifications or apply the same state change twice.

Principle 3

Separate scheduling from long-running work

When a scheduled Function starts larger asynchronous work, enqueue that work to Queue so the schedule delivery stays short.

Principle 4

Track completion separately

Record application-level completion state rather than assuming that invocation means the business action succeeded.

Deploy scheduled actions from your coding agent

Use RocketStack MCP to deploy the Function and create the Scheduler or Cron resource behind the workflow.

MCP deployment prompt
Add a one-time trial reminder to this application using RocketStack.

Requirements:
- Deploy a RocketStack Function that sends the reminder
- Create a RocketStack Scheduler action for one hour after signup
- Pass the account and user identifiers in the invocation payloadTemplate
- Keep the workflow safe to retry
- Store secrets in server-side environment variables
- Surface failed executions clearly

See what is scheduled, what ran, and what needs attention

Build scheduled workflows on the Free plan

Scheduler, Cron, Functions, Queue, and KV are available on Free with lower monthly allowances.

  • Scheduler schedules250 / mo
  • Cron2 jobs, 250 invocations / mo
  • Function invocations5,000 / mo

PRIVATE ALPHA

Build this workflow with the RocketStack team

Bring a real application, complete the setup during a guided session, and help shape the product.

Apply for the alpha

FAQ

Stop maintaining Cron infrastructure

Create a free account and deploy the Scheduler, Cron, and Function behind your first scheduled workflow.

Need recurring jobs? Read the Cron documentation.