nixflex 0.9.0 → 0.11.1
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 +208 -84
- package/KIT-EXAMPLES-K6.md +118 -0
- package/KIT-EXAMPLES-K7.md +104 -0
- package/KNOWLEDGE.md +61 -0
- package/METHODS.md +176 -0
- package/NUMBER-FEATURES.md +51 -0
- package/ORGANISATIONS.md +9 -0
- package/README.md +57 -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 +2025 -322
- package/dist/index.d.ts +2025 -322
- package/dist/index.js +1233 -171
- package/package.json +72 -60
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# K7 examples (unpublished candidates)
|
|
2
|
+
|
|
3
|
+
Set credentials privately outside code. Every example explicitly supplies a base URL; do not copy a production URL into a test. Preparation is local. Save the account and base-URL association with the intent; reuse that same environment and account when reconciling or retrying. Running create places a paid call: execute that line only for a human-approved call, never as an automatic retry.
|
|
4
|
+
|
|
5
|
+
## Node
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
import Nixflex, {prepareOutboundCall, NixflexOutboundRequestError} from 'nixflex';
|
|
9
|
+
import {writeFileSync, readFileSync} from 'node:fs';
|
|
10
|
+
const client = new Nixflex({apiKey:process.env.NIXFLEX_API_KEY,
|
|
11
|
+
baseUrl:process.env.NIXFLEX_BASE_URL, maxRetries:0});
|
|
12
|
+
// Step 1, once per NEW intent. Application must keep this private file/account binding.
|
|
13
|
+
const prepared = prepareOutboundCall({agent_id:'YOUR_AGENT',
|
|
14
|
+
to_number:'+12025550100', from_number:'+12025550101', prompt:'Your approved call purpose'});
|
|
15
|
+
writeFileSync('prepared-call.json', JSON.stringify(prepared), {encoding:'utf8', flag:'wx', mode:0o600});
|
|
16
|
+
// Step 2, only after human authorization; never wrap this in an automatic retry loop.
|
|
17
|
+
const saved = JSON.parse(readFileSync('prepared-call.json','utf8'));
|
|
18
|
+
try {
|
|
19
|
+
const receipt = await client.calls.create(saved);
|
|
20
|
+
// Persist receipt.call_id, including if request_status is unconfirmed. Do not redial.
|
|
21
|
+
} catch (error) {
|
|
22
|
+
if (!(error instanceof NixflexOutboundRequestError)) throw error;
|
|
23
|
+
// Display only error.status/error.code/error.details.request_id, then reconcile.
|
|
24
|
+
}
|
|
25
|
+
// Read separately, without creating any call:
|
|
26
|
+
const request = await client.calls.outboundRequest(saved.request_id);
|
|
27
|
+
if (request.state === 'accepted' && request.call_id) {
|
|
28
|
+
const bookings = await client.calls.bookings(request.call_id);
|
|
29
|
+
if (bookings.state === 'ready') { /* Use timeline/final as returned. */ }
|
|
30
|
+
else if (bookings.state === 'none') { /* Proven no successful booking changes. */ }
|
|
31
|
+
else { /* Keep processing/deleted/unavailable distinct. */ }
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
For a retry decision, load the existing file; do not execute Step 1 again. SDK typed request_id callers receive OutboundRequestReceipt (to/from optional); a no-ID create retains OutboundCallResponse typing.
|
|
36
|
+
|
|
37
|
+
## CLI (PowerShell 5.1 and 7)
|
|
38
|
+
|
|
39
|
+
```powershell
|
|
40
|
+
# Put agent_id/to_number/from_number/prompt in a private UTF-8 intent.json.
|
|
41
|
+
# Local only; fails if prepared-call.json already exists. No key required.
|
|
42
|
+
nixflex calls prepare --body '@intent.json' --output prepared-call.json --json
|
|
43
|
+
# Only for the approved initial send. Key/base URL are configured privately.
|
|
44
|
+
nixflex calls create --body '@prepared-call.json' --base-url $env:NIXFLEX_BASE_URL --json
|
|
45
|
+
# Read only. These commands cannot place calls.
|
|
46
|
+
nixflex calls outboundRequest 'SAVED-UUID' --base-url $env:NIXFLEX_BASE_URL --json
|
|
47
|
+
nixflex calls bookings 'KNOWN-CALL-ID' --base-url $env:NIXFLEX_BASE_URL --json
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Check each command's exit code before continuing; never chain prepare/create in a retry loop. A supplied --request-id UUID is also supported for create, but save the exact inputs first. CLI --json errors exit 1; inspect error.status/code/details.request_id. Never print the key or log the booking payload.
|
|
51
|
+
|
|
52
|
+
## Python sync and async
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
import json, os
|
|
56
|
+
from pathlib import Path
|
|
57
|
+
from nixflex import Nixflex, AsyncNixflex, prepare_outbound_call, NixflexOutboundRequestError
|
|
58
|
+
connection = dict(api_key=os.environ['NIXFLEX_API_KEY'],
|
|
59
|
+
base_url=os.environ['NIXFLEX_BASE_URL'], max_retries=0)
|
|
60
|
+
# Local preparation, once for a new authorized intent; use private access permissions.
|
|
61
|
+
prepared = prepare_outbound_call(dict(agent_id='YOUR_AGENT', to_number='+12025550100',
|
|
62
|
+
from_number='+12025550101', prompt='Your approved call purpose', variables={'name':'Example'}))
|
|
63
|
+
with open('prepared-call.json','x',encoding='utf-8') as file:
|
|
64
|
+
json.dump(prepared,file)
|
|
65
|
+
saved = json.loads(Path('prepared-call.json').read_text(encoding='utf-8'))
|
|
66
|
+
with Nixflex(**connection) as client:
|
|
67
|
+
try:
|
|
68
|
+
receipt = client.calls.create(**saved) # Paid call, human authorization required.
|
|
69
|
+
except NixflexOutboundRequestError as error:
|
|
70
|
+
# Keep saved ID; surface only safe code/status, reconcile instead of redialling.
|
|
71
|
+
pass
|
|
72
|
+
state = client.calls.outbound_request(saved['request_id'])
|
|
73
|
+
if state['state'] == 'accepted' and state['call_id']:
|
|
74
|
+
result = client.calls.bookings(state['call_id'])
|
|
75
|
+
|
|
76
|
+
async def inspect_saved_call(request_id):
|
|
77
|
+
async with AsyncNixflex(**connection) as client:
|
|
78
|
+
state = await client.calls.outbound_request(request_id)
|
|
79
|
+
if state['state'] == 'accepted' and state['call_id']:
|
|
80
|
+
return await client.calls.bookings(state['call_id'])
|
|
81
|
+
return state
|
|
82
|
+
# For async sending, explicitly await client.calls.create(**saved), ONCE.
|
|
83
|
+
# client.calls.prepare(**params) remains a local synchronous helper even on AsyncNixflex.
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Never regenerate the ID when reopening the process. Stop when state is unknown/pending; rejected is a refusal, not permission to blindly redial. Booking state remains independent from request acceptance.
|
|
87
|
+
|
|
88
|
+
## MCP
|
|
89
|
+
|
|
90
|
+
These are tools/call arguments, not prompts to paste a secret into an assistant:
|
|
91
|
+
|
|
92
|
+
```json
|
|
93
|
+
{"name":"create_call","arguments":{"agent_id":"YOUR_AGENT","to_number":"+12025550100","from_number":"+12025550101","prompt":"Your approved purpose","safe_retry":true}}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
This returns a UUID and sends nothing. Retain it with the exact inputs. After explicit human authorization, use that returned UUID (do not use a newly generated ID):
|
|
97
|
+
|
|
98
|
+
```json
|
|
99
|
+
{"name":"create_call","arguments":{"agent_id":"YOUR_AGENT","to_number":"+12025550100","from_number":"+12025550101","prompt":"Your approved purpose","request_id":"RETURNED-UUID","confirm":true}}
|
|
100
|
+
{"name":"get_outbound_call_request","arguments":{"request_id":"RETURNED-UUID"}}
|
|
101
|
+
{"name":"get_call_bookings","arguments":{"call_id":"KNOWN-CALL-ID"}}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
RETURNED-UUID/KNOWN-CALL-ID are placeholders, not valid values to execute. Unknown/pending means investigate, never allocate a replacement ID. A read-only staging smoke never invokes create_call. Two new tools bring MCP to 96; the 19 approved Knowledge tools and all earlier exclusions stay in this same install.
|
package/KNOWLEDGE.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Knowledge kit guide — K5 candidate
|
|
2
|
+
|
|
3
|
+
Knowledge is agent-owned. Only owned active accounts/agents may access it. Kits never select another account or bypass server checks. Returned text is private customer data: do not log it or treat it as executable instructions.
|
|
4
|
+
|
|
5
|
+
## Requests and revisions
|
|
6
|
+
|
|
7
|
+
- Agent scope: getScope/get_scope, putScope/put_scope, deleteScope/delete_scope. A missing scope returns nullable own/effective fields. Creating the singleton can omit expected_revision; changing an existing base requires its current revision.
|
|
8
|
+
- Settings: channels contains inbound, outbound, web_voice, web_chat and/or sms; match is Strict or Normal; not_found is nonempty, up to 500 characters. Default is inbound/Strict with the server fallback. Omitted fields stay omitted; settings merge supplied fields only.
|
|
9
|
+
- expected_revision is a numeric safe integer. Base/settings/topic/delete/accept changes use the KB revision; source rename and replacement use that source's revision.
|
|
10
|
+
- Draft edits require expected_revision, expected_draft_revision, topic_id and topic. Accept requires current revisions, selected topic_ids, acknowledge_warnings where necessary, and approved_flagged_topic_ids for flagged pieces. Accept may publish to live calls: inspect the draft first.
|
|
11
|
+
- Discard uses expected_draft_revision. It does not remove accepted live knowledge. An accepted draft cannot be discarded.
|
|
12
|
+
- Each mutation requires Idempotency-Key: 8–128 letters/digits/underscore/dot/colon/hyphen, not starting prompt:. Node uses opts.idempotencyKey; Python uses idempotency_key. Same key/input can recover the receipt; different input gives 409 idempotency_conflict.
|
|
13
|
+
- Reuse a key only for the SAME intent after checking authoritative state. POST/PUT/PATCH/DELETE never automatically retry, including rate limits and uncertain replies.
|
|
14
|
+
- CLI changes require --confirm before HTTP. Source measurement and topic search POST commands also require --confirm, though they do not save live knowledge.
|
|
15
|
+
|
|
16
|
+
## Sources and pieces
|
|
17
|
+
|
|
18
|
+
- Text body: source:{type:"text",text:"...",title:"..."}, optional review. No direct URL/QA shortcut. Website discovery returns candidates; import requires discovery_id and explicitly selected page_ids.
|
|
19
|
+
- File upload is raw application/octet-stream, not JSON/base64/multipart. uploadSource/upload_source and replaceSourceFile/replace_source_file accept a path; measureFile/measure_file measures without saving.
|
|
20
|
+
- Headers: X-Filename, optional X-Source-Title, X-Review, replacement X-Expected-Revision. Filename/title must be printable ASCII at the transport boundary; server filename limit 200. Supply a safe explicit filename for non-ASCII basenames.
|
|
21
|
+
- Uploads use 64 KiB chunks from a regular file, maximum 10 MiB. Size is checked during transfer; a changed file fails honestly. No whole-file buffering/replay.
|
|
22
|
+
- Server limits: 50 sources/base, 20,000 tokens/source, 100,000 tokens/base, 1,000 pieces/base, 800 tokens/piece, 20 bases and 100 MiB/account. Capabilities are authoritative.
|
|
23
|
+
- Manual topic facts are required, nonempty, at most 20,000 characters. Optional title, questions (up to five, each up to 300), valid_from and valid_until UTC bounds. Oversized input can return a needs_review draft receipt instead of a job.
|
|
24
|
+
- Source removal uses the KB revision, selected topic_ids, manual:"keep" or "delete" for edited pieces. It can remove empty related sources. Never infer success from a timeout.
|
|
25
|
+
|
|
26
|
+
## Pages and jobs
|
|
27
|
+
|
|
28
|
+
- Sources/topics default 50/page, max 100. Targets default 30, unanswered 20, max 100. Preserve opaque cursors/filters; stop at next_cursor:null. On 409 stale_revision explicitly reload; never silently restart a page walk.
|
|
29
|
+
- Targets are agents only; q max 200. Events use decimal string cursor (default "0"), return up to 100 ordered events, next poll uses the last sequence. Never round it through a floating-point number.
|
|
30
|
+
- Topic management search uses query 2–200 characters, returns up to 30 pieces. It is a POST, never automatically retried.
|
|
31
|
+
- keyterms(target) reads ranked automatic knowledge_keyterms; it does not edit manual boosted keywords.
|
|
32
|
+
- waitJob / wait_job: default 20 attempts, 1-second interval, 30-second budget; maximum 100 attempts, interval 30 seconds, budget 300 seconds. Per-request timeouts and bounded GET retries also apply: not a hard real-time deadline.
|
|
33
|
+
- ready, needs_review, failed, cancelled and deleted stop polling; only the returned state tells the outcome. needs_review is not publication. Inspect result/error/paid_work_started; never invent progress.
|
|
34
|
+
- Aborting/stopping polling does not cancel server work. cancelJob is a separate mutation; committed work can refuse it. retryJob is explicit and server-limited.
|
|
35
|
+
- CLI --wait applies only to a receipt with id and state. A draft receipt remains a draft.
|
|
36
|
+
|
|
37
|
+
## Export/download
|
|
38
|
+
|
|
39
|
+
createExport starts a job. Wait until ready, then use its export ID. Exports expire after one hour and may refuse a changed revision. Original raw source files are not exported.
|
|
40
|
+
|
|
41
|
+
downloadExport / download_export streams exact API JSON bytes. format:"text" STILL returns JSON with filename/content_type/text, not raw TXT. CLI --output FILE.json publishes only a completed file and never overwrites. SDK users must discard partial files on failure.
|
|
42
|
+
|
|
43
|
+
No full-export buffering. GET retry can happen before any bytes are emitted; once bytes are emitted the stream never restarts. Close/aclose an iterator when stopping early.
|
|
44
|
+
|
|
45
|
+
## Knowledge-only tests
|
|
46
|
+
|
|
47
|
+
Defaults: mode knowledge, channel inbound. A ready active base with accepted live pieces is required. number/call_purpose are forbidden. Optional draft_id must match the base revision. At most 100 sessions/day; questions nonempty, max 4,000 characters.
|
|
48
|
+
|
|
49
|
+
A question can use model work, but makes no call/SMS/external action. Cancellation only stops that test; no live-knowledge rollback. Changed target/base or closed sessions refuse. The final smoke script performs reads and LOCAL invalid-key refusals only, with zero session creation/questions.
|
|
50
|
+
|
|
51
|
+
## Errors
|
|
52
|
+
|
|
53
|
+
SDKs preserve status/code/request ID/details. Never log full messages/details: they can contain customer content. CLI emits a static code whitelist and generic messages. Unknown writes preserve outcome_unknown / safe_to_retry:false; inspect authoritative state before retrying.
|
|
54
|
+
|
|
55
|
+
401/403: credentials/ownership; 409 stale_revision: reread and reconcile; knowledge_missing: approve live pieces first; idempotency_conflict: different intent needs a different key; export_expired: explicitly create another export if wanted; session_closed/target_changed: new test requires approval; 429: respect quota, never automatically repeat writes.
|
|
56
|
+
|
|
57
|
+
K5 introduced a candidate with 89 tools, including 19 approved Knowledge tools. K9 now has 97 tools; those 19 Knowledge tools and their exclusions are unchanged. Legacy getDraft/get_draft (GET /knowledge-bases/:kb/drafts/:id) can normalize and SAVE old drafts. It remains SDK/CLI-only and is excluded from MCP and the safe staging checker. SDK GET retry semantics are unchanged; use maxRetries/max_retries=0 for intentional legacy draft inspection if replay is unwanted. Live changes/deletes/accept/import/upload/job control and bulk exports are excluded. Personal sessions, account erasure, private signing-secret retrieval and excluded integrations remain outside kit scope.
|
|
58
|
+
|
|
59
|
+
## B49g keyterms response
|
|
60
|
+
|
|
61
|
+
keyterms returns all six required fields: knowledge_keyterms (string array), knowledge_keyterms_count and knowledge_keyterms_limit (numbers), manual_keyterms (string array), manual_keyterms_count and manual_keyterms_limit (numbers). Counts describe the returned arrays. The automatic limit is configured by the server (default 80); the manual new-edit limit is 20, and unchanged legacy manual lists may exceed it. Automatic candidates remain separate from saved manual words and the dashboard's unsaved edits. Node exports the KnowledgeKeyterms return interface; Python returns the full dictionary. This is an owned read, with no write or logging.
|
package/METHODS.md
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# Node public method signatures
|
|
2
|
+
|
|
3
|
+
All signatures come from current public classes. Options include abort/timeout; GET-only bounded retries. New CLI writes require --confirm. SDK mutations require deliberate application authorization; Knowledge also requires an explicit operation key.
|
|
4
|
+
See KNOWLEDGE.md and TEAM-INTEGRATIONS.md for defaults, limits, errors and replacement/patch rules. No personal-session, signing-secret or private provider wrappers are exposed.
|
|
5
|
+
|
|
6
|
+
| Resource | Signature |
|
|
7
|
+
| --- | --- |
|
|
8
|
+
| client.agents | create(params: AgentCreateParams = {}, opts?: RequestOptions): Promise<Agent> |
|
|
9
|
+
| client.agents | list(params: AgentListParams = {}, opts?: RequestOptions): Promise<Agent[]> |
|
|
10
|
+
| client.agents | *iter(pageSize = 100, opts?: RequestOptions): AsyncGenerator<Agent> |
|
|
11
|
+
| client.agents | get(agentId: string, opts?: RequestOptions): Promise<Agent> |
|
|
12
|
+
| client.agents | update(agentId: string, params: AgentUpdateParams, opts?: RequestOptions): Promise<Agent> |
|
|
13
|
+
| client.agents | delete(agentId: string, opts?: RequestOptions): Promise<AgentDeleteResponse> |
|
|
14
|
+
| client.callers | get(phoneNumber: string, callerNumber: string, opts?: RequestOptions): Promise<CallerContextResponse> |
|
|
15
|
+
| client.callers | set(phoneNumber: string, callerNumber: string, params: CallerContextSetParams, opts?: RequestOptions): Promise<CallerContextResponse> |
|
|
16
|
+
| client.callers | delete(phoneNumber: string, callerNumber: string, opts?: RequestOptions): Promise<CallerContextDeleteResponse> |
|
|
17
|
+
| client.callers | import(phoneNumber: string, callers: CallerImportRow[], opts?: RequestOptions): Promise<CallerImportResponse> |
|
|
18
|
+
| client.calls | create(params: OutboundCallParams, opts?: RequestOptions): Promise<OutboundCallResponse> |
|
|
19
|
+
| client.calls | list(params: ListParams = {}, opts?: RequestOptions): Promise<Call[]> |
|
|
20
|
+
| client.calls | history(params: CallHistoryParams = {}, opts?: RequestOptions): Promise<CallHistoryPage> |
|
|
21
|
+
| client.calls | read(callId: string, opts?: RequestOptions): Promise<CallRead> |
|
|
22
|
+
| client.calls | recording(callId: string, opts?: RequestOptions): Promise<CallRecording> |
|
|
23
|
+
| client.calls | *iter(pageSize = 100, opts?: RequestOptions): AsyncGenerator<Call> |
|
|
24
|
+
| client.calls | get(callId: string, opts?: RequestOptions): Promise<Call> |
|
|
25
|
+
| client.calls | delete(callId: string, opts?: RequestOptions): Promise<CallDeleteResponse> |
|
|
26
|
+
| client.calls | deleteAll(opts?: RequestOptions): Promise<CallDeleteAllResponse> |
|
|
27
|
+
| client.campaigns | cancel(id: string, opts?: RequestOptions): Promise<C5.CampaignCancelResponse> |
|
|
28
|
+
| client.campaigns | consent(id: string, params: C5.CampaignConsentParams, opts?: RequestOptions): Promise<C5.CampaignConsentResponse> |
|
|
29
|
+
| client.campaigns | resume(id: string, opts?: RequestOptions): Promise<C5.CampaignResumeResponse> |
|
|
30
|
+
| client.campaigns | list(params: C5.CampaignListQuery = {}, opts?: RequestOptions): Promise<C5.CampaignListResponse> |
|
|
31
|
+
| client.campaigns | create(params: BatchCampaignParams, opts?: RequestOptions): Promise<BatchCreateResponse> |
|
|
32
|
+
| client.campaigns | launch(campaignId: string, opts?: RequestOptions): Promise<BatchLaunchResponse> |
|
|
33
|
+
| client.contacts | preview(params: C.ContactPreviewParams, opts?: RequestOptions): Promise<C.ContactPreviewResponse> |
|
|
34
|
+
| client.contacts | list(params: C.ContactListQuery = {}, opts?: RequestOptions): Promise<C.ContactListResponse> |
|
|
35
|
+
| client.contacts | add(params: C.ContactAddParams, opts?: RequestOptions): Promise<C.ContactAddResponse> |
|
|
36
|
+
| client.contacts | remove(params: C.ContactRemoveParams, opts?: RequestOptions): Promise<C.ContactRemoveResponse> |
|
|
37
|
+
| client.account | retention(opts?: RequestOptions): Promise<AccountRetention> |
|
|
38
|
+
| client.voices | list(params: VoiceListParams = {}, opts?: RequestOptions): Promise<VoiceListResponse> |
|
|
39
|
+
| client.voices | get(voiceKey: string, params: VoiceContext = {}, opts?: RequestOptions): Promise<Voice> |
|
|
40
|
+
| client.inbox | list(channel: 'sms' | 'web', number: string, params: C.InboxListQuery = {}, opts?: RequestOptions): Promise<C.InboxListResponse> |
|
|
41
|
+
| client.inbox | thread(channel: 'sms' | 'web', number: string, thread: string, params: C.InboxThreadQuery = {}, opts?: RequestOptions): Promise<C.InboxThreadResponse> |
|
|
42
|
+
| client.inbox | update(channel: 'sms' | 'web', number: string, thread: string, params: C.InboxUpdateParams, opts?: RequestOptions): Promise<C.InboxUpdateResponse> |
|
|
43
|
+
| client.inbox | features(opts?: RequestOptions): Promise<C.InboxFeaturesResponse> |
|
|
44
|
+
| client.inbox | numbers(params: C.InboxNumbersQuery = {}, opts?: RequestOptions): Promise<C.InboxNumbersResponse> |
|
|
45
|
+
| client.inbox | retention(params: C.InboxRetentionQuery = {}, opts?: RequestOptions): Promise<C.InboxRetentionResponse> |
|
|
46
|
+
| client.integrations | get(provider: P, number: string, opts?: RequestOptions): Promise<IntegrationReads[P]> |
|
|
47
|
+
| client.integrations | set(provider: P, number: string, body: IntegrationSettings[P], opts?: RequestOptions): Promise<IntegrationReceipt> |
|
|
48
|
+
| client.integrations | delete(provider: IntegrationProvider, number: string, opts?: RequestOptions): Promise<IntegrationReceipt> |
|
|
49
|
+
| client.integrations | getAgentPrecall(agentId: string, opts?: RequestOptions): Promise<AgentPrecall> |
|
|
50
|
+
| client.integrations | setAgentPrecall(agentId: string, url: string, opts?: RequestOptions): Promise<IntegrationReceipt> |
|
|
51
|
+
| client.integrations | deleteAgentPrecall(agentId: string, opts?: RequestOptions): Promise<IntegrationReceipt> |
|
|
52
|
+
| client.integrations | listFunctions(number: string, opts?: RequestOptions): Promise<{ phone_number: string; functions: CustomFunctionView[] }> |
|
|
53
|
+
| client.integrations | createFunction(number: string, body: CustomFunctionInput, opts?: RequestOptions): Promise<FunctionReceipt> |
|
|
54
|
+
| client.integrations | updateFunction(number: string, id: string, body: Partial<CustomFunctionInput>, opts?: RequestOptions): Promise<FunctionReceipt> |
|
|
55
|
+
| client.integrations | deleteFunction(number: string, id: string, opts?: RequestOptions): Promise<FunctionReceipt> |
|
|
56
|
+
| client.knowledge | deleteScope(target: string, body: RevisionInput, opts: KnowledgeWriteOptions): Promise<KnowledgeObject> |
|
|
57
|
+
| client.knowledge | getScope(target: string, opts?: RequestOptions): Promise<KnowledgeObject> |
|
|
58
|
+
| client.knowledge | putScope(target: string, body: ScopeInput, opts: KnowledgeWriteOptions): Promise<KnowledgeObject> |
|
|
59
|
+
| client.knowledge | measureSource(target: string, body: { text: string }, opts?: RequestOptions): Promise<KnowledgeObject> |
|
|
60
|
+
| client.knowledge | startSession(target: string, body: SessionInput, opts: KnowledgeWriteOptions): Promise<KnowledgeObject> |
|
|
61
|
+
| client.knowledge | getBase(kb: string, opts?: RequestOptions): Promise<KnowledgeObject> |
|
|
62
|
+
| client.knowledge | discardDraft(kb: string, id: string, body: { expected_draft_revision: number }, opts: KnowledgeWriteOptions): Promise<KnowledgeObject> |
|
|
63
|
+
| client.knowledge | getDraft(kb: string, id: string, opts?: RequestOptions): Promise<KnowledgeObject> |
|
|
64
|
+
| client.knowledge | updateDraft(kb: string, id: string, body: DraftEdit, opts: KnowledgeWriteOptions): Promise<KnowledgeObject> |
|
|
65
|
+
| client.knowledge | acceptDraft(kb: string, id: string, body: DraftAcceptance, opts: KnowledgeWriteOptions): Promise<KnowledgeObject> |
|
|
66
|
+
| client.knowledge | createExport(kb: string, body: EmptyInput, opts: KnowledgeWriteOptions): Promise<KnowledgeJob> |
|
|
67
|
+
| client.knowledge | overview(kb: string, opts?: RequestOptions): Promise<KnowledgeObject> |
|
|
68
|
+
| client.knowledge | updateSettings(kb: string, body: SettingsInput, opts: KnowledgeWriteOptions): Promise<KnowledgeObject> |
|
|
69
|
+
| client.knowledge | listSources(kb: string, query: PageQuery = {}, opts?: RequestOptions): Promise<KnowledgePage> |
|
|
70
|
+
| client.knowledge | addSource(kb: string, body: SourceInput, opts: KnowledgeWriteOptions): Promise<KnowledgeJob> |
|
|
71
|
+
| client.knowledge | deleteSource(kb: string, id: string, body: SourceDeletion, opts: KnowledgeWriteOptions): Promise<KnowledgeObject> |
|
|
72
|
+
| client.knowledge | renameSource(kb: string, id: string, body: { expected_revision: number; title: string }, opts: KnowledgeWriteOptions): Promise<KnowledgeObject> |
|
|
73
|
+
| client.knowledge | replaceSource(kb: string, id: string, body: SourceReplacement, opts: KnowledgeWriteOptions): Promise<KnowledgeJob> |
|
|
74
|
+
| client.knowledge | refreshSources(kb: string, body: { source_ids: string[]; review?: boolean }, opts: KnowledgeWriteOptions): Promise<KnowledgeJob> |
|
|
75
|
+
| client.knowledge | searchTopics(kb: string, body: { query: string }, opts?: RequestOptions): Promise<KnowledgeObject> |
|
|
76
|
+
| client.knowledge | listTopics(kb: string, query: PageQuery = {}, opts?: RequestOptions): Promise<KnowledgePage> |
|
|
77
|
+
| client.knowledge | createTopic(kb: string, body: TopicInput, opts: KnowledgeWriteOptions): Promise<KnowledgeTopicResult> |
|
|
78
|
+
| client.knowledge | deleteTopic(kb: string, id: string, body: RevisionInput, opts: KnowledgeWriteOptions): Promise<KnowledgeObject> |
|
|
79
|
+
| client.knowledge | getTopic(kb: string, id: string, opts?: RequestOptions): Promise<KnowledgeObject> |
|
|
80
|
+
| client.knowledge | updateTopic(kb: string, id: string, body: TopicInput, opts: KnowledgeWriteOptions): Promise<KnowledgeTopicResult> |
|
|
81
|
+
| client.knowledge | unanswered(kb: string, query: PageQuery = {}, opts?: RequestOptions): Promise<KnowledgePage> |
|
|
82
|
+
| client.knowledge | discoverWebsite(kb: string, body: { url: string }, opts: KnowledgeWriteOptions): Promise<KnowledgeJob> |
|
|
83
|
+
| client.knowledge | importWebsite(kb: string, body: WebsiteInput, opts: KnowledgeWriteOptions): Promise<KnowledgeJob> |
|
|
84
|
+
| client.knowledge | capabilities(opts?: RequestOptions): Promise<KnowledgeObject> |
|
|
85
|
+
| client.knowledge | events(query: { cursor?: string } = {}, opts?: RequestOptions): Promise<KnowledgeObject[]> |
|
|
86
|
+
| client.knowledge | downloadExport(id: string, query: { format?: 'json' | 'text' } = {}, opts?: RequestOptions): AsyncGenerator<Uint8Array> |
|
|
87
|
+
| client.knowledge | getJob(id: string, opts?: RequestOptions): Promise<KnowledgeJob> |
|
|
88
|
+
| client.knowledge | cancelJob(id: string, body: EmptyInput, opts: KnowledgeWriteOptions): Promise<KnowledgeJob> |
|
|
89
|
+
| client.knowledge | retryJob(id: string, body: EmptyInput, opts: KnowledgeWriteOptions): Promise<KnowledgeJob> |
|
|
90
|
+
| client.knowledge | targets(query: TargetQuery = {}, opts?: RequestOptions): Promise<KnowledgePage> |
|
|
91
|
+
| client.knowledge | getSession(id: string, opts?: RequestOptions): Promise<KnowledgeObject> |
|
|
92
|
+
| client.knowledge | cancelSession(id: string, body: EmptyInput, opts: KnowledgeWriteOptions): Promise<KnowledgeObject> |
|
|
93
|
+
| client.knowledge | ask(id: string, body: { text: string }, opts: KnowledgeWriteOptions): Promise<KnowledgeObject> |
|
|
94
|
+
| client.knowledge | usage(query: { kb?: string } = {}, opts?: RequestOptions): Promise<KnowledgeObject> |
|
|
95
|
+
| client.knowledge | keyterms(target: string, opts?: RequestOptions): Promise<KnowledgeKeyterms> |
|
|
96
|
+
| client.knowledge | uploadSource(kb: string, file: string, opts: KnowledgeUploadOptions): Promise<KnowledgeJob> |
|
|
97
|
+
| client.knowledge | replaceSourceFile(kb: string, id: string, file: string, opts: KnowledgeUploadOptions): Promise<KnowledgeJob> |
|
|
98
|
+
| client.knowledge | measureFile(target: string, file: string, opts: RequestOptions = {}): Promise<KnowledgeObject> |
|
|
99
|
+
| client.knowledge | waitJob(id: string, options: JobPollOptions = {}): Promise<KnowledgeJob> |
|
|
100
|
+
| client.organisation | get(opts?:RequestOptions): Promise<OrganisationContext> |
|
|
101
|
+
| client.organisation | members(opts?:RequestOptions): Promise<OrganisationMembers> |
|
|
102
|
+
| client.organisation | invite(email:string, role:'admin'|'member'='member', opts?:RequestOptions): Promise<InvitationReceipt> |
|
|
103
|
+
| client.organisation | resend(inviteId:string, opts?:RequestOptions): Promise<InvitationReceipt> |
|
|
104
|
+
| client.organisation | revoke(inviteId:string, opts?:RequestOptions): Promise<{id:string;state:string}> |
|
|
105
|
+
| client.organisation | removeMember(userId:string, opts?:RequestOptions): Promise<MembershipReceipt> |
|
|
106
|
+
| client.organisation | setRole(userId:string, role:'admin'|'member', opts?:RequestOptions): Promise<MembershipReceipt> |
|
|
107
|
+
| client.organisation | activity(params:ActivityFilters={}, opts?:RequestOptions): Promise<ActivityPage> |
|
|
108
|
+
| client.organisation | activityCsv(params:ActivityFilters={}, opts?:RequestOptions): AsyncGenerator<Uint8Array> |
|
|
109
|
+
| client.organisation | rename(name:string, opts?:RequestOptions): Promise<{name:string}> |
|
|
110
|
+
| client.organisation | claimInvite(email:string, opts?:RequestOptions): Promise<InvitationReceipt> |
|
|
111
|
+
| client.phoneNumbers | usage(phoneNumber: string, params: NumberUsageParams = {}, opts?: RequestOptions): Promise<NumberUsageResponse> |
|
|
112
|
+
| client.phoneNumbers | import(params: PhoneNumberImportParams, opts?: RequestOptions): Promise<{ phone_number: PhoneNumber }> |
|
|
113
|
+
| client.phoneNumbers | list(params: PhoneNumberListParams = {}, opts?: RequestOptions): Promise<PhoneNumberListResponse> |
|
|
114
|
+
| client.phoneNumbers | get(phoneNumber: string, opts?: RequestOptions): Promise<{ phone_number: PhoneNumberDetails }> |
|
|
115
|
+
| client.phoneNumbers | update(phoneNumber: string, params: PhoneNumberMoveParams, opts?: RequestOptions): Promise<PhoneNumberMoveResponse> |
|
|
116
|
+
| client.phoneNumbers | update(phoneNumber: string, params: PhoneNumberUpdateParams, opts?: RequestOptions): Promise<{ phone_number: PhoneNumber }> |
|
|
117
|
+
| client.phoneNumbers | update(phoneNumber: string, params: PhoneNumberUpdateParams | PhoneNumberMoveParams, opts?: RequestOptions): Promise<{ phone_number: PhoneNumber } | PhoneNumberMoveResponse> |
|
|
118
|
+
| client.phoneNumbers | move(phoneNumber: string, agentId: string, opts?: RequestOptions): Promise<PhoneNumberMoveResponse> |
|
|
119
|
+
| client.phoneNumbers | delete(phoneNumber: string, opts?: RequestOptions): Promise<PhoneNumberDeleteResponse> |
|
|
120
|
+
| client.phoneNumbers | setWebCalls(phoneNumber: string, enabled: boolean, opts?: RequestOptions): Promise<WebCallsToggleResponse> |
|
|
121
|
+
| client.phoneNumbers | getWebCalls(phoneNumber: string, opts?: RequestOptions): Promise<WebCallsToggleResponse> |
|
|
122
|
+
| client.sms.campaigns | cancel(id: string, opts?: RequestOptions): Promise<C5.CampaignCancelResponse> |
|
|
123
|
+
| client.sms.campaigns | consent(id: string, params: C5.CampaignConsentParams, opts?: RequestOptions): Promise<C5.CampaignConsentResponse> |
|
|
124
|
+
| client.sms.campaigns | resume(id: string, opts?: RequestOptions): Promise<C5.CampaignResumeResponse> |
|
|
125
|
+
| client.sms.campaigns | update(id: string, params: C5.SmsCampaignUpdateParams, opts?: RequestOptions): Promise<C5.SmsCampaignUpdateResponse> |
|
|
126
|
+
| client.sms.campaigns | create(params: SmsCampaignCreateParams, opts?: RequestOptions): Promise<SmsCampaignCreateResponse> |
|
|
127
|
+
| client.sms.campaigns | launch(campaignId: string, opts?: RequestOptions): Promise<SmsCampaignLaunchResponse> |
|
|
128
|
+
| client.sms.campaigns | list(params: { status?: string; limit?: number; before?: string } = {}, opts?: RequestOptions): Promise<SmsCampaignListResponse> |
|
|
129
|
+
| client.sms.campaigns | get(campaignId: string, opts?: RequestOptions & SmsCampaignDetailParams): Promise<SmsCampaignDetail> |
|
|
130
|
+
| client.sms.campaigns | delete(campaignId: string, opts?: RequestOptions): Promise<CampaignDeleteResponse> |
|
|
131
|
+
| client.sms | send(params: SmsSendParams, opts?: RequestOptions): Promise<SmsSendResponse> |
|
|
132
|
+
| client.keys | activity(params: KeyActivityParams = {}, opts?: RequestOptions): Promise<KeyActivity> |
|
|
133
|
+
| client.keys | rotate(opts?: RequestOptions): Promise<KeyRotateResponse> |
|
|
134
|
+
| client.usage | get(opts?: RequestOptions): Promise<Usage> |
|
|
135
|
+
| client.webhooks | verify(rawBody: string | Buffer, signatureHeader: string | null | undefined, keySecret: string, options?: import('../webhook-verify.js').VerifyOptions): boolean |
|
|
136
|
+
| client.webhooks | set(phoneNumber: string, url: string, slot: 1 | 2 = 1, opts?: RequestOptions): Promise<WebhookConfigResponse> |
|
|
137
|
+
| client.webhooks | get(phoneNumber: string, slot: 1 | 2 = 1, opts?: RequestOptions): Promise<WebhookConfigResponse> |
|
|
138
|
+
| client.webhooks | delete(phoneNumber: string, slot: 1 | 2 = 1, opts?: RequestOptions): Promise<WebhookConfigResponse> |
|
|
139
|
+
| client.webAgent | get(number: string, opts?: RequestOptions): Promise<C.WebAgentReadResponse> |
|
|
140
|
+
| client.webAgent | update(number: string, params: C.WebAgentUpdateParams, opts?: RequestOptions): Promise<C.WebAgentUpdateResponse> |
|
|
141
|
+
| Nixflex | static createKey({name?,email?}, baseUrl?) — unauthenticated; returns a new secret once. Store privately. |
|
|
142
|
+
| module | verifyWebhookSignature(rawBody, header, signingSecret, options?) — verify raw bytes before trusting a webhook. |
|
|
143
|
+
|
|
144
|
+
## K6 per-number additions
|
|
145
|
+
|
|
146
|
+
| HTTP operation (number is URL-encoded E.164) | Node / CLI command | Python sync + async | MCP |
|
|
147
|
+
| --- | --- | --- | --- |
|
|
148
|
+
| POST /v1/integrations/google-calendar/number/{number}/connect | integrations.connectGoogleCalendar / integrations connectGoogleCalendar | integrations.connect_google_calendar | connect_google_calendar |
|
|
149
|
+
| GET /v1/integrations/google-calendar/number/{number} | integrations.getGoogleCalendar / integrations getGoogleCalendar | integrations.get_google_calendar | get_google_calendar |
|
|
150
|
+
| DELETE /v1/integrations/google-calendar/number/{number} | integrations.disconnectGoogleCalendar / integrations disconnectGoogleCalendar | integrations.disconnect_google_calendar | disconnect_google_calendar |
|
|
151
|
+
| PATCH /v1/integrations/google-calendar/number/{number} | integrations.updateGoogleCalendarSettings / integrations updateGoogleCalendarSettings | integrations.update_google_calendar_settings | update_google_calendar_settings |
|
|
152
|
+
| POST /v1/phone-numbers/{number}/credentials | phoneNumbers.updateCredentials / numbers updateCredentials | phone_numbers.update_credentials | update_phone_number_credentials |
|
|
153
|
+
|
|
154
|
+
See NUMBER-FEATURES.md for exact input/output and errors.
|
|
155
|
+
|
|
156
|
+
## K7 call results and requests
|
|
157
|
+
|
|
158
|
+
| Operation | Node | CLI | Python sync / async | MCP |
|
|
159
|
+
| --- | --- | --- | --- | --- |
|
|
160
|
+
| GET /v1/calls/{call_id}/bookings | calls.bookings(id) | calls bookings ID | calls.bookings(id) | get_call_bookings |
|
|
161
|
+
| POST /v1/calls/outbound, optional UUID request_id | calls.create(params) | calls create --request-id UUID or --body @prepared.json | calls.create(..., request_id=uuid) | create_call, optional request_id / safe_retry / confirm |
|
|
162
|
+
| GET /v1/calls/outbound/requests/{request_id} | calls.outboundRequest(uuid) | calls outboundRequest UUID | calls.outbound_request(uuid) | get_outbound_call_request |
|
|
163
|
+
| Local preparation, no API request | calls.prepare(params), prepareOutboundCall(params) | calls prepare --output prepared.json | calls.prepare(**params), prepare_outbound_call(params) | create_call with safe_retry:true and no request_id |
|
|
164
|
+
|
|
165
|
+
The two GET routes are new coverage. POST already existed; request_id extends it. Preparation is local, not another API endpoint. At K7, MCP registered 96 tools (94 prior plus two reads); only create_call gained optional inputs/guidance. Those historical contracts were pinned to K6. K9 now registers 97 tools; only its two B57 delete handlers/descriptions change alongside the new voice-delete tool. Public-scope exclusions remain unchanged.
|
|
166
|
+
|
|
167
|
+
See CALL-REQUESTS.md for exact fields, typed errors, unchanged no-ID behavior and CLI/MCP confirmation rules.
|
|
168
|
+
|
|
169
|
+
## K9 B57 deletion
|
|
170
|
+
|
|
171
|
+
| Resource | Signature |
|
|
172
|
+
|---|---|
|
|
173
|
+
| client.campaigns | delete(id: string, opts?: RequestOptions): Promise<CampaignDeleteResponse> |
|
|
174
|
+
| client.sms.campaigns | delete(id: string, opts?: RequestOptions): Promise<CampaignDeleteResponse> |
|
|
175
|
+
|
|
176
|
+
See [B57-DELETES.md](B57-DELETES.md) for the three receipts, queued 503, permissions, uncertainty and unchanged bulk guard.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# K6 number features — 4 November 2026
|
|
2
|
+
|
|
3
|
+
Engine contract: deb63749acc74fe5d1d840dbf3589b2c40b5627e (B50/B50b/B51/B52). No engine changes. Public Cal.com methods remain unchanged.
|
|
4
|
+
|
|
5
|
+
| HTTP operation (number is URL-encoded E.164) | Node / CLI command | Python sync + async | MCP |
|
|
6
|
+
| --- | --- | --- | --- |
|
|
7
|
+
| POST /v1/integrations/google-calendar/number/{number}/connect | integrations.connectGoogleCalendar / integrations connectGoogleCalendar | integrations.connect_google_calendar | connect_google_calendar |
|
|
8
|
+
| GET /v1/integrations/google-calendar/number/{number} | integrations.getGoogleCalendar / integrations getGoogleCalendar | integrations.get_google_calendar | get_google_calendar |
|
|
9
|
+
| DELETE /v1/integrations/google-calendar/number/{number} | integrations.disconnectGoogleCalendar / integrations disconnectGoogleCalendar | integrations.disconnect_google_calendar | disconnect_google_calendar |
|
|
10
|
+
| PATCH /v1/integrations/google-calendar/number/{number} | integrations.updateGoogleCalendarSettings / integrations updateGoogleCalendarSettings | integrations.update_google_calendar_settings | update_google_calendar_settings |
|
|
11
|
+
| POST /v1/phone-numbers/{number}/credentials | phoneNumbers.updateCredentials / numbers updateCredentials | phone_numbers.update_credentials | update_phone_number_credentials |
|
|
12
|
+
|
|
13
|
+
## Calendar contract
|
|
14
|
+
|
|
15
|
+
Connect sends only `{return_url}` and returns `{url, expires_at}`. A human opens the short-lived Google consent link; the kits never open a browser. It contains OAuth state, not access/refresh tokens: do not log or redistribute it. HTTPS return URLs must have no credentials, fragment, whitespace, backslash, localhost or OAuth code/state/token query parameters. Custom application schemes need the server's account allowlist.
|
|
16
|
+
|
|
17
|
+
After consent, the engine redirects with `status=connected&phone_number=...`, or `status=error&code=...`. Query status again; a redirect is not a substitute for checking current state. Links last ten minutes.
|
|
18
|
+
|
|
19
|
+
GET returns exactly `connected`, nullable `account_email`, `calendar_id`, nullable `connected_at`, `needs_reconnect`, `send_invites`. `connected:true` plus `needs_reconnect:true` needs new consent. The GET can refresh provider credentials inside the engine; it does not connect a new account or change calendar settings.
|
|
20
|
+
|
|
21
|
+
PATCH sends a nonempty subset of `timezone`, `hours`, `slot_minutes`, `calendar_id`, `send_invites`. Omitted fields preserve saved values. `send_invites` is a strict boolean; false is retained, absent stored value defaults true. It controls Google's invitation request, not delivery proof. `timezone` is an IANA name (max 100 chars). `slot_minutes` is 15, 30, 45 or 60. `calendar_id` is nonblank, max 1024, no whitespace/control characters; `primary` selects the main calendar.
|
|
22
|
+
|
|
23
|
+
When supplying `hours`, include all seven lowercase weekday names; each is null (closed) or `["09:00","17:00"]`. Times are HH:MM, close after open, no overnight interval. PATCH returns the five safe settings. DELETE returns `{ok:true,connected:false}`; remote revocation is best effort and may protect shared connections. Do not claim remote removal or recall already dispatched bookings.
|
|
24
|
+
|
|
25
|
+
SDK errors: `NixflexCalendarError`, `NixflexCredentialError`; inspect status/code, not raw text. All known engine codes remain exact. Private response details are replaced by safe messages. Unknown future codes become `request_failed`; a known uncertain write is never represented as success. Exported calendar codes include invalid_return_url, number_not_found, already_connected, booking_provider_conflict, not_connected, agent_not_assigned, invalid_settings, invalid_timezone, invalid_hours, invalid_slot_minutes, invalid_calendar_id, invalid_send_invites, calendar_unavailable, expired_link, not_configured, guard_unavailable. MCP returns a structured error with type/code/status and safe details.
|
|
26
|
+
|
|
27
|
+
## Carrier details
|
|
28
|
+
|
|
29
|
+
Supply exactly `{twilio_sid,twilio_token}` OR `{telnyx_api_key,telnyx_connection_id}` for the number's current carrier; no provider field goes on the HTTP wire. The number, settings and history remain in place. This is a sensitive carrier routing change; Telnyx can require fresh verification. SDK callers supply the pair privately in memory. CLI uses the fixed environment names below or bounded JSON stdin; never credentials in arguments or files. MCP's schema accepts only phone_number, provider and confirm; it reads the selected pair privately from its process environment only AFTER confirmation. Never paste secrets into an assistant conversation.
|
|
30
|
+
|
|
31
|
+
- Twilio: NIXFLEX_TWILIO_SID + NIXFLEX_TWILIO_TOKEN.
|
|
32
|
+
- Telnyx: NIXFLEX_TELNYX_API_KEY + NIXFLEX_TELNYX_CONNECTION_ID.
|
|
33
|
+
- CLI/API authentication: NIXFLEX_API_KEY, separate from carrier credentials.
|
|
34
|
+
|
|
35
|
+
The only success output is `{phone_number,provider,updated:true}`. CLI writes require --confirm; MCP writes require confirm:true. Without it, zero requests and zero credential reads. A Desktop host must privately provide these environment variables to its server process; the bundle adds no secret input form. If it cannot, use the CLI/SDK instead. Missing private configuration returns credentials_not_configured and sends nothing.
|
|
36
|
+
|
|
37
|
+
Known errors: invalid_request, invalid_credentials, number_not_found, number_not_in_account, account_unavailable, carrier_mismatch, number_operation_pending, number_release_pending, carrier_unavailable, credential_update_unavailable, carrier_outcome_unknown, credential_save_pending. A safe UUID operation_id is retained when supplied; no input, response body, token or private URL is echoed.
|
|
38
|
+
|
|
39
|
+
`carrier_outcome_unknown`: routing is unconfirmed; contact support before retrying. `credential_save_pending`: carrier change is confirmed but database saving is pending; manually retry with EXACTLY the same details to finish saving. Never automatically repeat a write, including 429, 503, malformed success or lost connection. Uncertain writes carry safe_to_retry:false. SDK API keys retain normal owner/active checks; these clients cannot bypass the server's ownership/busy guards.
|
|
40
|
+
|
|
41
|
+
## SMS suppression compatibility
|
|
42
|
+
|
|
43
|
+
New response: HTTP 409, type `conflict`, code `do_not_contact`. Node/Python raise NixflexDoNotContactError (a NixflexConflictError); MCP/CLI retain the structured status/type/code. The message was not sent. Stop: never remove suppression or retry to bypass it. Older servers may return 400 invalid_request; retain the application's legacy handling as well, but do not classify every 400 as suppression. There is no automatic SMS retry. Campaign holds remain separate.
|
|
44
|
+
|
|
45
|
+
## Booking webhook model
|
|
46
|
+
|
|
47
|
+
Node/Python export Booking, CallCompletedBookingEvent and SmsBookingEvent. MCP ships bookingSchema, callCompletedBookingSchema and smsBookingSchema in k6-schemas.js (models, not extra tools). Verify the original raw-body webhook signature first using the existing verifier; these models do not authenticate a delivery.
|
|
48
|
+
|
|
49
|
+
Required booking keys: action (`created`/`rescheduled`/`cancelled`), booking_uid, start, end, attendee_name, attendee_email, service, timezone. Every field except action can be null; service can also be a string or number. Do not turn null into fabricated dates or attendee data. The flat call.completed event has bookings[], sms.booking has booking. Duplicate `already_exists` lookup is internal and is NOT a public booking mutation. Event models describe the booking part; other existing envelope fields remain available. No webhook receiver or listener is added.
|
|
50
|
+
|
|
51
|
+
See KIT-EXAMPLES-K6.md in the K6 handoff for all SDK/CLI/MCP examples. Live successful writes and human consent remain manual checks; offline tests use fakes only.
|
package/ORGANISATIONS.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Organisations candidate — not published or ready to enable
|
|
2
|
+
|
|
3
|
+
Engine SQL 104 and reviewed round 2 activation are required. Read `client.organisation.get()`, `.members()` and `.activity({before,actor})`. Manage `.invite(email,role)`, `.resend(inviteId)`, `.revoke(inviteId)`, `.removeMember(userId)`, `.setRole(userId,role)` and API-only `.claimInvite(email)`.
|
|
4
|
+
|
|
5
|
+
These use the existing organisation API key and its Owner-level API authority. Removing a dashboard member does not invalidate an externally shared key; the Owner must roll that key separately. No new key is created. No personal acceptance, Leave, ownership transfer or account deletion is exposed through this resource. No automatic signing-secret disclosure.
|
|
6
|
+
|
|
7
|
+
CLI: `nixflex organisation get`, `members`, `activity`; changes `invite`, `claim`, `resend ID`, `revoke ID`, `remove USER_ID`, `role USER_ID`. Use `--set email=person@example.com`, `--set role=member` (or admin), Activity `--set before=123 --set actor=UUID`. Review the default preview, then add `--confirm` to make a change. Never blindly repeat after an unknown response.
|
|
8
|
+
|
|
9
|
+
The current SDK fixed-resource CLI coverage test has no Organisation mapping. It remains unchanged and fails deliberately until an additive test-map extension is approved. New behavioural tests prove each implemented route and preview. Do not publish this candidate while any full gate fails.
|
package/README.md
CHANGED
|
@@ -1,117 +1,57 @@
|
|
|
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
|
+
> **Building with AI?** Tell your assistant to read https://docs.nixflex.com/ai-rules.md first - the rules for building on Nixflex (safe defaults, costs, what to ask before acting). Full docs: https://docs.nixflex.com
|
|
3
|
+
|
|
4
|
+
B57 deletion and voice campaign delete: see [B57-DELETES.md](B57-DELETES.md). K9 is an unpublished candidate; one DELETE, never an automatic retry.
|
|
5
|
+
|
|
6
|
+
Node 18+ for SDK/CLI, Node 22+ for MCP setup. SDK uses native fetch; CLI parser is bundled with its notices.
|
|
7
|
+
|
|
8
|
+
~~~js
|
|
9
|
+
import Nixflex from 'nixflex';
|
|
10
|
+
const client = new Nixflex({apiKey:process.env.NIXFLEX_API_KEY});
|
|
11
|
+
const agents = await client.agents.list({limit:1});
|
|
12
|
+
// Do not print private responses or credentials.
|
|
13
|
+
~~~
|
|
14
|
+
|
|
15
|
+
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.
|
|
16
|
+
|
|
17
|
+
## MCP setup
|
|
18
|
+
|
|
19
|
+
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.
|
|
20
|
+
|
|
21
|
+
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.
|
|
22
|
+
|
|
23
|
+
Malformed/unreadable config is refused; unrelated entries/comments survive. Replacement needs confirmation. Avoid concurrent config editors/installers.
|
|
24
|
+
|
|
25
|
+
## Contract and safety
|
|
26
|
+
|
|
27
|
+
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.
|
|
28
|
+
|
|
29
|
+
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.
|
|
30
|
+
|
|
31
|
+
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.
|
|
32
|
+
|
|
33
|
+
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.
|
|
34
|
+
|
|
35
|
+
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.
|
|
36
|
+
|
|
37
|
+
Webhook verification uses the organisation signing secret, independent of key rotation. Obtain it privately outside kits; verify the raw body before trusting a delivery.
|
|
38
|
+
|
|
39
|
+
## Method reference
|
|
40
|
+
|
|
41
|
+
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.
|
|
42
|
+
|
|
43
|
+
Unpublished candidates. Offline coverage does not prove successful mutations on staging; those tests remain manual.
|
|
44
|
+
|
|
45
|
+
## Caller read: missing record versus wrong number
|
|
46
|
+
|
|
47
|
+
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.
|
|
48
|
+
|
|
49
|
+
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.
|
|
50
|
+
|
|
51
|
+
## K6 additions
|
|
52
|
+
|
|
53
|
+
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.
|
|
54
|
+
|
|
55
|
+
## K7 additions
|
|
56
|
+
|
|
57
|
+
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.
|