{"_id":"@calljacob/nice-cxone-api","name":"@calljacob/nice-cxone-api","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@calljacob/nice-cxone-api","version":"1.0.0","description":"Comprehensive TypeScript API client for NICE CXone / inContact APIs","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"build":"tsup","generate":"node scripts/generate-client.js","check-types":"tsc --noEmit","test":"vitest run"},"keywords":["nice","cxone","niceincontact","incontact","api","sdk","typescript","calljacob","contact-center"],"author":{"name":"Call Jacob"},"license":"MIT","publishConfig":{"access":"public"},"devDependencies":{"@types/node":"^20.11.0","tsup":"^8.0.1","typescript":"^5.3.3","vitest":"^1.2.1"},"gitHead":"28a1bd4b4a5345000b39171d40d0da1bc4c09ae6","_id":"@calljacob/nice-cxone-api@1.0.0","_nodeVersion":"24.18.0","_npmVersion":"12.0.1","dist":{"integrity":"sha512-+bSbkb1xh59ta1+U6O8We3TvwlxwdCT/MH3CkHpc7mTZ7c/qnBuGm7VoIhOg+GprvnFBOnIFCCDY0oZcu08W/A==","shasum":"e58044a7b2459c471f1f6e71656ba9c811b69dd2","tarball":"https://registry.npmjs.org/@calljacob/nice-cxone-api/-/nice-cxone-api-1.0.0.tgz","fileCount":9,"unpackedSize":2917631,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDfxaDDqyjugwGHjaF4OFSBrzKmN2cESvmh2o+/fX6JAQIhALQBtouKPjHMbZYpkGX6LPju5e/sqF/pV9vBPasFhff1"}]},"_npmUser":{"name":"bhubbard","email":"bkhubbard@gmail.com"},"directories":{},"maintainers":[{"name":"bhubbard","email":"bkhubbard@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/nice-cxone-api_1.0.0_1785171170850_0.9271723008517452"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-27T16:52:50.691Z","1.0.0":"2026-07-27T16:52:51.045Z","modified":"2026-07-27T16:52:51.226Z"},"maintainers":[{"name":"bhubbard","email":"bkhubbard@gmail.com"}],"description":"Comprehensive TypeScript API client for NICE CXone / inContact APIs","keywords":["nice","cxone","niceincontact","incontact","api","sdk","typescript","calljacob","contact-center"],"author":{"name":"Call Jacob"},"license":"MIT","readme":"# @calljacob/nice-cxone-api\n\n[![npm version](https://img.shields.io/npm/v/@calljacob/nice-cxone-api.svg)](https://www.npmjs.com/package/@calljacob/nice-cxone-api)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![TypeScript](https://img.shields.io/badge/TypeScript-5.0%2B-blue.svg)](https://www.typescriptlang.org/)\n\nComprehensive, strongly-typed TypeScript API client library for **NICE CXone / inContact** APIs, published by [Call Jacob](https://github.com/calljacob).\n\nGenerated directly from official OpenAPI 3.0.3 specifications published on [developer.niceincontact.com](https://developer.niceincontact.com/API/AdminAPI), covering **73 API specifications**, **501 endpoints**, and **18 API domains**.\n\n---\n\n## Comparison: `@calljacob/nice-cxone-api` vs Official `@nice-devone/*` Packages\n\nNICE publishes frontend client SDKs under the `@nice-devone/*` npm scope (such as `@nice-devone/agent-sdk`, `@nice-devone/voice-sdk`, `@nice-devone/ui-controls`). Here is how `@calljacob/nice-cxone-api` compares and complements them:\n\n| Feature / Goal | `@calljacob/nice-cxone-api` (This Package) | `@nice-devone/*` Official SDKs |\n| :--- | :--- | :--- |\n| **Primary Use Case** | Server-side & Node.js backend integration, administrative automation, reporting, user provisioning, pipeline tooling | Custom browser-based Agent applications, softphone UI widgets, CXone Agent integrations |\n| **Target Environment** | Node.js (18+), Serverless (AWS Lambda, Cloudflare Workers), Bun, Deno, and Browser | Web Browsers (requires DOM / WebRTC / WebSockets) |\n| **API Coverage** | **All 18 REST Domains** (Admin, UserHub, Reporting, Skills, Address Book, Recording, Privacy, WFM, etc.) | Frontend Agent & Voice/Chat event SDKs |\n| **Dependencies** | **Zero runtime dependencies** (built on native `fetch`) | Browser UI controls, i18n, WebRTC wrappers |\n\n---\n\n## Features\n\n- ⚡ **Complete API Coverage**: Supports all 18 NICE CXone / inContact API domains (Admin, Agent, Auth, Reporting, UserHub, Digital Engagement, Recording, WFM, etc.).\n- 🔒 **Strong TypeScript Types**: Full autocompletion and type-safety for request payloads, path/query parameters, and response models across all 501 endpoints.\n- 🔑 **Authentication Handling**: OAuth2 bearer token support with static token strings or dynamic async token resolution.\n- 🔍 **Correlation ID Tracing**: Automatic `CorrelationId` header injection and extraction for end-to-end API tracing.\n- 📦 **Dual Bundle (ESM + CommonJS)**: Ships native ESM (`dist/index.mjs`) and CJS (`dist/index.js`) modules with `.d.ts` declaration files.\n- 🌐 **Zero Runtime Dependencies**: Uses native `fetch` with customizable transport for Node.js (18+), Bun, Deno, or browser environments.\n\n---\n\n## Installation\n\n```bash\nnpm install @calljacob/nice-cxone-api\n```\n\nor with yarn / pnpm:\n\n```bash\nyarn add @calljacob/nice-cxone-api\n# or\npnpm add @calljacob/nice-cxone-api\n```\n\n---\n\n## Quickstart\n\n```typescript\nimport { NiceCXoneClient } from \"@calljacob/nice-cxone-api\";\n\n// Initialize client with access token and optional base URL\nconst client = new NiceCXoneClient({\n  baseUrl: \"https://api-na1.niceincontact.com/inContactAPI/services/v3.0\",\n  accessToken: \"YOUR_OAUTH_ACCESS_TOKEN\",\n  correlationId: \"my-app-session-123\", // Optional correlation ID\n});\n\n// Fetch agents list\nasync function run() {\n  try {\n    const response = await client.admin.agents.getAgents({\n      query: { top: \"10\", skip: \"0\", isActive: true }\n    });\n\n    console.log(`Found ${response.totalRecords} active agents:`);\n    response.agents?.forEach((agent) => {\n      console.log(`- ${agent.firstName} ${agent.lastName} (ID: ${agent.agentId})`);\n    });\n  } catch (error) {\n    console.error(\"API call failed:\", error);\n  }\n}\n\nrun();\n```\n\n---\n\n## Domain Overview\n\nAll 73 API services are grouped under clean domain namespaces on `NiceCXoneClient`:\n\n| Domain | Property | Description |\n| :--- | :--- | :--- |\n| **Admin** | `client.admin` | Agents, Skills, Address Books, Groups, Lists, Commitments, Stations, Unavailable Codes, Workflow Data, Script Schedules |\n| **Agent** | `client.agent` | Phone Calls, Sessions, Supervisor, Chat Requests, Emails, Scheduled Callbacks, Voicemails, Work Items, Personal Connection |\n| **Authentication** | `client.auth` | Authenticate, Global Authentication, Integrations, Universal Application |\n| **Patron** | `client.patron` | Callbacks, Chat Requests, Work Items |\n| **Real-Time Data** | `client.realtime` | Real-time agent & contact status metrics |\n| **Reporting** | `client.reporting` | Reporting & Data Lake APIs |\n| **UserHub** | `client.userhub` | User Management, SCIM, Authorization, Billing, Access Keys, Desktop Profiles, Documents, Divisions |\n| **Digital Engagement** | `client.digitalEngagement` | Channels, Messages, Contacts, Customers, Tags, Custom Fields, Routing Queues, Threads |\n| **Recording** | `client.recording` | Interaction Recordings, Screen Recording, Recording On-Demand, Recording Status |\n| **Media Playback** | `client.mediaPlayback` | Media Playback & Download Services |\n| **WFM** | `client.wfm` | Workforce Management Schedule Export, Import Allotment, Summary |\n| **Data Extraction** | `client.dataExtraction` | Data Extraction APIs |\n| **Business Data** | `client.businessData` | Custom Business Data APIs |\n| **Interaction Analytics** | `client.interactionAnalytics` | Speech & Interaction Analytics |\n| **Privacy** | `client.privacy` | GDPR & Data Privacy Compliance |\n| **Data Policy** | `client.dataPolicy` | Policy Instance Management |\n| **Voice Biometrics** | `client.voiceBiometrics` | Voice Biometric Hub External APIs |\n| **Feedback Management** | `client.feedbackManagement` | Customer Feedback & Survey APIs |\n\n---\n\n## Detailed Usage Examples\n\n### Managing Agents & Skills (Admin API)\n\n```typescript\n// Create a new Agent\nconst newAgent = await client.admin.agents.operationsAgentsPostAgents({\n  agents: [\n    {\n      firstName: \"John\",\n      lastName: \"Smith\",\n      userName: \"john.smith@company.com\",\n      emailAddress: \"john.smith@company.com\",\n      teamId: \"12345\",\n      profileId: 1,\n      country: \"USA\",\n      city: \"Salt Lake City\",\n      timeZone: \"America/Denver\",\n    }\n  ]\n});\n\n// Get Agent by ID\nconst agent = await client.admin.agents.operationsAgentsGetAgentsId(\"1001\");\n\n// Fetch assigned skills\nconst skills = await client.admin.skills.getSkills();\n```\n\n### Authentication & Token Refresh\n\nYou can supply an async callback for `accessToken` to automatically handle token expiration and refresh:\n\n```typescript\nasync function getValidAccessToken(): Promise<string> {\n  // Fetch or refresh token logic\n  const token = await myAuthService.getToken();\n  return token;\n}\n\nconst client = new NiceCXoneClient({\n  accessToken: getValidAccessToken,\n});\n```\n\n### Error Handling\n\nThe client throws `NiceCXoneAPIError` for non-2xx HTTP responses, exposing HTTP status code, status text, raw error payload, and `correlationId`:\n\n```typescript\nimport { NiceCXoneAPIError } from \"@calljacob/nice-cxone-api\";\n\ntry {\n  await client.admin.agents.operationsAgentsGetAgentsId(\"invalid-id\");\n} catch (error) {\n  if (error instanceof NiceCXoneAPIError) {\n    console.error(`HTTP Status: ${error.status} (${error.statusText})`);\n    console.error(`Correlation ID: ${error.correlationId}`);\n    console.error(`Error details:`, error.errorPayload);\n  } else {\n    console.error(\"Unexpected error:\", error);\n  }\n}\n```\n\n---\n\n## Development & Building\n\n```bash\n# Clone repository\ngit clone https://github.com/calljacob/nice-cxone-api.git\ncd nice-cxone-api\n\n# Install dependencies\nnpm install\n\n# Run type check\nnpm run check-types\n\n# Run unit tests\nnpm test\n\n# Build ESM & CJS bundles\nnpm run build\n```\n\n---\n\n## License\n\n[MIT License](LICENSE)\n","readmeFilename":"README.md","_rev":"1-1f569ce6e0b11ca907c587935e2b64c4"}