@zernio/node 0.2.170 → 0.2.172

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/dist/index.d.mts CHANGED
@@ -2804,6 +2804,14 @@ type PostAnalytics = {
2804
2804
  saves?: number;
2805
2805
  clicks?: number;
2806
2806
  views?: number;
2807
+ /**
2808
+ * Instagram Reels only: average watch time per play, in milliseconds. 0 for non-Reels media and other platforms.
2809
+ */
2810
+ igReelsAvgWatchTime?: number;
2811
+ /**
2812
+ * Instagram Reels only: total watch time including replays, in milliseconds. 0 for non-Reels media and other platforms.
2813
+ */
2814
+ igReelsVideoViewTotalTime?: number;
2807
2815
  engagementRate?: number;
2808
2816
  lastUpdated?: string;
2809
2817
  };
@@ -10574,21 +10582,33 @@ type CreateInboxConversationData = {
10574
10582
  */
10575
10583
  accountId: string;
10576
10584
  /**
10577
- * Twitter numeric user ID of the recipient. Provide either this or participantUsername.
10585
+ * Recipient identifier. For X this is the numeric user ID; for WhatsApp, the recipient phone number in international format (digits, country code included). Provide either this or participantUsername.
10578
10586
  */
10579
10587
  participantId?: string;
10580
10588
  /**
10581
- * Twitter username (with or without @) of the recipient. Resolved to a user ID via lookup. Provide either this or participantId.
10589
+ * Recipient handle/username — an X or Bluesky handle (with or without @) or a Reddit username (with or without u/). Resolved via lookup. Provide either this or participantId.
10582
10590
  */
10583
10591
  participantUsername?: string;
10584
10592
  /**
10585
- * Text content of the message. At least one of message or attachment is required.
10593
+ * Text content of the message. At least one of message, attachment, or (for WhatsApp) templateName is required.
10586
10594
  */
10587
10595
  message?: string;
10588
10596
  /**
10589
- * Skip the receives_your_dm eligibility check before sending. Use if you have already verified the recipient accepts DMs.
10597
+ * X/Twitter only. Skip the receives_your_dm eligibility check before sending. Use if you have already verified the recipient accepts DMs.
10590
10598
  */
10591
10599
  skipDmCheck?: boolean;
10600
+ /**
10601
+ * WhatsApp only. Name of the approved template to start the conversation with (required for WhatsApp).
10602
+ */
10603
+ templateName?: string;
10604
+ /**
10605
+ * WhatsApp only. Template language code (e.g. en_US).
10606
+ */
10607
+ templateLanguage?: string;
10608
+ /**
10609
+ * WhatsApp only. Body variable values, in order, substituted into the template body ({{1}}, {{2}}, ...).
10610
+ */
10611
+ templateParams?: Array<(string)>;
10592
10612
  };
10593
10613
  };
