Skip to main content
This guide walks you through installing the SDK, authenticating, and running your first action.

Prerequisites

  • Node.js 18+ installed
  • A Zapier account (free tier works)
  • At least one app connected to your Zapier account

Step 1: Install the SDK

Create a new project (or use an existing one) and install the required packages:
# Create a new project (optional)
mkdir my-zapier-project && cd my-zapier-project
npm init -y

# Install the SDK and CLI
npm install @zapier/zapier-sdk
npm install -D @zapier/zapier-sdk-cli @types/node typescript

# Initialize TypeScript (if starting fresh)
npx tsc --init
Set "type": "module" in your package.json to use ES modules, which the examples in this guide assume.

Step 2: Authenticate

The SDK CLI provides a simple browser-based authentication flow:
npx zapier-sdk login
This opens your browser to authenticate with Zapier. Once complete, your credentials are stored locally and managed automatically.
For server-side applications, you can use client credentials instead:
const zapier = createZapierSdk({
  credentials: {
    clientId: process.env.ZAPIER_CREDENTIALS_CLIENT_ID,
    clientSecret: process.env.ZAPIER_CREDENTIALS_CLIENT_SECRET,
  },
});
You can also provide a token directly:
const zapier = createZapierSdk({
  credentials: process.env.ZAPIER_CREDENTIALS,
});

Step 3: Generate Types for Your Apps

The SDK can generate TypeScript types for any app, giving you full autocomplete and type safety:
# Add types for the apps you want to use
npx zapier-sdk add slack google-sheets

# Don't know the app key? Search for it
npx zapier-sdk list-apps --search "google sheets"
Types are generated in your src or lib folder by default. You can customize the output location:
npx zapier-sdk add slack --types-output ./types

Step 4: Initialize the SDK

Create a new file (e.g., index.ts) and initialize the SDK:
import { createZapierSdk } from "@zapier/zapier-sdk";

// Initialize with browser-based auth (from `zapier-sdk login`)
const zapier = createZapierSdk();

Step 5: List Your Connected Apps

Let’s verify everything works by listing available apps:
import { createZapierSdk } from "@zapier/zapier-sdk";

const zapier = createZapierSdk();

// List the first page of apps
const { data: apps } = await zapier.listApps();

console.log("Available apps:", apps.map(app => app.title));
Run your script:
npx tsx index.ts

Step 6: Run Your First Action

Now let’s execute an action. First, you’ll need an authentication for the app you want to use:
import { createZapierSdk } from "@zapier/zapier-sdk";

const zapier = createZapierSdk();

// Get your Slack authentications
const { data: slackAuths } = await zapier.listAuthentications({
  appKey: "slack",
  owner: "me",
});

if (slackAuths.length === 0) {
  console.log("No Slack auth found. Connect Slack at zapier.com first.");
  process.exit(1);
}

// List Slack channels using your authentication
const { data: channels } = await zapier.runAction({
  appKey: "slack",
  actionType: "read",
  actionKey: "channels",
  authenticationId: slackAuths[0].id,
});

console.log("Your Slack channels:", channels);

Step 7: Use the Proxy Pattern (Optional)

For a cleaner syntax, use the app proxy pattern:
import { createZapierSdk } from "@zapier/zapier-sdk";

const zapier = createZapierSdk();

// Get your authentication
const { data: slackAuths } = await zapier.listAuthentications({
  appKey: "slack",
  owner: "me",
});

// Create a bound Slack instance
const mySlack = zapier.apps.slack({
  authenticationId: slackAuths[0].id,
});

// Now use it with a clean syntax
const { data: channels } = await mySlack.read.channels({});

console.log("Channels:", channels);

// Or pass auth inline without binding
const { data: users } = await zapier.apps.slack.search.user_by_email({
  inputs: { email: "colleague@company.com" },
  authenticationId: slackAuths[0].id,
});

Complete Example

Here’s a full example that sends a Slack message:
import { createZapierSdk } from "@zapier/zapier-sdk";

async function main() {
  const zapier = createZapierSdk();

  // Get Slack authentication
  const { data: slackAuths } = await zapier.listAuthentications({
    appKey: "slack",
    owner: "me",
  });

  if (slackAuths.length === 0) {
    throw new Error("Please connect Slack to your Zapier account first");
  }

  // Create bound Slack instance
  const slack = zapier.apps.slack({
    authenticationId: slackAuths[0].id,
  });

  // Get available channels
  const { data: channels } = await slack.read.channels({});
  const generalChannel = channels.find(c => c.name === "general");

  if (!generalChannel) {
    throw new Error("Could not find #general channel");
  }

  // Send a message
  const { data: result } = await slack.write.send_channel_message({
    inputs: {
      channel: generalChannel.id,
      text: "Hello from the Zapier SDK! 🚀",
    },
  });

  console.log("Message sent!", result);
}

main().catch(console.error);

Next Steps