|
| 1 | +--- |
| 2 | +order: 3 |
| 3 | +pcx-content-type: how-to |
| 4 | +--- |
| 5 | + |
| 6 | +# Create scheduled events |
| 7 | + |
| 8 | +When you want to customize the behavior of a waiting room for a specific period of time — such as changing the queueing method or increasing the total active users — set up a **scheduled event**. |
| 9 | + |
| 10 | +Any properties set on the event will override the default property on the waiting room for the duration of the event. |
| 11 | + |
| 12 | +<Aside type="note"> |
| 13 | + |
| 14 | +Only some customers can support scheduled events with their waiting rooms. For more details, see our <a href="/plans">Plans</a> page. |
| 15 | + |
| 16 | +</Aside> |
| 17 | + |
| 18 | +## Create an event |
| 19 | + |
| 20 | +At the moment, you can only create an event using the API. |
| 21 | + |
| 22 | +To create an event, make a [POST request](https://api.cloudflare.com/#waiting-room-create-event) including [required and optional parameters](#properties). Any properties set on the event will override the default property on the waiting room for the duration of the event. |
| 23 | + |
| 24 | +If you are using a [custom template](../customize-waiting-room#custom-waiting-room), you may want to add [relevant variables](https://api.cloudflare.com/#waiting-room-update-waiting-room) to your template (listed under the `json_response_enabled` parameter). |
| 25 | + |
| 26 | +<Aside type="note"> |
| 27 | + |
| 28 | +If you need to create overlapping events, use different waiting rooms. |
| 29 | + |
| 30 | +</Aside> |
| 31 | + |
| 32 | +### Properties |
| 33 | + |
| 34 | +Though most properties are identical to those on a [regular waiting room](https://api.cloudflare.com/#waiting-room-properties), there are a few unique to [creating an event](https://api.cloudflare.com/#waiting-room-create-event): |
| 35 | + |
| 36 | +- `name` (required): Unique name with alphanumeric characters, hyphens, and underscores. |
| 37 | +- `event_start_time` (required): ISO 8601 timestamp that marks the start of the event. At this time, queued users will be processed with the event's configuration. Must occur at least 1 minute before `event_end_time`. |
| 38 | +- `event_end_time` (required): ISO 8601 timestamp that marks the end of the event. |
| 39 | +- `shuffle_at_event_start`: If **true** and `prequeue_start_time` is not null, users in the prequeue will be shuffled randomly at the `event_start_time`. Commonly used to ensure fairness if your event is using a [**FIFO** queueing method](#set-up-a-lottery). |
| 40 | +- `prequeue_start_time`: ISO 8601 timestamp that marks when to begin queueing all users before the event starts. Must occur at least **5 minutes before** `event_start_time`. |
| 41 | +- `description`: A text description providing more detail about the event. |
| 42 | +- `suspended`: If **true**, the event is ignored and traffic is handled based on the waiting room's normal configuration. |
| 43 | + |
| 44 | +## Set up a "lottery" |
| 45 | + |
| 46 | +Set up a "lottery" system to reward all users who enter into the queue prior to your event start time. |
| 47 | + |
| 48 | +Users who reach your application **during the prequeue period** are [randomly assigned](/reference/queueing-methods#random) a place in line when the event starts. If the event uses [FIFO ordering](/reference/queueing-methods#first-in-first-out-fifo), users who reach your application **after the prequeue period** are assigned places after users from the prequeue. |
| 49 | + |
| 50 | +To set up a "lottery", include the [following parameters](#properties) in your API request: |
| 51 | + |
| 52 | +- `prequeue_start_time` |
| 53 | +- `shuffle_at_event_start` |
| 54 | + |
| 55 | +## Preview an event configuration |
| 56 | + |
| 57 | +Since some properties set on an event will override the default property of a waiting room for the duration of an event, you should use the API to [preview an event configuration](https://api.cloudflare.com/#waiting-room-preview-active-event-details) before it begins. |
| 58 | + |
| 59 | +This command shows you the event's configuration as if it were active, meaning that inherited fields from the waiting room will display their current values. |
| 60 | + |
| 61 | +## Edit an event |
| 62 | + |
| 63 | +To edit an event, use a [PATCH request](https://api.cloudflare.com/#waiting-room-patch-event). |
| 64 | + |
| 65 | +## Disable events |
| 66 | + |
| 67 | +You can disable an event by setting its `suspended` parameter to `true`. |
| 68 | + |
| 69 | +Additionally, events will not become active if a waiting room itself is **Disabled**. |
| 70 | + |
| 71 | +## Other API commands |
| 72 | + |
| 73 | +Function | Command |
| 74 | +---------|--------- |
| 75 | +[Get event details](https://api.cloudflare.com/#waiting-room-event-details) | `GET` |
| 76 | +[List scheduled events](https://api.cloudflare.com/#waiting-room-list-events) | `GET` |
| 77 | +[Delete event](https://api.cloudflare.com/#waiting-room-delete-event) | `DELETE` |
0 commit comments