Skip to main content
The official SDK wraps every Nixflex endpoint in typed methods, with retries, pagination, and typed errors built in. It has no runtime dependencies and works on Node 18 or newer.

npm

nixflex on the npm registry

Source

Read the code, open an issue

Install

Authenticate

Pass your full credential - both halves joined by a colon, exactly as the dashboard shows it. The SDK sets the header for you.
CommonJS works too:
Never use the SDK in browser or mobile client code - it needs your API secret. Call it from your own backend and expose only what your app needs.

Agents

Calls

Outbound calls use to_number. A single SMS uses to. The SDK’s types enforce the difference, so an editor with TypeScript will catch it before you run the code.

Phone numbers

Telnyx numbers use telnyx_api_key and telnyx_connection_id instead of the Twilio pair - the carrier is inferred from which credentials you send. null on an update field means inherit the agent’s setting; see Update phone number.

SMS

Campaigns (voice)

Usage and keys

Webhooks

Configure a number’s post-call webhook, and verify deliveries:
Verification works standalone or from the client. Pass the raw body - a re-serialized object will not match the signature:
It returns false for a tampered body, wrong secret, malformed header, or a signature older than 300 seconds (override with { toleranceSeconds }). It never throws. Full details: Webhooks.

Pagination

Every list endpoint has an iterator that fetches pages as you consume them:
client.agents.iter() works the same way. Or page manually with limit and offset.

Errors

Failed requests throw a typed error you can branch on. Every one carries status, code, type, message, docUrl, details, and requestId for support.

Retries

The SDK retries carefully, never blindly:
  • 429 - retried once, honouring the Retry-After header.
  • Network failure or timeout - retried, because no request reached us.
  • 5xx - retried only for GET and DELETE.
  • POST after a 5xx - never retried. A create request that may have succeeded is not repeated, so a call is never dialled twice.

TypeScript

Types ship with the package - no @types install. Request and response shapes are typed for every endpoint, and each method carries the field-level notes from this reference as editor tooltips.

Versioning

The SDK follows semantic versioning. Published methods are never removed or renamed within a major version, so upgrades within a major are safe. See the changelog before upgrading.
Building in another language? Every endpoint is a plain HTTPS request with a Bearer header - see the API reference. The SDK is a convenience, never a requirement.