Initialization

📘

Latest version: 1.0.1

Overview

Estimated integration time: 10 minutes.

To add Web Chat, upload the SDK JavaScript and CSS files to your website and provide your public channelKey. The widget adds itself to the page; no HTML container or manual Socket.IO setup is required.

ValueRequiredDescription
channelKeyYesPublic, unique channel or project identifier.
baseUrlNoWeb Chat environment URL. Defaults to https://eu1.chat-v2.indigitall.com.
contactCodeNoStable contact ID. If omitted, the SDK creates a UUID for the browser-tab session.
contactNameNoContact display name.
⚠️

Security

channelKey is public. Never include a serverKey, private token, or server credential in browser code.

  • download .zip and extract its two files to upload them to the main folder of your website.

🤖 Click to expand AI Integration Prompt (ChatGPT / Copilot / Claude)

Copy and paste this prompt into your AI assistant to accelerate your integration:

1. Upload the SDK files

Upload these files to a public folder, such as /indigitall/:

  • web-chat-sdk-v2.min.js
  • web-chat-sdk-v2.css

Use FTP, a hosting control panel, a CDN, or your normal deployment process.

2. Add Web Chat to your page

Paste this immediately before the closing </body> tag:

<link rel="stylesheet" href="/indigitall/web-chat-sdk-v2.css" />
<script
  src="/indigitall/web-chat-sdk-v2.min.js"
  charset="utf-8"
  onload="WebChat.init({ channelKey: 'YOUR_CHANNEL_KEY' })"
></script>

Replace YOUR_CHANNEL_KEY with your public channel key. Without baseUrl, the SDK uses https://eu1.chat-v2.indigitall.com.

Use another environment by providing its URL:

WebChat.init({
  baseUrl: 'https://YOUR-ENVIRONMENT.chat-v2.indigitall.com',
  channelKey: 'YOUR_CHANNEL_KEY',
})
📘

WebChat.init() automatically creates the floating launcher and chat panel.

Contact identification

Automatic session contact

When no user ID is available, omit contactCode:

WebChat.init({ channelKey: 'YOUR_CHANNEL_KEY' })

The SDK generates a UUID and saves it in sessionStorage. It is reused while the browser-tab session is active, then replaced after the tab or browser session ends.

Your own contact identifier

For identified users, pass a stable, unique value:

WebChat.init({
  channelKey: 'YOUR_CHANNEL_KEY',
  contactCode: 'user-12345',
  contactName: 'Ada Lovelace',
})

An explicit contactCode replaces the value in sessionStorage; later initializations in the same tab reuse it when no code is passed.

⚠️

Use the same contactCode for the same user. Never use passwords, access tokens, or private keys.

Recommended JavaScript setup

<link rel="stylesheet" href="/indigitall/web-chat-sdk-v2.css" />
<script>
  const script = document.createElement('script')
  script.src = '/indigitall/web-chat-sdk-v2.min.js'
  script.onload = () => {
    window.supportChat = WebChat.init({
      channelKey: 'YOUR_CHANNEL_KEY',
      contactCode: window.currentUser?.id,
      contactName: window.currentUser?.name,
      language: 'en',
    })
  }
  script.onerror = () => console.error('Could not load Indigitall Web Chat')
  document.body.appendChild(script)
</script>

Reinitialization and removal

Only one Web Chat instance can be active. Calling WebChat.init() again automatically destroys and replaces the prior instance.

The returned instance has destroy(). Call it on logout, user changes, or when the containing view is removed:

window.supportChat?.destroy()

CSP with nonce

To keep the full normal UI under a CSP that requires a nonce for dynamically created style elements, configure the response and provide the same server-generated nonce to the SDK:

<script nonce="SERVER_GENERATED_NONCE">
  WebChat.init({
    channelKey: 'YOUR_CHANNEL_KEY',
    cspStrict: { nonce: 'SERVER_GENERATED_NONCE' },
  })
</script>

The response header must include style-src 'self' 'nonce-SERVER_GENERATED_NONCE'. The nonce is generated once per response by the server; never generate it in browser code. This lightweight mode retains normal customization and functionality, but it does not support style-src-attr 'none' because a nonce does not permit style attributes.

Troubleshooting

DOWNLOAD
IssueRecommended check
Launcher is not visibleCheck JavaScript/CSS URLs and browser-console loading errors.
Chat cannot connectCheck channelKey, configured baseUrl, CORS, and the WebSocket/polling proxy.
A new contact is created on every visitPass a stable contactCode; automatic UUIDs only last for the browser-tab session.
Authorization errorCheck that channelKey belongs to the intended channel and any provided contactCode is valid.

Next step

See DOC_CUSTOMIZATION.md for all WebChat.init() customization options.