Skip to main content
Big news! Interval has been acquired by Meter. Learn more →

Queued actions

Interval supports enqueuing actions using interval.enqueue(). Queued actions appear at the top of the Dashboard and include the name of the action, the params passed into the action (if any), and a button to run or cancel the action. Queued actions are automatically removed from the list after they're run or canceled, or if they're programmatically canceled using interval.dequeue().

Queued actions can be assigned to a specific user by their email address. Queued actions assigned to a user will only be visible to that user.

Usage

const queuedAction = await interval.enqueue("moderate_comment", {
assignee: "alex@interval.com",
params: {
commentId: "fzlGEIA82Yf27FgB2WAAQ",
},
});

// Optionally cancel a queued action by its ID:
await interval.dequeue(queuedAction.id);
info

The enqueue and dequeue methods are available as interval.actions.enqueue and interval.actions.dequeue on SDK versions prior to 0.38.0.

Props

assignee

Optional

string

Optional email address of a user to assign the action to. If included, the enqueued action will only appear in that user's dashboard. Otherwise, it will appear for all users.

params

Optional

Record<string, any>

Arbitrary key/value pairs to be passed to the given action slug.

Returns

object

assignee

string | undefined

The email address of the user that the action was assigned to, if one was provided.

id

string

A unique ID pointing to the instance of the enqueued action. This ID can be used with `interval.routes.dequeue(id)` to cancel a queued action.

params

object

The params that were passed to the action.
Was this section useful?
On this page