Developers
Web Chat Widget SDK
Integrate the Qwetty web chat widget into your website for real-time customer communication.
Installation
Section titled “Installation”Add the widget script to your website. Provide data-organization-id or data-channel-id (at least one is required):
<script src="https://app.qwetty.com/webchat/embed.js" data-organization-id="YOUR_ORGANIZATION_ID" data-channel-id="YOUR_CHANNEL_ID"></script>Configuration options
Section titled “Configuration options”Pass configuration via data- attributes on the script tag:
| Attribute | Description | Default |
|---|---|---|
data-organization-id |
Your organization ID (this or data-channel-id required) |
— |
data-channel-id |
Your web chat channel ID (this or data-organization-id required) |
— |
data-position |
Widget position: bottom-right or bottom-left |
bottom-right |
data-primary-color |
Primary color (hex) | #10b981 |
data-widget-title |
Chat window title | "Chat with us" |
data-widget-subtitle |
Subtitle below the title | "We're here to help!" |
data-require-form-before-chat |
Require a pre-chat form ("true"/"false") |
false |
data-popup-message |
Proactive popup message | — |
data-popup-delay |
Delay before the popup (seconds) | 5 |
data-language |
Widget language: en or id. Takes precedence over the channel’s language |
Channel language, else en |
data-api-url |
Override the API base URL | — |
With data-channel-id, the widget loads the design saved on the channel in Qwetty, and those settings (position, color, title, subtitle, pre-chat form, popup message and delay) take precedence over the matching data- attributes. With only data-organization-id, the widget connects to one of the organization’s web chat channels and uses the attributes and defaults above; use data-channel-id when you have more than one web chat channel.
How it works
Section titled “How it works”- The widget loads and displays a chat button on your page
- When a visitor clicks, a chat window opens
- If “require form before chat” is enabled, the visitor fills in their details first
- A chat session starts for the visitor
- Messages are exchanged in real-time via WebSocket
- Your team sees the conversation in the Qwetty inbox
Guest sessions
Section titled “Guest sessions”Web chat visitors don’t need to log in. Each visitor gets a guest session tied to the channel. If the visitor provides their name, email, or phone number (via the pre-chat form), a contact is created in your directory.
Framework examples
Section titled “Framework examples”import { useEffect } from 'react';
function QwettyChat({ channelId }) { useEffect(() => { const script = document.createElement('script'); script.src = 'https://app.qwetty.com/webchat/embed.js'; script.dataset.channelId = channelId; document.body.appendChild(script); return () => document.body.removeChild(script); }, [channelId]);
return null;}Next.js
Section titled “Next.js”import Script from 'next/script';
export default function Layout({ children }) { return ( <> {children} <Script src="https://app.qwetty.com/webchat/embed.js" data-channel-id="YOUR_CHANNEL_ID" strategy="lazyOnload" /> </> );}Next steps
Section titled “Next steps”- Web Chat Widget — Channel setup and design configuration
- Channel Configuration — Advanced widget settings