Embeddable Widget

Add a powerful AI assistant directly to your website or web application.

Overview

The Twig AI embeddable widget provides:

  • Floating chat button

  • Customizable styling

  • Mobile-responsive design

  • Conversation persistence

  • File upload support

  • Multilingual capabilities

Quick Start

Installation

Add the script tag to your website:

<!-- Add before closing </body> tag -->
<script
  src="https://widget.twig.so/widget.js"
  data-agent-id="YOUR_AGENT_ID"
  data-organization-id="YOUR_ORG_ID"
  async
></script>

That's it! The widget will appear in the bottom-right corner.

Configuration

Basic Configuration

Advanced Configuration

Customization

Styling

Theme Selection

Light Mode:

Dark Mode:

Auto (respects system):

Custom Colors

Custom CSS

Positioning

Language & Text

User Context

Identifying Users

Pass user information for personalized responses:

Session Persistence

JavaScript API

Opening/Closing

Sending Messages Programmatically

Events

Updating Configuration

Advanced Features

File Upload

Proactive Messages

Analytics Integration

Custom Actions

Mobile Optimization

The widget is automatically mobile-responsive:

  • Desktop: Floating chat bubble

  • Mobile: Full-screen overlay

  • Tablet: Adaptive sizing

Mobile-specific options:

Performance

Lazy Loading

Widget loads asynchronously by default:

Bundle Size

  • Initial load: ~45KB (gzipped)

  • Lazy-loaded on first interaction

  • Cached by browser

Load Time Impact

  • < 50ms on fast connections

  • Does not block page render

  • No impact on Core Web Vitals

Security

Content Security Policy

Add to your CSP:

Data Privacy

  • No cookies set (uses sessionStorage)

  • GDPR compliant

  • User data encrypted

  • No tracking without consent

Examples

React Application

Vue.js Application

Next.js Application

Troubleshooting

Widget Not Appearing

Check:

  1. Script loaded (check Network tab)

  2. Agent ID correct

  3. Organization ID correct

  4. No JavaScript errors in console

  5. Not blocked by ad blocker

Widget Showing Wrong Agent

Check:

  1. Agent ID in configuration

  2. Agent is active

  3. Browser cache cleared

Styling Issues

Check:

  1. CSS conflicts with your site

  2. Z-index issues

  3. Custom CSS overriding widget styles

Next Steps

Last updated