Parameters

idrequired
string

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

schedulerequired
Schedule

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”.

metadatarequired
any

Metadata about the schedule.

activerequired
boolean

Whether the schedule is active or not.

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