Integration Guide

Complete guide to integrating the AI Chat Widget on your website

Back to Generator

🚀 Quick Start

Follow these simple steps to add the AI Chat Widget to your website:

1 Generate Your Embed Code

Visit the Code Generator and fill in your credentials:

2 Copy the Generated Code

After clicking "Generate Embed Code", you'll receive code that looks like this:

<!-- AI Live Chat Widget -->
<script src="https://ai-chatbot.automatemybiz.pro/widget/chat-widget.js"></script>
<script>
  AILiveChatWidget.init({
    assistableApiKey: 'asst_xxxxx...',
    assistantId: '1767164504753x148450098158239740',
    ghlLocationId: 'vDVoXqS1dMRlrGIpKM84',
    ghlApiToken: 'pit-xxxxx...',
    botName: 'Your Bot Name',
    themeColor: '#4F46E5',
    avatarUrl: 'https://yourdomain.com/path/to/avatar.png'
  });
</script>

3 Add Code to Your Website

Paste the generated code just before the closing </body> tag on every page where you want the chat widget to appear.

✅ That's it! The chat widget should now appear on your website. Click the chat bubble in the bottom-right corner to test it out.

📋 Prerequisites

Before integrating the widget, make sure you have:

1. Assistable AI Account

2. AutomateMyBiz Account

â„šī¸ Note: To create a AMB Private Access Token, go to Settings → Integrations → API Key → Create Private Access Token and select the required scopes.

âš™ī¸ Configuration Options

Complete reference for all configuration options:

Option Type Required Description
assistableApiKey String Yes Your Assistable API key (starts with "asst_")
assistantId String Yes Your assistant/bot ID from Assistable
ghlLocationId String Yes Your AutomateMyBiz location ID
ghlApiToken String Yes AMB Private Access Token (starts with "pit-")
botName String Yes Display name for your chatbot
themeColor String Yes Hex color code (e.g., "#4F46E5")
avatarUrl String No URL to bot avatar image (PNG, JPG, GIF)
position String No Widget position (default: "bottom-right")

🔧 How It Works

Understanding the widget's backend flow:

First Message Flow

  1. User sends their first message
  2. Widget creates anonymous contact in AutomateMyBiz
  3. Widget creates conversation in AutomateMyBiz
  4. Message sent to Assistable AI for response
  5. Both user and bot messages synced to AMB
  6. Response displayed in chat

Subsequent Messages

  1. User sends message
  2. Widget checks for name, email, phone in message
  3. If found, automatically updates AMB contact
  4. Message sent to Assistable AI with full conversation history
  5. Both messages synced to AMB conversation
  6. Response displayed in chat

Data Persistence

✨ Features

Automatic Contact Management

The widget automatically:

Conversation Syncing

All conversations are synced to AutomateMyBiz in real-time:

AI-Powered Responses

Powered by Assistable AI:

Mobile Responsive

🎨 Customization

Theme Colors

The themeColor option controls:

Bot Avatar

Upload a custom avatar image to personalize your bot:

Bot Name

Choose a friendly name that matches your brand:

🔍 Troubleshooting

Widget doesn't appear

Messages not syncing to AMB

AI not responding

âš ī¸ Security Note: Your API keys are embedded in the client-side code. While this is necessary for the widget to function, be aware that these keys are visible in the browser. Use API keys with minimal required permissions and monitor usage regularly.

🚀 Advanced Usage

Multiple Widgets on Same Site

You can only have one widget instance per page. If you need different configurations on different pages, generate separate embed codes for each page.

Dynamic Configuration

You can programmatically initialize the widget with dynamic values:

// Get values from your backend or URL parameters
const config = {
  assistableApiKey: getApiKey(),
  assistantId: getAssistantId(),
  // ... other options
};

AILiveChatWidget.init(config);

Event Tracking

The widget logs all events to browser console for debugging:

đŸ’Ŧ Support & Resources

Documentation

Common Use Cases

🎉 Ready to get started?
Head to the Code Generator to create your custom embed code in seconds!