Skip to main content

Writing actions

Actions are the foundation of tools built with Interval. Actions are just async functions which means anything you can do within a JavaScript function is possible within an action. And by extension, if you know how to write JavaScript functions, you know how to write Interval actions.

But actions have access to special functionality that other functions don't, namely they can:

Defining an action‚Äč

Actions are identified by slugs that are defined in your code and are unique to your organization.

An action can be defined in two ways. The simplest and most common is to provide an async function as the value in your key:value map of actions. If you want to set additional metadata for an action in code, you can specify an object containing a handler function instead:

import Interval from "@interval/sdk";

const interval = new Interval({
apiKey: "<YOUR API KEY>", // get an API key at
actions: {
refund_user: async () => {
// action logic here
import_data: {
handler: async () => {
// action logic here
name: "Import data",
description: "Imports data.",
backgroundable: true,

Did this section clearly explain what you wanted to learn?
On this page