{"id":13403171,"url":"https://github.com/team-telnyx/telnyx-node","last_synced_at":"2026-04-07T14:01:05.719Z","repository":{"id":37736187,"uuid":"200304131","full_name":"team-telnyx/telnyx-node","owner":"team-telnyx","description":"Node SDK for the Telnyx API","archived":false,"fork":false,"pushed_at":"2026-03-31T12:29:22.000Z","size":27274,"stargazers_count":187,"open_issues_count":9,"forks_count":27,"subscribers_count":7,"default_branch":"master","last_synced_at":"2026-04-01T22:17:20.493Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":"https://developers.telnyx.com/docs/api/v2/overview","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/team-telnyx.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-08-02T22:19:16.000Z","updated_at":"2026-03-30T22:59:55.000Z","dependencies_parsed_at":"2026-01-05T19:05:09.966Z","dependency_job_id":null,"html_url":"https://github.com/team-telnyx/telnyx-node","commit_stats":{"total_commits":157,"total_committers":13,"mean_commits":"12.076923076923077","dds":0.4968152866242038,"last_synced_commit":"b09c0f40aaf76b27d4df86e7725e06ed291c912d"},"previous_names":[],"tags_count":207,"template":false,"template_full_name":null,"purl":"pkg:github/team-telnyx/telnyx-node","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/team-telnyx%2Ftelnyx-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/team-telnyx%2Ftelnyx-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/team-telnyx%2Ftelnyx-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/team-telnyx%2Ftelnyx-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/team-telnyx","download_url":"https://codeload.github.com/team-telnyx/telnyx-node/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/team-telnyx%2Ftelnyx-node/sbom","scorecard":{"id":871437,"data":{"date":"2025-08-11","repo":{"name":"github.com/team-telnyx/telnyx-node","commit":"a64a5a88730de67c352f22738d0ac4bdd6707b86"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.9,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":4,"reason":"Found 9/22 approved changesets -- score normalized to 4","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":1,"reason":"2 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/node.js.yml:1","Warn: no topLevel permission defined: .github/workflows/npm-publish.yml:1","Warn: no topLevel permission defined: .github/workflows/tweet-release.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Pinned-Dependencies","score":4,"reason":"dependency not pinned by hash detected -- score normalized to 4","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/team-telnyx/telnyx-node/node.js.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/team-telnyx/telnyx-node/node.js.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/team-telnyx/telnyx-node/npm-publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/team-telnyx/telnyx-node/npm-publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/team-telnyx/telnyx-node/npm-publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/team-telnyx/telnyx-node/npm-publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:42: update your workflow using https://app.stepsecurity.io/secureworkflow/team-telnyx/telnyx-node/npm-publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:43: update your workflow using https://app.stepsecurity.io/secureworkflow/team-telnyx/telnyx-node/npm-publish.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/tweet-release.yml:9: update your workflow using https://app.stepsecurity.io/secureworkflow/team-telnyx/telnyx-node/tweet-release.yml/master?enable=pin","Warn: npmCommand not pinned by hash: .github/scripts/before_install.sh:1","Warn: npmCommand not pinned by hash: .github/scripts/before_install.sh:8","Info:   0 out of   8 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   3 out of   5 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"SAST","score":4,"reason":"SAST tool is not run on all commits -- score normalized to 4","details":["Warn: 12 commits out of 26 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":1,"reason":"9 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-7q7g-4xm8-89cq","Warn: Project is vulnerable to: GHSA-xffm-g5w8-qvg7","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-67mh-4wv8-2f99","Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-pppg-cpfq-h7wr","Warn: Project is vulnerable to: GHSA-hw8r-x6gr-5gjp","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-24T04:20:54.582Z","repository_id":37736187,"created_at":"2025-08-24T04:20:54.582Z","updated_at":"2025-08-24T04:20:54.582Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31515151,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T03:10:19.677Z","status":"ssl_error","status_checked_at":"2026-04-07T03:10:13.982Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest"],"created_at":"2024-07-30T19:01:26.354Z","updated_at":"2026-04-07T14:01:05.612Z","avatar_url":"https://github.com/team-telnyx.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","JavaScript"],"sub_categories":[],"readme":"# Telnyx TypeScript API Library\n\n\u003ca href=\"https://npmjs.org/package/telnyx\"\u003e\u003cimg alt=\"NPM version\" src=\"https://img.shields.io/npm/v/telnyx.svg?label=npm%20(stable)\" /\u003e\u003c/a\u003e ![npm bundle size](https://img.shields.io/bundlephobia/minzip/telnyx)\n\nThis library provides convenient access to the Telnyx REST API from server-side TypeScript or JavaScript.\n\nThe full API of this library can be found in [api.md](api.md).\n\nIt is generated with [Stainless](https://www.stainless.com/).\n\n## MCP Server\n\nUse the Telnyx MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=telnyx-mcp\u0026config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsInRlbG55eC1tY3AiXSwiZW52Ijp7IlRFTE5ZWF9BUElfS0VZIjoiTXkgQVBJIEtleSIsIlRFTE5ZWF9QVUJMSUNfS0VZIjoiTXkgUHVibGljIEtleSIsIlRFTE5ZWF9DTElFTlRfSUQiOiJNeSBDbGllbnQgSUQiLCJURUxOWVhfQ0xJRU5UX1NFQ1JFVCI6Ik15IENsaWVudCBTZWNyZXQifX0)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge\u0026logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22telnyx-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22telnyx-mcp%22%5D%2C%22env%22%3A%7B%22TELNYX_API_KEY%22%3A%22My%20API%20Key%22%2C%22TELNYX_PUBLIC_KEY%22%3A%22My%20Public%20Key%22%2C%22TELNYX_CLIENT_ID%22%3A%22My%20Client%20ID%22%2C%22TELNYX_CLIENT_SECRET%22%3A%22My%20Client%20Secret%22%7D%7D)\n\n\u003e Note: You may need to set environment variables in your MCP client.\n\n## Installation\n\n```sh\nnpm install telnyx\n```\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n\u003c!-- prettier-ignore --\u003e\n```js\nimport Telnyx from 'telnyx';\n\nconst client = new Telnyx({\n  apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.calls.dial({\n  connection_id: 'conn12345',\n  from: '+15557654321',\n  to: '+15551234567',\n  webhook_url: 'https://your-webhook.url/events',\n});\n\nconsole.log(response.data);\n```\n\n### Request \u0026 Response types\n\nThis library includes TypeScript definitions for all request params and response fields. You may import and use them like so:\n\n\u003c!-- prettier-ignore --\u003e\n```ts\nimport Telnyx from 'telnyx';\n\nconst client = new Telnyx({\n  apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted\n});\n\nconst params: Telnyx.NumberOrderCreateParams = {\n  phone_numbers: [{ phone_number: '+15558675309' }],\n};\nconst numberOrder: Telnyx.NumberOrderCreateResponse = await client.numberOrders.create(params);\n```\n\nDocumentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.\n\n## File uploads\n\nRequest parameters that correspond to file uploads can be passed in many different forms:\n\n- `File` (or an object with the same structure)\n- a `fetch` `Response` (or an object with the same structure)\n- an `fs.ReadStream`\n- the return value of our `toFile` helper\n\n```ts\nimport fs from 'fs';\nimport Telnyx, { toFile } from 'telnyx';\n\nconst client = new Telnyx();\n\n// If you have access to Node `fs` we recommend using `fs.createReadStream()`:\nawait client.ai.audio.transcribe({\n  model: 'distil-whisper/distil-large-v2',\n  file: fs.createReadStream('/path/to/file'),\n});\n\n// Or if you have the web `File` API you can pass a `File` instance:\nawait client.ai.audio.transcribe({\n  model: 'distil-whisper/distil-large-v2',\n  file: new File(['my bytes'], 'file'),\n});\n\n// You can also pass a `fetch` `Response`:\nawait client.ai.audio.transcribe({\n  model: 'distil-whisper/distil-large-v2',\n  file: await fetch('https://somesite/file'),\n});\n\n// Finally, if none of the above are convenient, you can use our `toFile` helper:\nawait client.ai.audio.transcribe({\n  model: 'distil-whisper/distil-large-v2',\n  file: await toFile(Buffer.from('my bytes'), 'file'),\n});\nawait client.ai.audio.transcribe({\n  model: 'distil-whisper/distil-large-v2',\n  file: await toFile(new Uint8Array([0, 1, 2]), 'file'),\n});\n```\n\n## Handling errors\n\nWhen the library is unable to connect to the API,\nor if the API returns a non-success status code (i.e., 4xx or 5xx response),\na subclass of `APIError` will be thrown:\n\n\u003c!-- prettier-ignore --\u003e\n```ts\nconst numberOrder = await client.numberOrders\n  .create({ phone_numbers: [{ phone_number: '+15558675309' }] })\n  .catch(async (err) =\u003e {\n    if (err instanceof Telnyx.APIError) {\n      console.log(err.status); // 400\n      console.log(err.name); // BadRequestError\n      console.log(err.headers); // {server: 'nginx', ...}\n    } else {\n      throw err;\n    }\n  });\n```\n\nError codes are as follows:\n\n| Status Code | Error Type                 |\n| ----------- | -------------------------- |\n| 400         | `BadRequestError`          |\n| 401         | `AuthenticationError`      |\n| 403         | `PermissionDeniedError`    |\n| 404         | `NotFoundError`            |\n| 422         | `UnprocessableEntityError` |\n| 429         | `RateLimitError`           |\n| \u003e=500       | `InternalServerError`      |\n| N/A         | `APIConnectionError`       |\n\n### Retries\n\nCertain errors will be automatically retried 2 times by default, with a short exponential backoff.\nConnection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,\n429 Rate Limit, and \u003e=500 Internal errors will all be retried by default.\n\nYou can use the `maxRetries` option to configure or disable this:\n\n\u003c!-- prettier-ignore --\u003e\n```js\n// Configure the default for all requests:\nconst client = new Telnyx({\n  maxRetries: 0, // default is 2\n});\n\n// Or, configure per-request:\nawait client.numberOrders.create({ phone_numbers: [{ phone_number: '+15558675309' }] }, {\n  maxRetries: 5,\n});\n```\n\n### Timeouts\n\nRequests time out after 1 minute by default. You can configure this with a `timeout` option:\n\n\u003c!-- prettier-ignore --\u003e\n```ts\n// Configure the default for all requests:\nconst client = new Telnyx({\n  timeout: 20 * 1000, // 20 seconds (default is 1 minute)\n});\n\n// Override per-request:\nawait client.numberOrders.create({ phone_numbers: [{ phone_number: '+15558675309' }] }, {\n  timeout: 5 * 1000,\n});\n```\n\nOn timeout, an `APIConnectionTimeoutError` is thrown.\n\nNote that requests which time out will be [retried twice by default](#retries).\n\n## Auto-pagination\n\nList methods in the Telnyx API are paginated.\nYou can use the `for await … of` syntax to iterate through items across all pages:\n\n```ts\nasync function fetchAllAccessIPAddressResponses(params) {\n  const allAccessIPAddressResponses = [];\n  // Automatically fetches more pages as needed.\n  for await (const accessIPAddressResponse of client.accessIPAddress.list({\n    'page[number]': 1,\n    'page[size]': 50,\n  })) {\n    allAccessIPAddressResponses.push(accessIPAddressResponse);\n  }\n  return allAccessIPAddressResponses;\n}\n```\n\nAlternatively, you can request a single page at a time:\n\n```ts\nlet page = await client.accessIPAddress.list({ 'page[number]': 1, 'page[size]': 50 });\nfor (const accessIPAddressResponse of page.data) {\n  console.log(accessIPAddressResponse);\n}\n\n// Convenience methods are provided for manually paginating:\nwhile (page.hasNextPage()) {\n  page = await page.getNextPage();\n  // ...\n}\n```\n\n## Real-time Speech-to-Text (WebSocket)\n\nStream audio for real-time transcription using WebSocket:\n\n```ts\nimport Telnyx from 'telnyx';\nimport { SpeechToTextWS } from 'telnyx/resources/speech-to-text';\nimport * as fs from 'fs';\n\nconst client = new Telnyx();\n\nconst stt = new SpeechToTextWS(client, {\n  transcription_engine: 'Telnyx',\n  language: 'en-US',\n  interim_results: true,\n});\n\n// Wait for connection\nawait stt.waitForOpen();\n\n// Listen for transcripts\nstt.on('transcript', (event) =\u003e {\n  console.log(`${event.is_final ? '✓' : '...'} ${event.transcript}`);\n});\n\nstt.on('error', (event) =\u003e {\n  console.error('Error:', event.error);\n});\n\n// Send audio data\nconst audioData = fs.readFileSync('audio.wav');\nstt.send(audioData);\n\n// Close when done\nstt.close();\n```\n\nSupported transcription engines: `Azure`, `Deepgram`, `Google`, `Telnyx`\n\n## Advanced Usage\n\n### Accessing raw Response data (e.g., headers)\n\nThe \"raw\" `Response` returned by `fetch()` can be accessed through the `.asResponse()` method on the `APIPromise` type that all methods return.\nThis method returns as soon as the headers for a successful response are received and does not consume the response body, so you are free to write custom parsing or streaming logic.\n\nYou can also use the `.withResponse()` method to get the raw `Response` along with the parsed data.\nUnlike `.asResponse()` this method consumes the body, returning once it is parsed.\n\n\u003c!-- prettier-ignore --\u003e\n```ts\nconst client = new Telnyx();\n\nconst response = await client.numberOrders\n  .create({ phone_numbers: [{ phone_number: '+15558675309' }] })\n  .asResponse();\nconsole.log(response.headers.get('X-My-Header'));\nconsole.log(response.statusText); // access the underlying Response object\n\nconst { data: numberOrder, response: raw } = await client.numberOrders\n  .create({ phone_numbers: [{ phone_number: '+15558675309' }] })\n  .withResponse();\nconsole.log(raw.headers.get('X-My-Header'));\nconsole.log(numberOrder.data);\n```\n\n### Logging\n\n\u003e [!IMPORTANT]\n\u003e All log messages are intended for debugging only. The format and content of log messages\n\u003e may change between releases.\n\n#### Log levels\n\nThe log level can be configured in two ways:\n\n1. Via the `TELNYX_LOG` environment variable\n2. Using the `logLevel` client option (overrides the environment variable if set)\n\n```ts\nimport Telnyx from 'telnyx';\n\nconst client = new Telnyx({\n  logLevel: 'debug', // Show all log messages\n});\n```\n\nAvailable log levels, from most to least verbose:\n\n- `'debug'` - Show debug messages, info, warnings, and errors\n- `'info'` - Show info messages, warnings, and errors\n- `'warn'` - Show warnings and errors (default)\n- `'error'` - Show only errors\n- `'off'` - Disable all logging\n\nAt the `'debug'` level, all HTTP requests and responses are logged, including headers and bodies.\nSome authentication-related headers are redacted, but sensitive data in request and response bodies\nmay still be visible.\n\n#### Custom logger\n\nBy default, this library logs to `globalThis.console`. You can also provide a custom logger.\nMost logging libraries are supported, including [pino](https://www.npmjs.com/package/pino), [winston](https://www.npmjs.com/package/winston), [bunyan](https://www.npmjs.com/package/bunyan), [consola](https://www.npmjs.com/package/consola), [signale](https://www.npmjs.com/package/signale), and [@std/log](https://jsr.io/@std/log). If your logger doesn't work, please open an issue.\n\nWhen providing a custom logger, the `logLevel` option still controls which messages are emitted, messages\nbelow the configured level will not be sent to your logger.\n\n```ts\nimport Telnyx from 'telnyx';\nimport pino from 'pino';\n\nconst logger = pino();\n\nconst client = new Telnyx({\n  logger: logger.child({ name: 'Telnyx' }),\n  logLevel: 'debug', // Send all messages to pino, allowing it to filter\n});\n```\n\n### Making custom/undocumented requests\n\nThis library is typed for convenient access to the documented API. If you need to access undocumented\nendpoints, params, or response properties, the library can still be used.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints, you can use `client.get`, `client.post`, and other HTTP verbs.\nOptions on the client, such as retries, will be respected when making these requests.\n\n```ts\nawait client.post('/some/path', {\n  body: { some_prop: 'foo' },\n  query: { some_query_arg: 'bar' },\n});\n```\n\n#### Undocumented request params\n\nTo make requests using undocumented parameters, you may use `// @ts-expect-error` on the undocumented\nparameter. This library doesn't validate at runtime that the request matches the type, so any extra values you\nsend will be sent as-is.\n\n```ts\nclient.calls.dial({\n  // ...\n  // @ts-expect-error baz is not yet public\n  baz: 'undocumented option',\n});\n```\n\nFor requests with the `GET` verb, any extra params will be in the query, all other requests will send the\nextra param in the body.\n\nIf you want to explicitly send an extra argument, you can do so with the `query`, `body`, and `headers` request\noptions.\n\n#### Undocumented response properties\n\nTo access undocumented response properties, you may access the response object with `// @ts-expect-error` on\nthe response object, or cast the response object to the requisite type. Like the request params, we do not\nvalidate or strip extra properties from the response from the API.\n\n### Customizing the fetch client\n\nBy default, this library expects a global `fetch` function is defined.\n\nIf you want to use a different `fetch` function, you can either polyfill the global:\n\n```ts\nimport fetch from 'my-fetch';\n\nglobalThis.fetch = fetch;\n```\n\nOr pass it to the client:\n\n```ts\nimport Telnyx from 'telnyx';\nimport fetch from 'my-fetch';\n\nconst client = new Telnyx({ fetch });\n```\n\n### Fetch options\n\nIf you want to set custom `fetch` options without overriding the `fetch` function, you can provide a `fetchOptions` object when instantiating the client or making a request. (Request-specific options override client options.)\n\n```ts\nimport Telnyx from 'telnyx';\n\nconst client = new Telnyx({\n  fetchOptions: {\n    // `RequestInit` options\n  },\n});\n```\n\n#### Configuring proxies\n\nTo modify proxy behavior, you can provide custom `fetchOptions` that add runtime-specific proxy\noptions to requests:\n\n\u003cimg src=\"https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/node.svg\" align=\"top\" width=\"18\" height=\"21\"\u003e **Node** \u003csup\u003e[[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)]\u003c/sup\u003e\n\n```ts\nimport Telnyx from 'telnyx';\nimport * as undici from 'undici';\n\nconst proxyAgent = new undici.ProxyAgent('http://localhost:8888');\nconst client = new Telnyx({\n  fetchOptions: {\n    dispatcher: proxyAgent,\n  },\n});\n```\n\n\u003cimg src=\"https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/bun.svg\" align=\"top\" width=\"18\" height=\"21\"\u003e **Bun** \u003csup\u003e[[docs](https://bun.sh/guides/http/proxy)]\u003c/sup\u003e\n\n```ts\nimport Telnyx from 'telnyx';\n\nconst client = new Telnyx({\n  fetchOptions: {\n    proxy: 'http://localhost:8888',\n  },\n});\n```\n\n\u003cimg src=\"https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/deno.svg\" align=\"top\" width=\"18\" height=\"21\"\u003e **Deno** \u003csup\u003e[[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)]\u003c/sup\u003e\n\n```ts\nimport Telnyx from 'npm:telnyx';\n\nconst httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });\nconst client = new Telnyx({\n  fetchOptions: {\n    client: httpClient,\n  },\n});\n```\n\n## Frequently Asked Questions\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes that only affect static types, without breaking runtime behavior.\n2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n3. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/team-telnyx/telnyx-node/issues) with questions, bugs, or suggestions.\n\n## Requirements\n\nTypeScript \u003e= 4.9 is supported.\n\nThe following runtimes are supported:\n\n- Web browsers (Up-to-date Chrome, Firefox, Safari, Edge, and more)\n- Node.js 20 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.\n- Deno v1.28.0 or higher.\n- Bun 1.0 or later.\n- Cloudflare Workers.\n- Vercel Edge Runtime.\n- Jest 28 or greater with the `\"node\"` environment (`\"jsdom\"` is not supported at this time).\n- Nitro v2.6 or greater.\n\nNote that React Native is not supported at this time.\n\nIf you are interested in other runtime environments, please open or upvote an issue on GitHub.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteam-telnyx%2Ftelnyx-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fteam-telnyx%2Ftelnyx-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteam-telnyx%2Ftelnyx-node/lists"}