10594
10614
  type CreateInboxConversationResponse = ({
package/dist/index.d.ts CHANGED
@@ -2804,6 +2804,14 @@ type PostAnalytics = {
2804
2804
  saves?: number;
2805
2805
  clicks?: number;
2806
2806
  views?: number;
2807
+ /**
2808
+ * Instagram Reels only: average watch time per play, in milliseconds. 0 for non-Reels media and other platforms.
2809
+ */
2810
+ igReelsAvgWatchTime?: number;
2811
+ /**
2812
+ * Instagram Reels only: total watch time including replays, in milliseconds. 0 for non-Reels media and other platforms.
2813
+ */
2814
+ igReelsVideoViewTotalTime?: number;
2807
2815
  engagementRate?: number;
2808
2816
  lastUpdated?: string;
2809
2817
  };
@@ -10574,21 +10582,33 @@ type CreateInboxConversationData = {
10574
10582
  */
10575
10583
  accountId: string;
10576
10584
  /**
10577
- * Twitter numeric user ID of the recipient. Provide either this or participantUsername.
10585
+ * Recipient identifier. For X this is the numeric user ID; for WhatsApp, the recipient phone number in international format (digits, country code included). Provide either this or participantUsername.
10578
10586
  */
10579
10587
  participantId?: string;
10580
10588
  /**
10581
- * Twitter username (with or without @) of the recipient. Resolved to a user ID via lookup. Provide either this or participantId.
10589
+ * Recipient handle/username — an X or Bluesky handle (with or without @) or a Reddit username (with or without u/). Resolved via lookup. Provide either this or participantId.
10582
10590
  */
10583
10591
  participantUsername?: string;
10584
10592
  /**
10585
- * Text content of the message. At least one of message or attachment is required.
10593
+ * Text content of the message. At least one of message, attachment, or (for WhatsApp) templateName is required.
10586
10594
  */
10587
10595
  message?: string;
10588
10596
  /**
10589
- * Skip the receives_your_dm eligibility check before sending. Use if you have already verified the recipient accepts DMs.
10597
+ * X/Twitter only. Skip the receives_your_dm eligibility check before sending. Use if you have already verified the recipient accepts DMs.
10590
10598
  */
10591
10599
  skipDmCheck?: boolean;
10600
+ /**
10601
+ * WhatsApp only. Name of the approved template to start the conversation with (required for WhatsApp).
10602
+ */
10603
+ templateName?: string;
10604
+ /**
10605
+ * WhatsApp only. Template language code (e.g. en_US).
10606
+ */
10607
+ templateLanguage?: string;
10608
+ /**
10609
+ * WhatsApp only. Body variable values, in order, substituted into the template body ({{1}}, {{2}}, ...).
10610
+ */
10611
+ templateParams?: Array<(string)>;
10592
10612
  };
10593
10613
  };
10594
10614
  type CreateInboxConversationResponse = ({
package/dist/index.js CHANGED
@@ -33,6 +33,92 @@ __export(index_exports, {
33
33
  });
34
34
  module.exports = __toCommonJS(index_exports);
35
35
 
36
+ // package.json
37
+ var package_default = {
38
+ name: "@zernio/node",
39
+ version: "0.2.172",
40
+ description: "The official Node.js library for the Zernio API",
41
+ main: "dist/index.js",
42
+ module: "dist/index.mjs",
43
+ types: "dist/index.d.ts",
44
+ sideEffects: false,
45
+ exports: {
46
+ ".": {
47
+ types: "./dist/index.d.ts",
48
+ import: "./dist/index.mjs",
49
+ require: "./dist/index.js"
50
+ },
51
+ "./_shims/*": {
52
+ types: "./dist/_shims/*.d.ts",
53
+ import: "./dist/_shims/*.mjs",
54
+ require: "./dist/_shims/*.js"
55
+ }
56
+ },
57
+ files: [
58
+ "dist",
59
+ "src",
60
+ "README.md",
61
+ "LICENSE"
62
+ ],
63
+ scripts: {
64
+ generate: "openapi-ts -i openapi.yaml -o src/generated -c @hey-api/client-fetch && npm run generate:client",
65
+ "generate:client": "npx tsx scripts/generate-client.ts",
66
+ build: "tsup src/index.ts --format cjs,esm --dts --clean",
67
+ dev: "tsup src/index.ts --format cjs,esm --dts --watch",
68
+ lint: "eslint src",
69
+ typecheck: "tsc --noEmit",
70
+ test: "vitest run",
71
+ "test:watch": "vitest",
72
+ prepublishOnly: "npm run build",
73
+ "fetch-spec": "curl -o openapi.yaml https://zernio.com/openapi.yaml"
74
+ },
75
+ keywords: [
76
+ "zernio",
77
+ "social-media",
78
+ "scheduling",
79
+ "api",
80
+ "sdk",
81
+ "instagram",
82
+ "tiktok",
83
+ "youtube",
84
+ "linkedin",
85
+ "twitter",
86
+ "x",
87
+ "facebook",
88
+ "pinterest",
89
+ "threads",
90
+ "bluesky",
91
+ "snapchat",
92
+ "telegram"
93
+ ],
94
+ author: "Zernio <support@zernio.com>",
95
+ license: "Apache-2.0",
96
+ repository: {
97
+ type: "git",
98
+ url: "git+https://github.com/zernio-dev/zernio-node.git"
99
+ },
100
+ homepage: "https://zernio.com/docs/api",
101
+ bugs: {
102
+ url: "https://github.com/zernio-dev/zernio-node/issues"
103
+ },
104
+ engines: {
105
+ node: ">=18"
106
+ },
107
+ devDependencies: {
108
+ "@hey-api/client-fetch": "^0.6.0",
109
+ "@hey-api/openapi-ts": "^0.61.0",
110
+ "@types/node": "^20.11.0",
111
+ "@typescript-eslint/eslint-plugin": "^7.18.0",
112
+ "@typescript-eslint/parser": "^7.18.0",
113
+ eslint: "^8.56.0",
114
+ tsup: "^8.0.1",
115
+ tsx: "^4.7.0",
116
+ typescript: "^5.3.3",
117
+ vitest: "^1.2.0",
118
+ yaml: "^2.3.4"
119
+ }
120
+ };
121
+
36
122
  // node_modules/@hey-api/client-fetch/dist/index.js
37
123
  var U = /\{[^{}]+\}/g;
38
124
  var S = ({ allowReserved: t, name: r, value: e }) => {
@@ -2777,15 +2863,14 @@ var Zernio = class {
2777
2863
  this.baseURL = options.baseURL ?? "https://zernio.com/api";
2778
2864
  this._options = options;
2779
2865
  client.setConfig({
2780
- baseUrl: this.baseURL
2866
+ baseUrl: this.baseURL,
2867
+ headers: {
2868
+ "User-Agent": `zernio-node/${package_default.version}`,
2869
+ ...options.defaultHeaders ?? {}
2870
+ }
2781
2871
  });
2782
2872
  client.interceptors.request.use((request) => {
2783
2873
  request.headers.set("Authorization", `Bearer ${this.apiKey}`);
2784
- if (options.defaultHeaders) {
2785
- for (const [key, value] of Object.entries(options.defaultHeaders)) {
2786
- request.headers.set(key, value);
2787
- }
2788
- }
2789
2874
  return request;
2790
2875
  });
2791
2876
  client.interceptors.response.use(async (response) => {
package/dist/index.mjs CHANGED
@@ -2,6 +2,92 @@ var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
4
 
5
+ // package.json
6
+ var package_default = {
7
+ name: "@zernio/node",
8
+ version: "0.2.172",
9
+ description: "The official Node.js library for the Zernio API",
10
+ main: "dist/index.js",
11
+ module: "dist/index.mjs",
12
+ types: "dist/index.d.ts",
13
+ sideEffects: false,
14
+ exports: {
15
+ ".": {
16
+ types: "./dist/index.d.ts",
17
+ import: "./dist/index.mjs",
18
+ require: "./dist/index.js"
19
+ },
20
+ "./_shims/*": {
21
+ types: "./dist/_shims/*.d.ts",
22
+ import: "./dist/_shims/*.mjs",
23
+ require: "./dist/_shims/*.js"
24
+ }
25
+ },
26
+ files: [
27
+ "dist",
28
+ "src",
29
+ "README.md",
30
+ "LICENSE"
31
+ ],
32
+ scripts: {
33
+ generate: "openapi-ts -i openapi.yaml -o src/generated -c @hey-api/client-fetch && npm run generate:client",
34
+ "generate:client": "npx tsx scripts/generate-client.ts",
35
+ build: "tsup src/index.ts --format cjs,esm --dts --clean",
36
+ dev: "tsup src/index.ts --format cjs,esm --dts --watch",
37
+ lint: "eslint src",
38
+ typecheck: "tsc --noEmit",
39
+ test: "vitest run",
40
+ "test:watch": "vitest",
41
+ prepublishOnly: "npm run build",
42
+ "fetch-spec": "curl -o openapi.yaml https://zernio.com/openapi.yaml"
43
+ },
44
+ keywords: [
45
+ "zernio",
46
+ "social-media",
47
+ "scheduling",
48
+ "api",
49
+ "sdk",
50
+ "instagram",
51
+ "tiktok",
52
+ "youtube",
53
+ "linkedin",
54
+ "twitter",
55
+ "x",
56
+ "facebook",
57
+ "pinterest",
58
+ "threads",
59
+ "bluesky",
60
+ "snapchat",
61
+ "telegram"
62
+ ],
63
+ author: "Zernio <support@zernio.com>",
64
+ license: "Apache-2.0",
65
+ repository: {
66
+ type: "git",
67
+ url: "git+https://github.com/zernio-dev/zernio-node.git"
68
+ },
69
+ homepage: "https://zernio.com/docs/api",
70
+ bugs: {
71
+ url: "https://github.com/zernio-dev/zernio-node/issues"
72
+ },
73
+ engines: {
74
+ node: ">=18"
75
+ },
76
+ devDependencies: {
77
+ "@hey-api/client-fetch": "^0.6.0",
78
+ "@hey-api/openapi-ts": "^0.61.0",
79
+ "@types/node": "^20.11.0",
80
+ "@typescript-eslint/eslint-plugin": "^7.18.0",
81
+ "@typescript-eslint/parser": "^7.18.0",
82
+ eslint: "^8.56.0",
83
+ tsup: "^8.0.1",
84
+ tsx: "^4.7.0",
85
+ typescript: "^5.3.3",
86
+ vitest: "^1.2.0",
87
+ yaml: "^2.3.4"
88
+ }
89
+ };
90
+
5
91
  // node_modules/@hey-api/client-fetch/dist/index.js
6
92
  var U = /\{[^{}]+\}/g;
7
93
  var S = ({ allowReserved: t, name: r, value: e }) => {
@@ -2746,15 +2832,14 @@ var Zernio = class {
2746
2832
  this.baseURL = options.baseURL ?? "https://zernio.com/api";
2747
2833
  this._options = options;
2748
2834
  client.setConfig({
2749
- baseUrl: this.baseURL
2835
+ baseUrl: this.baseURL,
2836
+ headers: {
2837
+ "User-Agent": `zernio-node/${package_default.version}`,
2838
+ ...options.defaultHeaders ?? {}
2839
+ }
2750
2840
  });
2751
2841
  client.interceptors.request.use((request) => {
2752
2842
  request.headers.set("Authorization", `Bearer ${this.apiKey}`);
2753
- if (options.defaultHeaders) {
2754
- for (const [key, value] of Object.entries(options.defaultHeaders)) {
2755
- request.headers.set(key, value);
2756
- }
2757
- }
2758
2843
  return request;
2759
2844
  });
2760
2845
  client.interceptors.response.use(async (response) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zernio/node",
3
- "version": "0.2.170",
3
+ "version": "0.2.172",
4
4
  "description": "The official Node.js library for the Zernio API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
package/src/client.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import packageJson from '../package.json';
1
2
  import {
2
3
  client,
3
4
  activateSequence,
@@ -965,19 +966,21 @@ export class Zernio {
965
966
  this.baseURL = options.baseURL ?? 'https://zernio.com/api';
966
967
  this._options = options;
967
968
 
968
- // Configure the generated client
969
+ // Configure the generated client. User-Agent and defaultHeaders are
970
+ // applied at config time (not via the interceptor) because Node 20's
971
+ // undici treats User-Agent as a forbidden header on already-constructed
972
+ // Request objects, silently dropping `headers.set('User-Agent', …)`.
969
973
  client.setConfig({
970
974
  baseUrl: this.baseURL,
975
+ headers: {
976
+ 'User-Agent': `zernio-node/${packageJson.version}`,
977
+ ...(options.defaultHeaders ?? {}),
978
+ },
971
979
  });
972
980
 
973
981
  // Add auth interceptor
974
982
  client.interceptors.request.use((request) => {
975
983
  request.headers.set('Authorization', `Bearer ${this.apiKey}`);
976
- if (options.defaultHeaders) {
977
- for (const [key, value] of Object.entries(options.defaultHeaders)) {
978
- request.headers.set(key, value);
979
- }
980
- }
981
984
  return request;
982
985
  });
983
986
 
@@ -1932,9 +1932,9 @@ export const listInboxConversations = <ThrowOnError extends boolean = false>(opt
1932
1932
  * Create conversation
1933
1933
  * Initiate a new direct message conversation with a specified user. If a conversation already exists with the recipient, the message is added to the existing thread.
1934
1934
  *
1935
- * Currently supported platforms: Twitter/X only. Other platforms will return PLATFORM_NOT_SUPPORTED.
1935
+ * Supported platforms: X/Twitter, Bluesky, Reddit, and WhatsApp. Other platforms return PLATFORM_NOT_SUPPORTED. For WhatsApp, a conversation can only be started with an approved template (provide templateName, templateLanguage, and any templateParams) — freeform initial messages are not permitted by WhatsApp; a missing template returns TEMPLATE_REQUIRED.
1936
1936
  *
1937
- * DM eligibility: Before sending, the endpoint checks if the recipient accepts DMs from your account (via the receives_your_dm field). If not, a 422 error with code DM_NOT_ALLOWED is returned. You can skip this check with skipDmCheck: true if you have already verified eligibility.
1937
+ * DM eligibility (X/Twitter): Before sending, the endpoint checks if the recipient accepts DMs from your account (via the receives_your_dm field). If not, a 422 error with code DM_NOT_ALLOWED is returned. You can skip this check with skipDmCheck: true if you have already verified eligibility.
1938
1938
  *
1939
1939
  * X API tier requirement: DM write endpoints require X API Pro tier ($5,000/month) or Enterprise access. This applies to BYOK (Bring Your Own Key) users who provide their own X API credentials.
1940
1940
  *
@@ -2236,6 +2236,14 @@ export type PostAnalytics = {
2236
2236
  saves?: number;
2237
2237
  clicks?: number;
2238
2238
  views?: number;
2239
+ /**
2240
+ * Instagram Reels only: average watch time per play, in milliseconds. 0 for non-Reels media and other platforms.
2241
+ */
2242
+ igReelsAvgWatchTime?: number;
2243
+ /**
2244
+ * Instagram Reels only: total watch time including replays, in milliseconds. 0 for non-Reels media and other platforms.
2245
+ */
2246
+ igReelsVideoViewTotalTime?: number;
2239
2247
  engagementRate?: number;
2240
2248
  lastUpdated?: string;
2241
2249
  };
@@ -10537,21 +10545,33 @@ export type CreateInboxConversationData = {
10537
10545
  */
10538
10546
  accountId: string;
10539
10547
  /**
10540
- * Twitter numeric user ID of the recipient. Provide either this or participantUsername.
10548
+ * Recipient identifier. For X this is the numeric user ID; for WhatsApp, the recipient phone number in international format (digits, country code included). Provide either this or participantUsername.
10541
10549
  */
10542
10550
  participantId?: string;
10543
10551
  /**
10544
- * Twitter username (with or without @) of the recipient. Resolved to a user ID via lookup. Provide either this or participantId.
10552
+ * Recipient handle/username — an X or Bluesky handle (with or without @) or a Reddit username (with or without u/). Resolved via lookup. Provide either this or participantId.
10545
10553
  */
10546
10554
  participantUsername?: string;
10547
10555
  /**
10548
- * Text content of the message. At least one of message or attachment is required.
10556
+ * Text content of the message. At least one of message, attachment, or (for WhatsApp) templateName is required.
10549
10557
  */
10550
10558
  message?: string;
10551
10559
  /**
10552
- * Skip the receives_your_dm eligibility check before sending. Use if you have already verified the recipient accepts DMs.
10560
+ * X/Twitter only. Skip the receives_your_dm eligibility check before sending. Use if you have already verified the recipient accepts DMs.
10553
10561
  */
10554
10562
  skipDmCheck?: boolean;
10563
+ /**
10564
+ * WhatsApp only. Name of the approved template to start the conversation with (required for WhatsApp).
10565
+ */
10566
+ templateName?: string;
10567
+ /**
10568
+ * WhatsApp only. Template language code (e.g. en_US).
10569
+ */
10570
+ templateLanguage?: string;
10571
+ /**
10572
+ * WhatsApp only. Body variable values, in order, substituted into the template body ({{1}}, {{2}}, ...).
10573
+ */
10574
+ templateParams?: Array<(string)>;
10555
10575
  };
10556
10576
  };
10557
10577