Set up the Zapier SDK for me. Before installing anything:
- Tell me what folder we're currently in (run `pwd` and report the path).
- Ask me whether to install here or in a different directory.
End with: "Should I set up here, or do you want to point me at a different directory?" Then STOP and wait for my reply. If I name a different directory, `cd` to it (creating it with `mkdir -p` if it doesn't exist) first. If my reply is ambiguous, default to the current directory.
Once I've confirmed the directory, work through these steps one at a time, running each command in the terminal and telling me what happened before moving on:
1. Detect the package manager.
Check for pnpm-lock.yaml, yarn.lock, bun.lockb, or package-lock.json. If one exists, use that manager instead of npm for every install command below. If none exist, default to npm.
2. Ensure a project exists.
- If there's already a package.json, this is an existing project — use it as-is. Remember this for step 9.
- If there's no package.json, create one: npm init -y
3. Check Node.js is installed at version 20 or higher: node -v
- If Node is not found: tell me to install it from https://nodejs.org or run brew install node, then stop.
- If Node is older than 20: tell me to upgrade it, then stop.
4. Install the SDK: npm install @zapier/zapier-sdk
- An EPERM error on ~/.npm/_cacache usually means the command sandbox is blocking npm's cache writes, not a file permissions issue.
5. Install dev dependencies: npm install -D @zapier/zapier-sdk-cli @types/node typescript tsx
6. (Optional) Install the Zapier SDK skill for agent context: npx skills add zapier/sdk -y
This gives you richer context about the SDK — it is not the SDK itself. If it fails for any reason, skip it and continue.
7. Log in to Zapier: npx zapier-sdk login --non-interactive
- The --non-interactive flag tells the CLI not to ask interactive questions, so login won't stall waiting on you. Always pass it when running login.
- This opens a browser window. A permissions or sandbox error here typically means the command sandbox is preventing credentials from being written to disk.
- If login fails for another reason, try again.
- After login succeeds, confirm: "You are authenticated as <email>."
8. List my connected apps: npx zapier-sdk list-connections --owner me --json 2>/dev/null | head -n 1000
- Read the output and show only the first 10 results as a markdown table with columns: ID, App Key, Expired. Do not show Title. Always tell me how many total connections there are, and if there are more than 10, note that you are only showing the first 10.
- The page size is 100. If the output contains exactly 100 connections, there may be additional connections beyond this first page. Just note that and move on — do not fetch additional pages.
- If the list is empty: tell me to connect at least one app at https://zapier.com/app/assets/connections and come back.
9. If this is an existing project (from step 2): suggest how to integrate the SDK.
Scan the codebase — look at the source files, framework, and structure. Suggest 2–3 concrete ways to integrate the Zapier SDK into this app (e.g. "add a /api/zapier/connections route to your Express server", "create a Zapier tool in your agent's tool registry", "add a sync script that pulls CRM data into your existing DB layer"). Be specific to what you find — reference actual files and patterns.
If this is a fresh project, skip this step.
Once all steps are done, tell me I am ready and explain:
Zapier has pre-built connectors for 9,000+ apps — Slack, Google Sheets, Salesforce, GitHub, and thousands more. The Zapier SDK and CLI expose that same integration layer to code. Instead of building OAuth flows, handling token refresh, and reverse-engineering each app's API yourself, you get a single consistent interface that already knows how to talk to all of them. Your users' existing Zapier connections are authenticated and ready to use.
- **TypeScript SDK — build production integrations and agent tools:** the SDK is for shipping. Use it when you need something repeatable, embedded, or in production — a scheduled workflow, a backend service, a tool inside an AI agent. It's type-safe, handles token refresh and retries automatically, and uses the same app keys, action keys, and input shapes you already discovered via the CLI. See the SDK reference: https://docs.zapier.com/sdk/reference
- **CLI — explore, run one-offs, or let an agent act:** the CLI is for exploration and ad-hoc action. Use it to see what an app can do, inspect the exact inputs an action expects, and run actions interactively — whether that's you in a terminal or an agent executing a task on demand. See the CLI reference: https://docs.zapier.com/sdk/cli-reference
**Want to run a quick test?**
If I have a Slack connection, offer to send me a DM on Slack using the SDK. Describe what will happen and end with: "Want to run this quick test?" Then STOP. Do not output anything else. Do not continue to the next section. Wait for my reply before proceeding.
When I reply to the quick test, only proceed if my response is a clear, unambiguous affirmative (e.g. "yes", "go ahead"). If ambiguous or unclear, skip the test and continue.
If I don't have a Slack connection, skip the test and continue.
---
When I reply yes to the quick test, create src/zapier-slack-test.ts with code that:
1. Looks up my Slack user by email using sdk.runAction("slack", "search", "user_by_email", { connectionId: ID, inputs: { email: "ZAPIER_EMAIL" } }).
2. Sends a DM to myself using sdk.runAction("slack", "write", "direct_message", { connectionId: ID, inputs: { channel: "USERNAME", text: "Hello via Zapier SDK 👋" } }).
Replace ID, ZAPIER_EMAIL, and USERNAME with real values from earlier steps. Run it with npx tsx src/zapier-slack-test.ts. If user_by_email fails, ask me for my Slack email and try again.
---
After the test completes (or if I skip it, or if there's no Slack connection):
Pick 1–3 apps from the connections table and show me the commands I could use to explore what actions they support. Do not run these commands — just display them so I can try on my own. For example:
npx zapier-sdk list-actions APP_KEY
**All set! A few ideas to start building with the Zapier SDK:**
Suggest 3 ideas worth exploring — good starting points based on my connected apps. Each idea reads from one app, optionally processes it, and writes to another. Do not suggest anything event-driven. Keep each idea to one sentence. Examples: "get all your in-progress Jira issues and DM yourself a tidy table on Slack"; "pull every HubSpot deal that closed this week and drop it into a Google Sheet". Make the ideas specific to my connected apps — not generic.