npm
nixflex on the npm registrySource
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.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_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: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 carriesstatus, code, type, message, docUrl, details, and requestId for support.
Retries
The SDK retries carefully, never blindly:- 429 - retried once, honouring the
Retry-Afterheader. - Network failure or timeout - retried, because no request reached us.
- 5xx - retried only for
GETandDELETE. POSTafter 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.