@zapier/zapier-sdk-cli 0.68.0 → 0.69.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/zapier-sdk-cli",
3
- "version": "0.68.0",
3
+ "version": "0.69.0",
4
4
  "description": "Command line interface for Zapier SDK",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -79,6 +79,7 @@
79
79
  "commander": "^12.0.0",
80
80
  "conf": "^14.0.0",
81
81
  "cross-keychain": "^1.1.0",
82
+ "cross-spawn": "^7.0.6",
82
83
  "esbuild": "^0.25.5",
83
84
  "express": "^5.1.0",
84
85
  "handlebars": "^4.7.8",
@@ -94,10 +95,11 @@
94
95
  "typescript": "^5.8.3",
95
96
  "wrap-ansi": "^10.0.0",
96
97
  "zod": "4.3.6",
97
- "@zapier/zapier-sdk": "0.92.0",
98
- "@zapier/zapier-sdk-mcp": "0.18.21"
98
+ "@zapier/zapier-sdk": "0.92.1",
99
+ "@zapier/zapier-sdk-mcp": "0.18.22"
99
100
  },
100
101
  "devDependencies": {
102
+ "@types/cross-spawn": "^6.0.6",
101
103
  "@types/express": "^5.0.3",
102
104
  "@types/inquirer": "^9.0.8",
103
105
  "@types/jsonwebtoken": "^9.0.10",
@@ -113,6 +115,6 @@
113
115
  "clean": "rm -rf dist",
114
116
  "rebuild": "pnpm clean && pnpm build",
115
117
  "dev": "tsx src/cli.ts",
116
- "typecheck": "tsc --project tsconfig.build.json --noEmit"
118
+ "typecheck": "tsc --project tsconfig.build.json --noEmit && tsc --project tsconfig.test.json"
117
119
  }
118
120
  }
@@ -0,0 +1,38 @@
1
+ import { createZapierSdk } from "@zapier/zapier-sdk";
2
+
3
+ const app = "__ZAPIER_SDK_SLACK_APP__";
4
+ const connection = "__ZAPIER_SDK_SLACK_CONNECTION__";
5
+ const email = "__ZAPIER_SDK_ACCOUNT_EMAIL__";
6
+
7
+ async function main() {
8
+ const sdk = createZapierSdk();
9
+ const {
10
+ data: [user],
11
+ } = await sdk.runAction({
12
+ app,
13
+ actionType: "search",
14
+ action: "user_by_email",
15
+ connection,
16
+ inputs: { email },
17
+ });
18
+ const userId = user?.id;
19
+
20
+ if (typeof userId !== "string") {
21
+ throw new Error("Slack user lookup did not return a user ID.");
22
+ }
23
+
24
+ await sdk.runAction({
25
+ app,
26
+ actionType: "write",
27
+ action: "direct_message",
28
+ connection,
29
+ inputs: { channel: userId, text: "Hello via Zapier SDK" },
30
+ });
31
+
32
+ console.log("Slack DM sent.");
33
+ }
34
+
35
+ main().catch((error) => {
36
+ console.error(error);
37
+ process.exitCode = 1;
38
+ });
@@ -0,0 +1,38 @@
1
+ import { createZapierSdk } from "@zapier/zapier-sdk";
2
+
3
+ const sdk = createZapierSdk();
4
+ const app = "__ZAPIER_SDK_SLACK_APP__";
5
+ const connection = "__ZAPIER_SDK_SLACK_CONNECTION__";
6
+ const email = "__ZAPIER_SDK_ACCOUNT_EMAIL__";
7
+
8
+ async function main(): Promise<void> {
9
+ const {
10
+ data: [user],
11
+ } = await sdk.runAction({
12
+ app,
13
+ actionType: "search",
14
+ action: "user_by_email",
15
+ connection,
16
+ inputs: { email },
17
+ });
18
+ const userId = (user as { id?: unknown } | undefined)?.id;
19
+
20
+ if (typeof userId !== "string") {
21
+ throw new Error("Slack user lookup did not return a user ID.");
22
+ }
23
+
24
+ await sdk.runAction({
25
+ app,
26
+ actionType: "write",
27
+ action: "direct_message",
28
+ connection,
29
+ inputs: { channel: userId, text: "Hello via Zapier SDK" },
30
+ });
31
+
32
+ console.log("Slack DM sent.");
33
+ }
34
+
35
+ main().catch((error: unknown) => {
36
+ console.error(error);
37
+ process.exitCode = 1;
38
+ });