The ability to attach metadata when creating a schedule

When creating a schedule using the SDK you can set an externalId

const createdSchedule = await schedules.create({
  //The id of the scheduled task you want to attach to.
  task: firstScheduledTask.id,
  //The schedule in cron format.
  cron: "0 0 * * *",
  // Optional, it defaults to "UTC". In IANA format, e.g. "America/New_York".
  // In this case, the task will run at midnight every day in New York time.
  // If you specify a timezone it will automatically work with daylight saving time.
  timezone: "America/New_York",
  //Optionally, you can specify your own IDs (like a user ID) and then use it inside the run function of your task.
  //This allows you to have per-user cron tasks.
  externalId: "user_123456",
  //You can only create one schedule with this key.
  //If you use it twice, the second call will update the schedule.
  //This is useful because you don't want to create duplicate schedules for a user.
  deduplicationKey: "user_123456-todo_reminder",
});


You can use this to then look up data in the run using the externalId.

But it would also be useful to be able to attach metadata to a scheduled and then get that data inside the run. The metadata would probably be a Record<string, string | number | boolean> type.

Upvoters
Status

In Review

Board

πŸ’‘ Feature Request

Date

Over 1 year ago

Author

mattaitken

Subscribe to post

Get notified by email when there are changes.