Prerequisites
Before setting up webchat, ensure you have:- An active Apten account
- A website where you can add JavaScript code (access to edit HTML)
- At least one customer profile configured for webchat conversations
Step 1: Create an API Key
API keys authenticate your website, hold your webchat configuration, and protect against unauthorized use. In Settings > Webchat > API Keys, click Create API Key and configure: Allowed Domains (required) — Domains authorized to use this key.- Specific domain:
example.com - All subdomains:
*.example.com - Add multiple domains to one key
Not sure which profile to use? Learn more about customer
profiles and how to configure them for webchat.
Step 2: Add Widget to Your Website
Copy the integration code below and paste it before the closing</body> tag on every page where you want the webchat widget to appear.
Basic Integration
Custom Configuration
Customize the widget appearance with these optional parameters:Configuration Options
| Parameter | Type | Required | Description |
|---|---|---|---|
apiKey | string | Yes | Your API key from the Apten dashboard |
theme | string | No | Widget color scheme: "light" or "dark" (default: "light") |
position | string | No | Chat bubble position: "bottom-right", "bottom-left", "top-right", "top-left" (default: "bottom-right") |
primaryColor | string | No | Brand color in hex format (e.g., "#0073CF") for buttons and accents |
Step 3: Test Your Integration
After adding the widget code to your website:- Open your website in a web browser
- Look for the chat bubble in the position you configured
- Click the bubble to open the chat interface
- Send a test message to your agent
- Return to your Apten dashboard and navigate to the Webchat tab
- Verify your test conversation appears in the session list
Success! If you see your test conversation in the dashboard, your webchat
is working correctly.
Troubleshooting
Widget Not Appearing
Problem: The chat bubble doesn’t show up on your website. Solutions:- Verify the domain is added to your API key’s allowed domains list
- Check browser console for JavaScript errors
- Ensure the widget script is loading (check Network tab in developer tools)
- Confirm the script is placed before the closing
</body>tag
”Invalid API Key” Error
Problem: Console shows authentication errors or “Invalid API key” message. Solutions:- Double-check you copied the complete API key correctly
- Verify the API key status is “Active” in dashboard settings
- Ensure you’re using the correct API key format (starts with
ak_live_org_)
CORS or Origin Errors
Problem: Browser console shows CORS policy errors. Solutions:- Ensure your website’s domain exactly matches an entry in allowed domains
- For
www.example.com, add bothexample.comand*.example.com, or be explicit - Check for typos in the allowed domains list
- Remember:
example.comdoes not automatically includewww.example.com
Widget Appears But Agent Doesn’t Respond
Problem: Chat opens but messages don’t get responses. Solutions:- Verify the API key’s webchat customer profile is properly configured
- Check that the customer profile has active conversation flows
- Ensure your Apten account has sufficient credits
- Review the session in your dashboard to see if messages are being received
Next Steps
Webchat Capabilities
Learn what your webchat agent can do
Configuration Settings
Explore all customization options
Customer Profiles
Optimize your agent’s conversation flow
Custom Knowledge
Connect your documentation for better answers

