nixflex 0.2.0 → 0.2.2

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/CHANGELOG.md ADDED
@@ -0,0 +1,51 @@
1
+ # Changelog
2
+
3
+ All notable changes to the `nixflex` package. This project follows
4
+ [semantic versioning](https://semver.org): patch for fixes, minor for new
5
+ features, major for breaking changes. Published methods are never removed or
6
+ renamed within a major version.
7
+
8
+ ## 0.2.2
9
+
10
+ - Corrected the SMS campaign documentation: rom_number may be on either carrier
11
+ (Twilio or Telnyx). An earlier docs page wrongly stated Telnyx was rejected at
12
+ create; the engine routes by provider. No code behaviour changed.
13
+
14
+ ## 0.2.1
15
+
16
+ - Added MIT `LICENSE`, this changelog, and repository/homepage/issue metadata
17
+ so the npm page links back to the source and docs.
18
+ - Documented `verifyWebhookSignature` in the README.
19
+ - Continuous integration now builds and runs the test suite on every push.
20
+ - No API changes.
21
+
22
+ ## 0.2.0
23
+
24
+ - **Added** `verifyWebhookSignature(rawBody, signatureHeader, keySecret)` and
25
+ `client.webhooks.verify(...)` - verifies the `X-Nixflex-Signature` header
26
+ (HMAC-SHA256 over `"<timestamp>.<body>"`) with a constant-time comparison and
27
+ a configurable replay window (5 minutes by default). Never throws.
28
+ - **Added** `client.calls.delete(callId)` - permanently erases one call record,
29
+ transcript, and recording file.
30
+ - **Added** `client.calls.deleteAll()` - erases all calls, recordings, and SMS
31
+ messages on the key.
32
+ - Added `@types/node` as a development dependency (required for `Buffer` and
33
+ `node:crypto` types in the generated declarations).
34
+
35
+ ## 0.1.0
36
+
37
+ First public release.
38
+
39
+ - `agents` - create, list, get, update, delete, `iter()`
40
+ - `calls` - create outbound, list, get, `iter()`
41
+ - `campaigns` - create and launch voice batch campaigns
42
+ - `phoneNumbers` - import, list, update, delete, monitor and web-call toggles
43
+ - `sms` - single sends and bulk campaigns
44
+ - `keys` - rotate the API secret
45
+ - `usage` - account usage and limits
46
+ - `webhooks` - per-number webhook configuration
47
+ - Typed errors per HTTP status, automatic retry on `429` honouring
48
+ `Retry-After`, retries on network failure, and no blind retry of `POST`
49
+ requests after a `5xx` (a call is never dialled twice).
50
+ - Dual ESM and CommonJS builds, TypeScript declarations, zero runtime
51
+ dependencies, Node 18 or newer.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Nixflex
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -75,6 +75,43 @@ try {
75
75
  - **Timeouts + AbortSignal support** per client or per request
76
76
  - **Zero runtime dependencies** — native fetch, Node 18+
77
77
 
78
+ ## Verifying webhooks
79
+
80
+ Nixflex signs every webhook delivery with an `X-Nixflex-Signature` header. Verify it before trusting a payload — pass the **raw** request body, not a re-serialized object:
81
+
82
+ ```js
83
+ import express from 'express';
84
+ import { verifyWebhookSignature } from 'nixflex';
85
+
86
+ const app = express();
87
+
88
+ app.post('/nixflex/calls', express.raw({ type: 'application/json' }), (req, res) => {
89
+ const ok = verifyWebhookSignature(
90
+ req.body, // raw Buffer
91
+ req.get('x-nixflex-signature'),
92
+ process.env.NIXFLEX_KEY_SECRET // the nxfs_... half of your key
93
+ );
94
+ if (!ok) return res.sendStatus(400);
95
+
96
+ const event = JSON.parse(req.body.toString('utf8'));
97
+ // handle event.event === 'call.completed'
98
+ res.sendStatus(200);
99
+ });
100
+ ```
101
+
102
+ Returns `false` for a tampered body, wrong secret, malformed header, or a signature older than the tolerance window (300 seconds; override with `{ toleranceSeconds }`). It never throws.
103
+
104
+ ## Deleting call data
105
+
106
+ ```js
107
+ await client.calls.delete(callId); // one call: record, transcript, recording
108
+ await client.calls.deleteAll(); // everything on the key
109
+ ```
110
+
111
+ Both are immediate and irreversible — fetch anything you need to keep first.
112
+
78
113
  ## Docs
79
114
 
80
115
  Full API reference: **https://docs.nixflex.com**
116
+
117
+ Release history: [CHANGELOG.md](CHANGELOG.md). Licensed under [MIT](LICENSE).
package/dist/index.cjs CHANGED
@@ -403,8 +403,8 @@ var SmsCampaigns = class {
403
403
  }
404
404
  http;
405
405
  /** Create a one-time SMS broadcast ({{variable}} templating per recipient,
406
- * up to 10,000 recipients). Requires a TWILIO from_number - Telnyx numbers
407
- * are rejected at create (single sends support both carriers). */
406
+ * up to 10,000 recipients). from_number may be on either carrier (Twilio or
407
+ * Telnyx) and must be a number on your own account. */
408
408
  create(params, opts) {
409
409
  return this.http.request("POST", "/sms/campaigns", params, void 0, opts);
410
410
  }
package/dist/index.d.cts CHANGED
@@ -452,8 +452,11 @@ interface SmsCampaignRecipient {
452
452
  /** Fills {{placeholders}} in the template. Missing variables render as empty strings. */
453
453
  variables?: Record<string, string>;
454
454
  }
455
- /** SMS campaigns currently require a TWILIO from_number - Telnyx numbers are
456
- * rejected at create (single sends via sms.send work on both carriers). */
455
+ /** from_number may be on EITHER carrier (Twilio or Telnyx) - the campaign
456
+ * sends using that number's own credentials, so it must be a number on your
457
+ * account. (An earlier doc page wrongly said Telnyx was rejected at create;
458
+ * the engine routes by provider and has done since the Twilio-only lookup
459
+ * was removed.) */
457
460
  interface SmsCampaignCreateParams {
458
461
  agent_id: string;
459
462
  /** Your imported TWILIO number. */
@@ -589,8 +592,8 @@ declare class SmsCampaigns {
589
592
  private readonly http;
590
593
  constructor(http: HttpClient);
591
594
  /** Create a one-time SMS broadcast ({{variable}} templating per recipient,
592
- * up to 10,000 recipients). Requires a TWILIO from_number - Telnyx numbers
593
- * are rejected at create (single sends support both carriers). */
595
+ * up to 10,000 recipients). from_number may be on either carrier (Twilio or
596
+ * Telnyx) and must be a number on your own account. */
594
597
  create(params: SmsCampaignCreateParams, opts?: RequestOptions): Promise<SmsCampaign>;
595
598
  /** Launch a draft/scheduled campaign immediately. */
596
599
  launch(campaignId: string, opts?: RequestOptions): Promise<SmsCampaignLaunchResponse>;
package/dist/index.d.ts CHANGED
@@ -452,8 +452,11 @@ interface SmsCampaignRecipient {
452
452
  /** Fills {{placeholders}} in the template. Missing variables render as empty strings. */
453
453
  variables?: Record<string, string>;
454
454
  }
455
- /** SMS campaigns currently require a TWILIO from_number - Telnyx numbers are
456
- * rejected at create (single sends via sms.send work on both carriers). */
455
+ /** from_number may be on EITHER carrier (Twilio or Telnyx) - the campaign
456
+ * sends using that number's own credentials, so it must be a number on your
457
+ * account. (An earlier doc page wrongly said Telnyx was rejected at create;
458
+ * the engine routes by provider and has done since the Twilio-only lookup
459
+ * was removed.) */
457
460
  interface SmsCampaignCreateParams {
458
461
  agent_id: string;
459
462
  /** Your imported TWILIO number. */
@@ -589,8 +592,8 @@ declare class SmsCampaigns {
589
592
  private readonly http;
590
593
  constructor(http: HttpClient);
591
594
  /** Create a one-time SMS broadcast ({{variable}} templating per recipient,
592
- * up to 10,000 recipients). Requires a TWILIO from_number - Telnyx numbers
593
- * are rejected at create (single sends support both carriers). */
595
+ * up to 10,000 recipients). from_number may be on either carrier (Twilio or
596
+ * Telnyx) and must be a number on your own account. */
594
597
  create(params: SmsCampaignCreateParams, opts?: RequestOptions): Promise<SmsCampaign>;
595
598
  /** Launch a draft/scheduled campaign immediately. */
596
599
  launch(campaignId: string, opts?: RequestOptions): Promise<SmsCampaignLaunchResponse>;
package/dist/index.js CHANGED
@@ -367,8 +367,8 @@ var SmsCampaigns = class {
367
367
  }
368
368
  http;
369
369
  /** Create a one-time SMS broadcast ({{variable}} templating per recipient,
370
- * up to 10,000 recipients). Requires a TWILIO from_number - Telnyx numbers
371
- * are rejected at create (single sends support both carriers). */
370
+ * up to 10,000 recipients). from_number may be on either carrier (Twilio or
371
+ * Telnyx) and must be a number on your own account. */
372
372
  create(params, opts) {
373
373
  return this.http.request("POST", "/sms/campaigns", params, void 0, opts);
374
374
  }
package/package.json CHANGED
@@ -1,17 +1,22 @@
1
1
  {
2
2
  "name": "nixflex",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Official Node.js SDK for the Nixflex voice AI platform - AI phone agents, outbound campaigns, and SMS.",
5
5
  "keywords": [
6
6
  "nixflex",
7
- "voice ai",
8
- "ai phone agent",
7
+ "voice-ai",
8
+ "voice-agent",
9
+ "phone",
9
10
  "telephony",
11
+ "ai-receptionist",
12
+ "twilio",
13
+ "telnyx",
10
14
  "sms",
11
- "voice agent",
12
- "ai calls"
15
+ "speech",
16
+ "api-client",
17
+ "sdk"
13
18
  ],
14
- "homepage": "https://docs.nixflex.com",
19
+ "homepage": "https://github.com/nixflex/nixflex-node#readme",
15
20
  "bugs": {
16
21
  "url": "https://github.com/nixflex/nixflex-node/issues"
17
22
  },
@@ -34,7 +39,8 @@
34
39
  "files": [
35
40
  "dist",
36
41
  "README.md",
37
- "LICENSE"
42
+ "LICENSE",
43
+ "CHANGELOG.md"
38
44
  ],
39
45
  "engines": {
40
46
  "node": ">=18"
@@ -48,5 +54,6 @@
48
54
  "@types/node": "^26.2.0",
49
55
  "tsup": "^8.0.0",
50
56
  "typescript": "^5.4.0"
51
- }
57
+ },
58
+ "author": "Nixflex"
52
59
  }