Integration Overview
Quadrillian integration involves two main concepts: understanding the user flow and implementing the setup.
How the Chat Flow Works
Here's what happens when a visitor interacts with chat on your website:
1. Visitor Clicks Chat
A visitor on your website clicks the chat button or widget to start a conversation.
2. Your Server Generates JWT
Your server creates a JWT token containing the visitor's user information and your workspace ID, signed with your workspace secret.
3. Browser Authenticates with Quadrillian
The visitor's browser receives the JWT and passes it to Quadrillian. Quadrillian verifies the signature and automatically provisions the user if they don't exist.
4. Chat Access Granted
The visitor can now access chat functionality within your workspace, with full workspace isolation and security.
Implementation Steps
To implement this flow, you need to:
1. Set Up Backend JWT Generation
Get your workspace secret from Quadrillian, then build server-side endpoints to generate JWT tokens containing user information.
2. Add Quadrillian Widget to Your Website
Include the Quadrillian widget on your website using simple HTML attributes - no complex JavaScript required.
Step-by-Step Setup
Let's get you started with Quadrillian integration using the secure JWT-based authentication flow. We'll build up from the basics to a working chat system.
Step 1: Set Up Backend JWT Generation
First, you'll need to set up server-side endpoints to generate JWT tokens. User provisioning happens automatically when users authenticate. Here's a minimal Node.js/Express example:
📁 BACKEND CODE (Your Server)
File: server.js or your main server file
/api/chat/auth endpoint MUST be protected by your existing authentication middleware. Never accept user credentials from the request body - always get them from the authenticated session. This prevents user impersonation attacks.
Step 2: Add Quadrillian Widget to Your Website
Add the Quadrillian widget to your website using simple HTML attributes. The widget handles authentication automatically:
🌐 FRONTEND CODE (Your Website)
File: Your HTML file (e.g., index.html) - Choose your integration pattern:
Pattern 1: Professional API (Recommended)
🔐 For Authenticated Users
For authenticated users, use the professional API to get fresh JWT tokens from your backend:
Pattern 1: Professional API with JWT
Pattern 2: Commands Pattern (Auto-Execute)
- User clicks chat button: Triggers
loadChatWidget()function - Frontend calls backend: →
fetch('/api/chat/auth', {credentials: 'include'}) - Backend validates session: Uses existing auth middleware to verify user identity
- Backend generates JWT: and returns it to frontend
- Frontend loads widget: with JWT token in data attribute
- Widget authenticates automatically: JWT is verified and user is provisioned
🚀 Ready to Get Started?
Use our Embed Code Generator to get your custom integration code instantly. Just enter your workspace details and copy the generated code to your website!
Generate My Embed CodeNext Steps
Now that you have basic chat working, you can:
- Create topics programmatically using the API Reference
- Customize the chat appearance and behavior
- Add file upload capabilities
- Integrate with your existing user management system
- Set up automated responses and AI integration
Check out the API Reference and Topic Strategies for more advanced use cases.
Troubleshooting
Common Issues
Widget Not Appearing
Possible causes:
- Missing required data attributes
- Invalid workspace ID or topic external key
- Network connectivity issues
Solutions:
- Ensure you've provided
workspace_idin yourcreateChatWindow()call - If using external key, make sure
topic_external_keyis provided along withworkspace_id - Check browser console for error messages
JWT Authentication Failing
Possible causes:
- Invalid JWT token
- Expired JWT token
- Wrong workspace secret
Solutions:
- Verify JWT token is valid and not expired
- Check that workspace secret matches the one used to sign the JWT
- Ensure JWT contains required fields:
workspace_id,external_user_id,exp
File Upload Issues
Possible causes:
- File size exceeds limit
- File type not allowed
- Virus scan failure
Solutions:
- Check file size (max 10MB)
- Verify file type is allowed
- Try uploading a different file
Debug Mode
Open your browser's developer console to see detailed logging from the Quadrillian SDK. The widget automatically logs important events and errors.
Support
Need help? Contact our integration team:
- Email: integrations@quadrillian.com
- Documentation: quadrillian.com/docs
- Status Page: status.quadrillian.com