SDK reference version: 1.0.0
This document describes what a client application needs to integrate the SDK. You do not need to install the SDK's internal dependencies individually.
Overview
| Integration method | Dependencies the client must provide | When to use it |
|---|---|---|
| Embedded JavaScript | No npm dependencies | HTML sites, CMSs, ecommerce sites, or applications without React. |
| React package | web-chat-sdk-v2, react, and react-dom | React applications with a build process. |
Both methods require a valid public channelKey and connectivity to the chat environment. A channelKey is not a server credential: never expose a serverKey, private token, or backend secret.
Option A: embedded JavaScript integration
This option does not require Node.js, npm, React, React DOM, or a manual Socket.IO installation.
The client must publish or serve these two SDK-generated assets:
web-chat-sdk-v2.min.jsweb-chat-sdk-v2.min.css
Load them on the page in this order:
- The stylesheet.
- The JavaScript bundle.
- A call to
WebChat.init(...)after the bundle has loaded.
The browser bundle contains everything needed to run the widget, including the Socket.IO client and its UI dependencies. Therefore, do not add an additional <script> for socket.io-client, React, or React DOM.
See DOC_INITIALIZATION.md for the inclusion example and initialization parameters.
Browser requirements
The integrated site must run in a modern browser with support for:
- Standard DOM and modern CSS.
WebSocketand/or HTTP polling, which Socket.IO uses.sessionStorage, which stores the temporary contact identifier whencontactCodeis not provided.
ES modules are not required for the distributed global bundle.
If site policies block external resources, the JavaScript, CSS, and custom assets (such as icons) must be hosted on a domain allowed by the site's Content Security Policy (CSP).
Option B: React package integration
Required dependencies
Install the SDK together with React and React DOM if the application does not already include them:
npm install web-chat-sdk-v2 react react-domReact and React DOM are peer dependencies: the client project controls their versions to avoid multiple React copies in the application. The SDK supports these versions:
| Package | Compatible version |
|---|---|
react | >=18.2.0 <20 |
react-dom | >=18.2.0 <20 |
Then import the component and its styles:
import { ChatWidget } from 'web-chat-sdk-v2'
import 'web-chat-sdk-v2/styles.css'The Socket.IO client is declared as an SDK production dependency. In a standard npm integration, it is not necessary to add socket.io-client to the consuming application's package.json unless the application uses it directly for other connections.
Dependencies included by the SDK
These dependencies are installed and resolved automatically when the package is installed. They do not require client configuration:
| Dependency | SDK purpose |
|---|---|
socket.io-client v4 | Connection, authentication, real-time messaging, and reconnection. |
i18next and react-i18next | User-interface language handling and bundled translations. |
@tanstack/react-virtual | Efficient rendering of message lists. |
@indigitall/indigitall-react-ui | Complementary chat UI elements. |
Development tools such as Vite, TypeScript, ESLint, Vitest, and Testing Library are not runtime dependencies. They are only required to develop or modify the SDK, not to use it.
Connectivity and platform configuration
In addition to the packages or files above, the integration needs the following:
| Item | Requirement |
|---|---|
channelKey | Required. Public chat channel identifier supplied for the integration. |
baseUrl | Optional. Web Chat environment URL; defaults to https://eu1.chat-v2.indigitall.com when omitted. |
| Network access | The browser must be able to reach baseUrl over HTTPS, secure WebSocket (wss), or the Socket.IO fallback transport. |
| CORS/proxy | Any proxy, WAF, or CSP must allow requests and WebSocket/polling connections to the chat environment. |
contactCode | Optional and recommended for authenticated users. It must be stable and must not contain secrets. |
To prevent security and connectivity issues:
- Serve the application, SDK assets, and chat environment over HTTPS in production.
- Allow
connect-srcto the domain configured inbaseUrlin the site's CSP. - When using a strict CSP, also allow the origin serving the JavaScript, CSS, and configured icons.
cspStrict: { nonce: '…' }forwards the raw response nonce to theThemeProviderin@indigitall/indigitall-react-ui(version 4.28.0 or later), so its Emotion-generated style elements can satisfy a nonce-basedstyle-src. It does not authorize inlinestyleattributes; do not use this mode withstyle-src-attr 'none'.- Do not configure or expose private keys in code delivered to the browser.
Information the integrator must provide
Before starting the integration, the client should have:
- The public
channelKeyfor the relevant channel. - The environment URL (
baseUrl) if the default endpoint will not be used. - An identification choice: a stable client-owned
contactCodefor known users, or a temporary session identifier for anonymous visitors. - Approved URLs for SDK assets and, when applicable, customized icons or styles.
- The CSP, CORS, proxy, or firewall rules required to communicate with the chat environment.
Quick validation
An integration is ready when these checks pass:
- The SDK CSS and JavaScript load without browser-console errors.
- The floating launcher appears.
WebChat.init({ channelKey: '…' })orChatWidgetis initialized only once.- The connection reaches the authenticated state and can send a text message.
- On sign-out or when the containing view is removed, the JavaScript integration calls
destroy()or the React component is unmounted.
ee DOC_INITIALIZATION.md for the JavaScript implementation and DOC_CUSTOMIZATION.md for appearance and behavior options.
