nixflex 0.8.0 → 0.11.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/B57-DELETES.md +52 -0
- package/CALL-REQUESTS.md +73 -0
- package/CHANGELOG.md +204 -84
- package/KIT-EXAMPLES-K6.md +118 -0
- package/KIT-EXAMPLES-K7.md +104 -0
- package/KNOWLEDGE.md +61 -0
- package/LICENSE +21 -21
- package/METHODS.md +176 -0
- package/NUMBER-FEATURES.md +51 -0
- package/ORGANISATIONS.md +9 -0
- package/README.md +56 -117
- package/TEAM-INTEGRATIONS.md +69 -0
- package/THIRD-PARTY-NOTICES.md +26 -0
- package/dist/cli/index.js +3901 -371
- package/dist/index.cjs +1255 -174
- package/dist/index.d.cts +2031 -322
- package/dist/index.d.ts +2031 -322
- package/dist/index.js +1233 -171
- package/package.json +72 -60
package/README.md
CHANGED
|
@@ -1,117 +1,56 @@
|
|
|
1
|
-
# Nixflex Node.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
try {
|
|
59
|
-
await client.calls.create({ ... });
|
|
60
|
-
} catch (e) {
|
|
61
|
-
if (e instanceof NixflexRateLimitError) {
|
|
62
|
-
console.log(`Rate limited — retry in ${e.retryAfterSeconds}s`);
|
|
63
|
-
} else if (e instanceof NixflexPaymentRequiredError) {
|
|
64
|
-
console.log('Top up your balance');
|
|
65
|
-
}
|
|
66
|
-
// Every error carries: status, code, type, message, docUrl, details, requestId
|
|
67
|
-
}
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
## Built in
|
|
71
|
-
|
|
72
|
-
- **Automatic retries** — 429s retried honouring `Retry-After`; network failures retried; POST never blind-retries a 5xx (no double dials)
|
|
73
|
-
- **Pagination iterators** — `for await (const call of client.calls.iter()) { ... }`
|
|
74
|
-
- **TypeScript types for every request and response** — generated from the [API docs](https://docs.nixflex.com)
|
|
75
|
-
- **Timeouts + AbortSignal support** per client or per request
|
|
76
|
-
- **Zero runtime dependencies** — native fetch, Node 18+
|
|
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
|
-
|
|
113
|
-
## Docs
|
|
114
|
-
|
|
115
|
-
Full API reference: **https://docs.nixflex.com**
|
|
116
|
-
|
|
117
|
-
Release history: [CHANGELOG.md](CHANGELOG.md). Licensed under [MIT](LICENSE).
|
|
1
|
+
# Nixflex Node SDK and CLI — 0.11.0 candidate
|
|
2
|
+
|
|
3
|
+
B57 deletion and voice campaign delete: see [B57-DELETES.md](B57-DELETES.md). K9 is an unpublished candidate; one DELETE, never an automatic retry.
|
|
4
|
+
|
|
5
|
+
Node 18+ for SDK/CLI, Node 22+ for MCP setup. SDK uses native fetch; CLI parser is bundled with its notices.
|
|
6
|
+
|
|
7
|
+
~~~js
|
|
8
|
+
import Nixflex from 'nixflex';
|
|
9
|
+
const client = new Nixflex({apiKey:process.env.NIXFLEX_API_KEY});
|
|
10
|
+
const agents = await client.agents.list({limit:1});
|
|
11
|
+
// Do not print private responses or credentials.
|
|
12
|
+
~~~
|
|
13
|
+
|
|
14
|
+
Install the approved release using npm install nixflex; local tests use the tarball. CLI: nixflex --help. Set NIXFLEX_API_KEY privately; --base-url explicitly selects staging. --json returns machine-readable results. New K1–K6 CLI writes need --confirm; older commands retain their documented behaviour.
|
|
15
|
+
|
|
16
|
+
## MCP setup
|
|
17
|
+
|
|
18
|
+
Automatic config writers: Claude Desktop and Cursor. Claude Code/Codex use shared builders/manual configuration; VS Code setup is retired. Test unpublished MCP with nixflex mcp setup claude|cursor --mcp-local DIRECTORY.
|
|
19
|
+
|
|
20
|
+
Normal npm-mode setup writes a launcher pinned to nixflex-mcp@0.5.0. Publish MCP and verify the registry version BEFORE publishing Node; this candidate does not publish or download anything during setup. No key goes into client config. Provide key and explicit API URL through the client's environment. Legacy credential files are plaintext, not an OS vault. OS-vault setup and human Windows/Mac validation remain separate work.
|
|
21
|
+
|
|
22
|
+
Malformed/unreadable config is refused; unrelated entries/comments survive. Replacement needs confirmation. Avoid concurrent config editors/installers.
|
|
23
|
+
|
|
24
|
+
## Contract and safety
|
|
25
|
+
|
|
26
|
+
K1–K5 cover 140 of 141 public inventory operations in Node/CLI/Python. Private signing-secret retrieval is deliberately excluded. Dedicated Knowledge keyterms is additional to the old denominator. Personal login, invite acceptance, ownership transfer and account closure remain dashboard-only.
|
|
27
|
+
|
|
28
|
+
Only GET has bounded retries (default one). POST/PUT/PATCH/DELETE never automatically repeat, including 429, lost replies or malformed success. NixflexOutcomeUnknownError means outcome unknown and safe_to_retry false: inspect authoritative state before retrying. Never log raw errors, customer content, recordings, credentials or private integration responses.
|
|
29
|
+
|
|
30
|
+
Ownership, roles and active-account rules remain authoritative, along with refusals actually returned by each route. B57 single-call and campaign deletion ends running calls instead of waiting for settlement; other guarded cleanup routes keep their existing safety rules. Accepted deletion is not proof cleanup finished. API keys act with Owner authority and cannot impersonate a personal member session.
|
|
31
|
+
|
|
32
|
+
Omitted fields stay omitted. Agent defaults are dynamic greeting true, maximum duration 300 seconds, silence hangup 10 seconds; existing agents are not rewritten. Single-call variables use dynamic_vars; variables is a non-conflicting alias. Campaign recipient variables stay unchanged. SMS requires a sender; campaign message_template and scheduled_date are canonical.
|
|
33
|
+
|
|
34
|
+
Preserve page filters/string cursors; stop at next_cursor:null. Call iterators use pages 1–200; offset paging is not a snapshot. Integration PUT replaces configuration; custom-function PATCH changes supplied fields.
|
|
35
|
+
|
|
36
|
+
Webhook verification uses the organisation signing secret, independent of key rotation. Obtain it privately outside kits; verify the raw body before trusting a delivery.
|
|
37
|
+
|
|
38
|
+
## Method reference
|
|
39
|
+
|
|
40
|
+
See [METHODS.md](METHODS.md), [KNOWLEDGE.md](KNOWLEDGE.md), [TEAM-INTEGRATIONS.md](TEAM-INTEGRATIONS.md), [ORGANISATIONS.md](ORGANISATIONS.md) and [CHANGELOG.md](CHANGELOG.md). Full API reference: https://docs.nixflex.com.
|
|
41
|
+
|
|
42
|
+
Unpublished candidates. Offline coverage does not prove successful mutations on staging; those tests remain manual.
|
|
43
|
+
|
|
44
|
+
## Caller read: missing record versus wrong number
|
|
45
|
+
|
|
46
|
+
GET /v1/phone-numbers/:phoneNumber/callers/:callerNumber returns HTTP 404 with code caller_not_found when the owned number has no saved record for that caller. HTTP 404 phone_number_not_found means the business number is missing or is not owned by this account; do not treat it as an empty caller record. Generic not_found is not the documented caller-absence response.
|
|
47
|
+
|
|
48
|
+
Node and Python raise NixflexNotFoundError with status=404 and the exact server code. CLI --json exits 1 and preserves error.status and error.code (it does not serialize a JavaScript exception class). Inspect the code; never swallow all 404s. The K5b staging checker passes its synthetic-caller absence check only for 404 caller_not_found and selects that probe's business number from the authenticated account list, excluding the two protected staging numbers. With no eligible number it reports PENDING and sends no caller request. Never log the key, headers or raw response body.
|
|
49
|
+
|
|
50
|
+
## K6 additions
|
|
51
|
+
|
|
52
|
+
Four Google Calendar methods, private number credentials, SMS 409 handling and booking models. Read [NUMBER-FEATURES.md](NUMBER-FEATURES.md) for exact fields, safe errors and recovery. All earlier exclusions remain, except the two explicit K6 MCP additions noted there.
|
|
53
|
+
|
|
54
|
+
## K7 additions
|
|
55
|
+
|
|
56
|
+
Read a call’s retained booking result and its saved outbound request. Optional UUID request_id adds duplicate protection without automatic redial. Prepare and save the ID before the first send. See [CALL-REQUESTS.md](CALL-REQUESTS.md) for every state/error and [KIT-EXAMPLES-K7.md](KIT-EXAMPLES-K7.md) for Node, CLI, Python sync/async and MCP examples. Existing no-ID calls keep their old behavior.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Organisation and integration settings
|
|
2
|
+
|
|
3
|
+
Use the account API key privately. It has Owner authority. These kits do not
|
|
4
|
+
accept a teammate's dashboard session or impersonate a role.
|
|
5
|
+
|
|
6
|
+
| Kit | Entry point |
|
|
7
|
+
| --- | --- |
|
|
8
|
+
| Node | client.organisation, client.integrations |
|
|
9
|
+
| CLI | nixflex organisation, nixflex integrations |
|
|
10
|
+
| Python sync/async | client.organisation, client.integrations |
|
|
11
|
+
| MCP | See KITS-COVERAGE.md for included tools and deliberate exceptions |
|
|
12
|
+
|
|
13
|
+
Organisation reads: get, members, activity. JSON activity accepts before, actor,
|
|
14
|
+
from, to; Python spells from as from_. Dates are inclusive UTC calendar dates,
|
|
15
|
+
clamped to retained history. IDs and next_cursor are strings; never parse them as
|
|
16
|
+
floating-point numbers. Continue JSON pages with next_cursor as before until null.
|
|
17
|
+
|
|
18
|
+
Node activityCsv and Python activity_csv stream CSV bytes. Python async usage is
|
|
19
|
+
async for, not await. The server reads 500 rows per database chunk and rechecks
|
|
20
|
+
authority each chunk. Closing/stopping early must close/aclose the iterator.
|
|
21
|
+
Discard partial output after any error. Streaming never automatically restarts
|
|
22
|
+
after yielding data. The CLI activityCsv --output FILE publishes the file only
|
|
23
|
+
after completion and never overwrites an existing file.
|
|
24
|
+
|
|
25
|
+
Organisation changes: invite, claimInvite/claim_invite, resend, revoke,
|
|
26
|
+
removeMember/remove_member, setRole/set_role, rename. Personal acceptance, leave,
|
|
27
|
+
ownership transfer and closure stay dashboard only. A sent invitation means
|
|
28
|
+
provider acceptance, not delivery to the inbox. A resent invite replaces the old
|
|
29
|
+
link. A membership 202/live_disconnect_pending means the change committed but
|
|
30
|
+
live disconnection is unconfirmed; do not repeat the membership change blindly.
|
|
31
|
+
|
|
32
|
+
Personal dashboard rules still apply there: Members cannot manage team/settings;
|
|
33
|
+
Admins have permitted Member-management/settings rights but cannot manage Admins,
|
|
34
|
+
rename the organisation, access keys, transfer ownership or close the account.
|
|
35
|
+
The API key is Owner authority, so these kits cannot test personal Admin/Member
|
|
36
|
+
access. Server refusals remain typed errors.
|
|
37
|
+
|
|
38
|
+
Integration get/set/delete supports only calcom, slack, zapier, make, gohighlevel,
|
|
39
|
+
webhook, webhook2, precall, web-calls. Use getAgentPrecall/setAgentPrecall/
|
|
40
|
+
deleteAgentPrecall (snake_case in Python) for the agent default. Number pre-call
|
|
41
|
+
overrides the default; removing the override can expose the default again.
|
|
42
|
+
|
|
43
|
+
Provider PUT replaces stored configuration. Supply required credentials privately;
|
|
44
|
+
omitted options reset to documented server defaults. Optional agent_id is only a
|
|
45
|
+
fallback when the number has no assigned agent; it does not move the number.
|
|
46
|
+
Web-call reads return the saved flag, not proof of effective availability.
|
|
47
|
+
|
|
48
|
+
Functions use listFunctions/createFunction/updateFunction/deleteFunction
|
|
49
|
+
(snake_case in Python). At most 15 per number; names are lowercase snake_case,
|
|
50
|
+
maximum 64 characters; default method POST. timeout_ms defaults to 5000 and is
|
|
51
|
+
clamped server-side to 1000..45000. PATCH only changes supplied fields; null
|
|
52
|
+
speak_during clears it; an empty PATCH is refused. Reads expose has_headers,
|
|
53
|
+
never the header values. Empty lists and successful no-op deletes are not proof
|
|
54
|
+
of ownership or previous existence.
|
|
55
|
+
|
|
56
|
+
SDKs return exact wire data without logging it. URLs can contain credentials:
|
|
57
|
+
never print full integration responses. Use private body files/environment input.
|
|
58
|
+
CLI display omits URLs, credential fields and free-form configuration, including
|
|
59
|
+
webhook get/delete previews. Signing-secret retrieval is a private human action,
|
|
60
|
+
not a kit method. Do not paste credential settings into an AI conversation.
|
|
61
|
+
|
|
62
|
+
Every NEW CLI/MCP write needs explicit confirmation before any HTTP request.
|
|
63
|
+
SDK writes are explicit method calls. Only GET may retry, with a bounded budget.
|
|
64
|
+
Unknown write outcomes stay outcome_unknown / safe_to_retry:false: read current
|
|
65
|
+
state before deciding whether to retry manually.
|
|
66
|
+
|
|
67
|
+
K4-TEST.ps1 is read-only and uses built packages. It refuses every mutation at its
|
|
68
|
+
transport boundary. Successful writes require a separately authorised manual test
|
|
69
|
+
on disposable resources; never use the protected production/testing numbers.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Bundled CLI dependency
|
|
2
|
+
|
|
3
|
+
The MCP configuration editor in the CLI bundles jsonc-parser 3.3.1.
|
|
4
|
+
The SDK library does not acquire a runtime dependency from this installer work.
|
|
5
|
+
|
|
6
|
+
The MIT License (MIT)
|
|
7
|
+
|
|
8
|
+
Copyright (c) Microsoft
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|