{"id":15720,"library":"nexmo-client","title":"Vonage Client SDK (Legacy Nexmo Client)","description":"The `nexmo-client` package provides a JavaScript SDK for integrating programmable conversation features, including in-app messaging and voice, into web and Node.js applications. While the package name is `nexmo-client`, it is functionally the predecessor to the Vonage Client SDK. The current stable version, 9.6.1, was last published over a year ago (as of 2026), indicating it is in a deprecated or maintenance state, with active development having shifted to the official `@vonage/client-sdk` package. It offers capabilities like offline message synchronization, push notifications, rich text and image support for messaging, and advanced in-app voice features such as group calling and user controls. Its primary differentiators lie in enabling robust real-time communication within applications through the Vonage API platform.","status":"deprecated","version":"9.6.1","language":"javascript","source_language":"en","source_url":"https://github.com/Nexmo/conversation-js-sdk","tags":["javascript","nexmo","webrtc","conversation","sdk","ip-messaging","rtc","communication","audio"],"install":[{"cmd":"npm install nexmo-client","lang":"bash","label":"npm"},{"cmd":"yarn add nexmo-client","lang":"bash","label":"yarn"},{"cmd":"pnpm add nexmo-client","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The primary class is typically a default export in module environments.","wrong":"import { NexmoClient } from 'nexmo-client';","symbol":"NexmoClient","correct":"import NexmoClient from 'nexmo-client';"},{"note":"Standard CommonJS import pattern for Node.js environments.","symbol":"NexmoClient (CommonJS)","correct":"const NexmoClient = require('nexmo-client');"},{"note":"When included via a script tag, `NexmoClient` becomes a global variable. Module imports are for bundlers/Node.js.","wrong":"import NexmoClient from 'nexmo-client';","symbol":"NexmoClient (Browser Global)","correct":"<!-- In HTML --> <script src=\"node_modules/nexmo-client/dist/nexmoClient.min.js\"></script> // Then access `NexmoClient` directly"}],"quickstart":{"code":"import NexmoClient from 'nexmo-client';\n\n// Obtain a JWT from your backend for client authentication.\n// In a production environment, this should never be hardcoded.\nconst JWT = process.env.VONAGE_CLIENT_SDK_JWT ?? 'YOUR_GENERATED_JWT_HERE';\n\nasync function initializeAndConnect() {\n  if (!JWT || JWT === 'YOUR_GENERATED_JWT_HERE') {\n    console.error('Please provide a valid JWT for authentication.');\n    return;\n  }\n\n  try {\n    const client = new NexmoClient({ debug: true });\n\n    client.on('connection:status', (status) => {\n      console.log(`Connection status changed: ${status}`);\n      if (status === 'disconnected') {\n        console.warn('Client disconnected. Check network or JWT validity.');\n      }\n    });\n\n    console.log('Attempting to log in with JWT...');\n    await client.login(JWT);\n    console.log('Successfully logged in to Vonage client SDK.');\n\n    // You can now access client features, e.g., get conversations, make calls.\n    const conversations = await client.getConversations();\n    console.log(`Found ${conversations.items.length} conversations.`);\n\n  } catch (error) {\n    console.error('Failed to initialize or login:', error.message, error);\n  }\n}\n\ninitializeAndConnect();","lang":"typescript","description":"This quickstart demonstrates how to install the `nexmo-client` package, import the `NexmoClient` class, and perform a basic login using a JWT. It includes error handling and logs connection status, fetching existing conversations as an example of post-login interaction."},"warnings":[{"fix":"Migrate your application to use the `@vonage/client-sdk` package. The API might have subtle differences, so review the `@vonage/client-sdk` documentation for migration guidance.","message":"This `nexmo-client` package is deprecated. While it may still function, active development, new features, and ongoing maintenance have moved to the official `@vonage/client-sdk` package. Projects should migrate to the new package for continued support and access to the latest capabilities.","severity":"breaking","affected_versions":">=9.0.0"},{"fix":"When seeking support or documentation, search for 'Vonage Client SDK'. Be aware that examples for the newer `@vonage/client-sdk` might not be directly compatible without adjustments.","message":"The package name `nexmo-client` refers to an SDK now branded as 'Vonage Client SDK'. This can cause confusion when searching for documentation or examples, which are predominantly under the 'Vonage' brand. Ensure you are referencing documentation specific to the older `nexmo-client` or consider migrating.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Read the `LICENSE` file within the package or on the GitHub repository carefully to understand the legal implications and obligations before using in commercial or proprietary projects.","message":"The SDK is licensed under a custom 'Vonage Client SDK License Agreement'. This is not a standard open-source license (e.g., MIT, Apache). Developers must review and comply with its specific terms and conditions, especially regarding distribution and modification.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Always generate JWTs securely on your server-side application using your Vonage API key and secret. Pass the generated JWT to your client-side application for use with `client.login(JWT)`.","message":"Authentication requires a JSON Web Token (JWT) signed by your backend. Exposing the private key or generating the JWT on the client-side is a severe security vulnerability. The client-side SDK only consumes the JWT.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-21T00:00:00.000Z","next_check":"2026-07-20T00:00:00.000Z","problems":[{"fix":"For browser usage via script tag, ensure `nexmoClient.min.js` is loaded before your script. For module environments (Node.js, bundlers), use `import NexmoClient from 'nexmo-client';` or `const NexmoClient = require('nexmo-client');`.","cause":"The `NexmoClient` object was not correctly imported or made available in the current scope. This often happens in browser environments if the script tag isn't loaded, or in module environments if `require` or `import` fails.","error":"NexmoClient is not defined"},{"fix":"Verify that your backend service is generating a valid, unexpired JWT with the correct Vonage application ID, private key, and standard claims (e.g., `exp`, `jti`, `iat`, `application_id`, `sub`, `acl`). Use JWT debuggers to inspect the token payload.","cause":"The JSON Web Token (JWT) provided to `client.login()` is either malformed, expired, incorrectly signed, or does not contain the necessary claims (e.g., `acl`, `sub`).","error":"Failed to authenticate: Invalid JWT"},{"fix":"Ensure you are using the correct import syntax for your environment: `import NexmoClient from 'nexmo-client';` for ESM, or `const NexmoClient = require('nexmo-client');` for CommonJS. Avoid using named imports like `import { NexmoClient }` as the class is likely a default export.","cause":"This typically occurs when the `require()` or `import` statement for `nexmo-client` does not yield the expected constructor function, often due to incorrect export handling or a mismatch between CommonJS and ESM imports.","error":"TypeError: NexmoClient is not a constructor"}],"ecosystem":"npm"}