Installation
- TypeScript
- JavaScript
- Python Experimental
The Interval SDK is a pure JS Node.js module requiring Node.js version 16 or greater.
We built Interval from the ground up specifically for TypeScript and we strongly recommend using it when building your apps. Interval's I/O methods do the heavy lifting of parsing, sanitizing, and type checking all user input.
info
Although Interval's SDK is pre-1.0, several companies (ourselves included) use Interval to create "production" tools. Before 1.0 you can expect meaningful additions and changes to the SDK.
The Interval SDK is a pure JS Node.js module requiring Node.js version 16 or greater.
We built Interval from the ground up specifically for TypeScript and we strongly recommend using it when building your apps. Interval's I/O methods do the heavy lifting of parsing, sanitizing, and type checking all user input.
info
Although Interval's SDK is pre-1.0, several companies (ourselves included) use Interval to create "production" tools. Before 1.0 you can expect meaningful additions and changes to the SDK.
The Interval SDK is a Python library requiring Python version 3.9 or greater. (Let us know if you need support for an earlier version!)
We built Interval from the ground up to leverage typing as much as possible, and we recommend using it when building your apps. Interval's I/O methods do the heavy lifting of parsing, sanitizing, and type checking all user input with the help of pydantic.
info
Although Interval's SDK is pre-1.0, several companies (ourselves included) use Interval to create "production" tools. Before 1.0 you can expect meaningful additions and changes to the SDK.
Creating a new app
If you're starting from scratch, create-interval-app allows you to initialize a new TypeScript or JavaScript Interval app with a single command.
npx create-interval-app --template=refund-charges --language=ts
If you're starting from scratch, create-interval-app allows you to initialize a new TypeScript or JavaScript Interval app with a single command.
npx create-interval-app --template=refund-charges --language=ts
If you're starting from scratch, check out Interval's library of example apps as an existing foundation to build on.
Adding Interval to an existing app
If you have one, we recommend adding Interval to your existing Node.js app. We've found that teams are able to move incredibly quickly by sharing code between their main app and internal tools built with Interval.
When your Interval actions are defined alongside the code in your main app, code sharing is as simple as importing shared functions and calling them within your actions.
To add Interval to your app:
npm install @interval/sdk
Once the SDK is installed, you can create a minimal Interval app:
import path from "path";
import { Interval } from "@interval/sdk";
const interval = new Interval({
apiKey: "<YOUR API KEY>" // get an API key at https://interval.com/dashboard/develop/keys
routesDirectory: path.resolve(__dirname, "routes"),
});
// This is important! If you don't call listen(), your app won't connect to Interval.
interval.listen();
import { Action, io } from "@interval/sdk";
export default new Action(async () => {
const name = await io.input.text("Your name");
return `Hello, ${name}`;
});
A few things to note:
- Calling
.listen()
sets up a persistent connection between your app and Interval. - Actions are defined as a map of slug identifiers to async handler functions.
- The Interval API key that you use determines whether your app will run in Dev mode or Live mode.
- Starting with version
0.36.0
of the SDK, you can addlogLevel: "quiet"
to theInterval
constructor to silence informational logs and warnings if desired.
If you have one, we recommend adding Interval to your existing Node.js app. We've found that teams are able to move incredibly quickly by sharing code between their main app and internal tools built with Interval.
When your Interval actions are defined alongside the code in your main app, code sharing is as simple as importing shared functions and calling them within your actions.
To add Interval to your app:
npm install @interval/sdk
Once the SDK is installed, you can create a minimal Interval app:
const path = require("path");
const { Interval } = require("@interval/sdk");
const interval = new Interval({
apiKey: "<YOUR API KEY>" // get an API key at https://interval.com/dashboard/develop/keys
routesDirectory: path.resolve(__dirname, "routes"),
});
// This is important! If you don't call listen(), your app won't connect to Interval.
interval.listen();
const { Action, io } = require("@interval/sdk");
module.exports = new Action(async () => {
const name = await io.input.text("Your name");
return `Hello, ${name}`;
});
A few things to note:
- Calling
.listen()
sets up a persistent connection between your app and Interval. - Actions are defined as a map of slug identifiers to async handler functions.
- The Interval API key that you use determines whether your app will run in Dev mode or Live mode.
- Starting with version
0.36.0
of the SDK, you can addlogLevel: "quiet"
to theInterval
constructor to silence informational logs and warnings if desired.
If you have one, we recommend adding Interval to your existing app. We've found that teams are able to move incredibly quickly by sharing code between their main app and internal tools built with Interval.
When your Interval actions are defined alongside the code in your main app, code sharing is as simple as importing shared functions and calling them within your actions.
To add Interval to your app:
pip install interval-sdk
Once the SDK is installed, you can create a minimal Interval app:
from interval_sdk import Interval, IO
interval = Interval(
"<YOUR API KEY>", # get an API key at https://interval.com/dashboard/develop/keys
)
@interval.action
async def hello_world(io: IO):
name = await io.input.text("Your name")
return f"Hello {name}"
# This is important! If you don't call listen(), your app won't connect to Interval.
interval.listen()
A few things to note:
- Calling
.listen()
sets up a persistent connection between your app and Interval. - Actions are defined as a methods with the
@interval.action
decorator. - The Interval API key that you use determines whether your app will run in Dev mode or Live mode.
- You can add
log_level="quiet"
to theInterval
constructor to silence informational logs and warnings if desired.