await dynamicSchedule.register(userId, {
  type: "cron",
  options: {
    cron: "0 0 * * *",
  },
});

Parameters

id
string
required

The id of the schedule to register. The identifier you use will be available in the context.source.id when the Job runs.

schedule
Schedule
required

The schedule to register. It is either a cron or interval schedule.

Returns

id
string

The id of the schedule that was registered.

schedule
Schedule

The schedule that was registered, one of “cron” or “interval”.

metadata
any
required

Metadata about the schedule.

active
boolean
required

Whether the schedule is active or not.

Was this page helpful?