Node.js SDK

The official Slotflow SDK for Node.js and TypeScript. Fully typed, with automatic retries and error handling.

Installation

$npm install slotflow

Quick example

1import { SlotflowClient } from "slotflow";
2
3const client = new SlotflowClient({
4 token: "sk_live_your_api_key",
5});
6
7// Find available slots
8const { slots } = await client.slots.getAvailableSlots({
9 humanId: "HUMAN_ID",
10 date_from: "2026-03-15",
11 date_to: "2026-03-20",
12 duration: 30,
13});
14
15// Book the first slot
16const booking = await client.bookings.createBooking({
17 human_id: "HUMAN_ID",
18 starts_at: slots[0].starts_at,
19 duration: 30,
20 attendee_name: "Alex Rivera",
21 attendee_email: "alex@startup.io",
22 metadata: {
23 lead_id: "lead_8294",
24 source: "ai_sdr",
25 },
26});

Resources

All API resources are available as typed methods on the client:

ResourceMethods
client.humanscreateHuman, getHuman, listHumans, deleteHuman
client.availabilitysetAvailability
client.scheduleOverridescreateOverride, listOverrides, deleteOverride
client.slotsgetAvailableSlots
client.bookingscreateBooking, listBookings, cancelBooking
client.webhookscreateWebhook, listWebhooks, deleteWebhook

Error handling

The SDK throws typed errors you can catch and handle:

1import { SlotflowClient, Slotflow } from "slotflow";
2
3try {
4 await client.bookings.createBooking({ /* ... */ });
5} catch (error) {
6 if (error instanceof Slotflow.ConflictError) {
7 // 409 — slot was just booked by someone else
8 // Re-query slots and try the next one
9 }
10 if (error instanceof Slotflow.PaymentRequiredError) {
11 // 402 — booking limit reached
12 }
13 if (error instanceof Slotflow.NotFoundError) {
14 // 404 — human not found
15 }
16 if (error instanceof Slotflow.UnprocessableEntityError) {
17 // 422 — validation error (outside working hours, invalid duration, etc.)
18 }
19}

Configuration

1const client = new SlotflowClient({
2 token: "sk_live_your_api_key",
3
4 // Override the default timeout (seconds)
5 timeoutInSeconds: 30,
6
7 // Override the default retry count
8 maxRetries: 3,
9
10 // Custom fetch (e.g. for edge runtimes)
11 fetch: myCustomFetch,
12});

You can also override settings per request:

1await client.bookings.listBookings({}, {
2 timeoutInSeconds: 10,
3 maxRetries: 0,
4});

Requirements