Deploying to WebChat

Embed a fully customizable chat widget on your website with a single line of code.

Overview

WebChat allows you to embed a chat widget directly on your website. Visitors can interact with your flows without leaving your site, and conversations persist across page navigations and return visits.

Key Features

  • Single line of code to embed
  • Fully customizable appearance (colors, fonts, sizing)
  • Light and dark theme support with auto-detection
  • Mobile-responsive design
  • Conversation history persistence
  • Optional user info collection
  • JavaScript API for programmatic control

Create a WebChat Deployment

Creating a WebChat deployment is straightforward and doesn't require any external connections.

Step-by-Step Guide

Step 1: Choose Platform

  • Open your flow in the Flow Editor
  • Click "Deployments" in the toolbar (rocket icon)
  • Select the WebChat platform card

Step 2: Configure Deployment

Deployment Name: Give it a descriptive name (e.g., "Website Support Widget")
Version Strategy:
Latest Version - Auto-updates to newest published version
Pinned Version - Lock to specific version (requires manual updates)
Active: Check to enable immediately

Step 3: Customize Widget (Optional)

Click "Customize Widget" to open the visual customizer where you can configure colors, sizing, greeting messages, and more. See the Customization section for details.

Step 4: Get Embed Code

After creating the deployment, click the "Embed" button to view and copy your embed code.

Embed Code

Add the embed code to your website, just before the closing </body> tag:

<script
  async
  src="https://universalchatbot.com/chatbot.js"
  data-bot-url="https://universalchatbot.com/deployments/YOUR_ID/embed">
</script>

The script loads asynchronously and won't block your page from rendering. Once loaded, a chat widget button appears in the corner of your page (bottom-right by default).

Configuration in Embed Code

All widget configuration is embedded directly in the script tag as data attributes. When you customize your widget in the dashboard, the embed code automatically includes all your settings.

Customization

The widget customizer provides a visual interface to configure every aspect of your chat widget's appearance and behavior.

Theme & Colors

The widget supports both light and dark themes with automatic detection and full color customization.

Theme Mode

light
Always use light theme
dark
Always use dark theme
system*
Follow user's OS preference (prefers-color-scheme)
tailwind_class*
Match Tailwind's dark mode class on your html/body element

* Reactive: automatically updates when value changes

Color Theme Presets

Start with one of our professionally designed presets:

  • Modern Slate - Professional, neutral tones
  • Professional Indigo - Bold corporate look
  • Ocean Blue - Calming, friendly feel
  • Fresh Emerald - Natural, sustainable vibe
  • Elegant Rose - Luxury, premium appearance
  • Warm Amber - Inviting, approachable style
  • Custom - Full control over every color

Color Variables

Each theme (light and dark) has its own set of customizable colors:

primaryColor
Main interactive color (buttons, links)
primaryHoverColor
Hover state for primary elements
accentColor
Secondary accent color
headerColor
Widget header background
launcherColor
Floating launcher button color
botMessageBackgroundColor
Background for bot messages
botMessageTextColor
Text color for bot messages
botMessageTextSecondaryColor
Secondary text color for bot messages (timestamps)
userMessageBackgroundColor
Background for user messages
userMessageTextColor
Text color for user messages
userMessageTextSecondaryColor
Secondary text color for user messages (timestamps)
backgroundColor
Main chat area background
surfaceColor
Input area and card surfaces
surfaceTextColor
Text color on surface elements
borderColor
Borders and dividers

Appearance

Font Family
CSS font-family string (defaults to system fonts)
Font Size
Base font size for messages (default: 16px)
Border Radius
Corner roundness for the widget and messages (default: 16px)

Widget

Title
Header title shown when widget is open (e.g., "Chat with us")
Subtitle
Secondary text below the title (e.g., "We'll reply as soon as we can")
Widget Width
Width of the open widget (default: 400px)
Widget Height
Height of the open widget (default: 600px)
Button Size
Size of the floating launcher button (default: 60px)
Position
Widget placement: bottom-right, bottom-left, top-right, or top-left

Effects

Shadow Strength
Widget shadow intensity: light, medium, or strong
Backdrop Blur
Apply a blur effect to the background behind the widget
Animations
Animation style: minimal (subtle), smooth (balanced), or playful (bouncy)

Greeting

Configure an automatic greeting that appears when visitors first see the widget:

Greeting Message
Text shown in a bubble near the launcher (e.g., "Hi! How can I help you today?")
Greeting Delay
Milliseconds to wait before showing greeting (default: 3000ms)
Show Greeting
Enable or disable the greeting bubble

User Info Collection

Optionally collect user information before or during the conversation. This data becomes available as variables in your flow.

Collection Timing

never
Don't collect user info (default)
before_chat
Show form before the user can start chatting
after_first_message
Show form after user sends their first message

Available Fields

Select which fields to collect:

  • Name - User's name
  • Email - Email address with validation
  • Phone - Phone number with international format support

Each field can be marked as required or optional. Users can skip optional fields.

Accessing Collected Info

Collected user information is available in your flow via {{@request.user.name}}, {{@request.user.email}}, and {{@request.user.phone}}.

JavaScript API

Control the widget programmatically using the global UCBChatbotWidget object.

Available Methods

UCBChatbotWidget.open()
Open the chat widget
UCBChatbotWidget.close()
Close the chat widget
UCBChatbotWidget.toggle()
Toggle between open and closed states
UCBChatbotWidget.isOpen()
Returns true if widget is currently open
UCBChatbotWidget.setUnreadCount(n)
Set the unread message badge count

Example Usage

// Open chat when user clicks a custom button
document.getElementById('help-button').addEventListener('click', () => {
  UCBChatbotWidget.open();
});

// Open chat automatically after 30 seconds
setTimeout(() => {
  if (!UCBChatbotWidget.isOpen()) {
    UCBChatbotWidget.open();
  }
}, 30000);

Wait for Widget Ready

The UCBChatbotWidget object is available after the script loads. If you need to call methods immediately, wait for the load event or check if the object exists.