diff --git a/content/concepts/schedules.mdx b/content/concepts/schedules.mdx index 0035f4dd..77b670f9 100644 --- a/content/concepts/schedules.mdx +++ b/content/concepts/schedules.mdx @@ -48,6 +48,7 @@ const schedules = await knock.workflows.createSchedules("park-alert", { minutes: 30, }, ], + ending_at: "2024-01-02T10:00:00Z", // Schedule will stop after this date data: { type: "dinosaurs-loose" }, tenant: "jpark", }); @@ -63,7 +64,8 @@ const knock = new Knock(process.env.KNOCK_API_KEY); const schedules = await knock.workflows.createSchedules("park-alert", { recipients: ["jhammond", "esattler", "dnedry"], - scheduled_at: "2023-12-22 17:45:00Z", + scheduled_at: "2023-12-22T17:45:00Z", + ending_at: "2023-12-31T23:59:59Z", // Schedule will not execute after this time data: { type: "dinosaurs-loose" }, tenant: "jpark", }); @@ -71,15 +73,16 @@ const schedules = await knock.workflows.createSchedules("park-alert", { ### Schedule properties -| Variable | Type | Description | -| -------------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `recipients` | RecipientIdentifier[] | One or more recipient identifiers, or complete recipients to be upserted. | -| `workflow` | string | The workflow to trigger. | -| `repeats` | ScheduleRepeat[] | A list of one or more repeats (see below). Required if you're creating a recurring schedule. | -| `data` | map | Custom data to pass to every workflow trigger. | -| `tenant` | string | A tenant to pass to the workflow trigger. | -| `actor` | RecipientIdentifier | An identifier of an actor, or a complete actor to be upserted. | -| `scheduled_at` | utc_datetime | A UTC datetime in ISO-8601 format representing the start moment for the recurring schedule, or the exact and only execution moment for the non-recurring schedule. | +| Variable | Type | Description | +| -------------- | --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `recipients` | RecipientIdentifier[] | One or more recipient identifiers, or complete recipients to be upserted. | +| `workflow` | string | The workflow to trigger. | +| `repeats` | ScheduleRepeat[] | A list of one or more repeats (see below). Required if you're creating a recurring schedule. | +| `data` | map | Custom data to pass to every workflow trigger. | +| `tenant` | string | A tenant to pass to the workflow trigger. | +| `actor` | RecipientIdentifier | An identifier of an actor, or a complete actor to be upserted. | +| `scheduled_at` | utc_datetime | A UTC datetime in ISO-8601 format representing the start moment for the recurring schedule, or the exact and only execution moment for the non-recurring schedule. | +| `ending_at` | utc_datetime | A UTC datetime in ISO-8601 format that indicates when the schedule should end. Once the current schedule time passes `ending_at`, no further occurrences will be scheduled. | Currently no, but we'll be looking to add this feature in the near future. + + The `ending_at` parameter allows you to set an expiration time for both + recurring and one-off schedules. For recurring schedules, no new occurrences + will be scheduled after the `ending_at` time is reached. For one-off + schedules, the schedule will not execute if the `scheduled_at` time is after + the `ending_at` time. The `ending_at` time must be specified in UTC ISO-8601 + format, for example: "2024-01-02T10:00:00Z". + Yes, you can update the schedule to change from recurring to non-recurring (or vice versa). This can be done by removing the `repeats` property and