Documentation

Documentation & Help Center

Everything you need to know to use AISocialPilot at full capacity.

Getting Started

Add the AISocialPilot chat widget to any website with a single script tag. Paste the following snippet before the closing </body> tag of your HTML:

html
<script src="https://cdn.aisocialpilot.ai/widget.js"
  data-widget-id="YOUR_WIDGET_ID"
  data-theme="light"
  data-position="bottom-right">
</script>

Where to find your Widget ID: Go to Dashboard → Settings → Chat Widget and copy your unique widget identifier from the Embed section.

React / NPM Integration

If you use React (or any framework that supports npm packages), install the official package for a first-class integration:

bash
npm install @aisocialpilot/chat-widget

Then import and render the component anywhere in your app:

tsx
import { ChatWidget } from '@aisocialpilot/chat-widget';

export default function App() {
  return (
    <ChatWidget
      widgetId="YOUR_WIDGET_ID"
      theme="light"
      position="bottom-right"
    />
  );
}

The React component accepts the same configuration options as the script tag (listed below), passed as props.

Configuration Reference

All options can be set as data-* attributes on the script tag (kebab-case) or as React component props (camelCase).

OptionTypeDefaultDescription
widgetIdstringrequiredYour unique widget identifier
theme"light" | "dark""light"Widget color theme
primaryColorstring"#059669"Brand accent color (hex)
position"bottom-right" | "bottom-left""bottom-right"Widget launcher position on the page
localestring"en"Language code (en, es, fr, de, pt, ja)
aiNamestring"AI Assistant"Display name shown for the AI in the chat
welcomeMessagestring"Hi! How can I help?"Initial greeting message shown when chat opens
preChatEnabledbooleanfalseShow a pre-chat form before starting the conversation
nameRequiredbooleantrueRequire the visitor's name in the pre-chat form
emailRequiredbooleantrueRequire the visitor's email in the pre-chat form
customGreetingstring""Custom greeting shown on the pre-chat form

Customization

Theme Switching

The widget ships with both a light and dark theme. Set the theme via the data-theme attribute or theme prop:

html
<!-- Dark theme -->
<script src="https://cdn.aisocialpilot.ai/widget.js"
  data-widget-id="YOUR_WIDGET_ID"
  data-theme="dark">
</script>

Custom Brand Colors

Override the primary color to match your brand. The color affects the widget header, send button, links, and typing indicator.

html
<script src="https://cdn.aisocialpilot.ai/widget.js"
  data-widget-id="YOUR_WIDGET_ID"
  data-primary-color="#7c3aed">
</script>

Position

Choose between bottom-right (default) and bottom-left to place the widget launcher where it fits best in your layout.

CSS Isolation

All widget CSS classes use the asp- prefix (e.g. asp-chat-window, asp-message-bubble) to avoid conflicts with your existing stylesheets. The widget also renders inside Shadow DOM for complete style isolation.

Internationalization

The widget supports six languages out of the box. All UI strings — the send button label, input placeholder, timestamp formatting, and system messages — are fully translated.

CodeLanguage
enEnglish
esSpanish
frFrench
deGerman
ptPortuguese
jaJapanese

Set the locale with the data-locale attribute or the locale prop:

html
<script src="https://cdn.aisocialpilot.ai/widget.js"
  data-widget-id="YOUR_WIDGET_ID"
  data-locale="es">
</script>
tsx
<ChatWidget widgetId="YOUR_WIDGET_ID" locale="fr" />

Pre-Chat Form

Collect your visitor's name and email before the conversation starts. The pre-chat form is shown only once per visitor session — the details are persisted in local storage.

Script Tag

html
<script src="https://cdn.aisocialpilot.ai/widget.js"
  data-widget-id="YOUR_WIDGET_ID"
  data-pre-chat-enabled="true"
  data-name-required="true"
  data-email-required="true"
  data-custom-greeting="Welcome! Tell us a bit about yourself.">
</script>

React Component

tsx
<ChatWidget
  widgetId="YOUR_WIDGET_ID"
  preChatEnabled={true}
  nameRequired={true}
  emailRequired={false}
  customGreeting="Welcome! Tell us a bit about yourself."
/>

Both nameRequired and emailRequired default to true when the pre-chat form is enabled. Set either to false to make the field optional (shown but not required).

Rich Messages

The widget supports several rich content types that are rendered automatically when the AI or a human agent sends structured payloads.

Quick Replies

Quick reply buttons are shown below an AI message and let the visitor respond with a single tap. They disappear after one is selected.

json
{
  "type": "quick_replies",
  "options": [
    { "label": "Pricing", "value": "Tell me about pricing" },
    { "label": "Features", "value": "What features do you offer?" },
    { "label": "Talk to human", "value": "Connect me to support" }
  ]
}

Cards

Cards display an image, title, description, and one or more action buttons. Use them for product highlights, articles, or feature spotlights.

json
{
  "type": "card",
  "title": "Pro Plan",
  "description": "Unlimited posts, 10 social accounts, priority support.",
  "imageUrl": "https://example.com/pro-plan.png",
  "buttons": [
    { "label": "Learn more", "url": "https://aisocialpilot.ai/pricing" },
    { "label": "Subscribe", "value": "subscribe_pro" }
  ]
}

Carousels

Carousels are horizontally scrollable collections of cards. The visitor can swipe through them on mobile or use arrow buttons on desktop.

json
{
  "type": "carousel",
  "cards": [
    {
      "title": "Starter",
      "description": "$29/mo",
      "buttons": [{ "label": "Choose", "value": "pick_starter" }]
    },
    {
      "title": "Pro",
      "description": "$79/mo",
      "buttons": [{ "label": "Choose", "value": "pick_pro" }]
    },
    {
      "title": "Business",
      "description": "$199/mo",
      "buttons": [{ "label": "Choose", "value": "pick_business" }]
    }
  ]
}

Buttons

Standalone button groups can link to external URLs or trigger in-chat actions. Buttons with a url property open in a new tab; buttons with a value property send the value as a visitor message.

Troubleshooting

Widget not showing

Verify your widget ID is correct. Then check that the domain where you embedded the script is included in the allowed domains list. Go to Dashboard → Settings → Chat Widget → Allowed Domains and add your domain (e.g. example.com).

CORS errors

Cross-origin errors typically mean your domain is not listed as an allowed origin. Add your full domain (including protocol) to the allowed domains in Dashboard → Settings → Chat Widget → Allowed Domains.

Content Security Policy (CSP) issues

If your site enforces a strict CSP, add the following origins to your policy:

text
script-src: cdn.aisocialpilot.ai
connect-src: cdn.aisocialpilot.ai your-project.supabase.co
style-src: cdn.aisocialpilot.ai

Styling conflicts

The widget uses the asp- CSS class prefix and renders inside Shadow DOM, so it should not conflict with your styles. If you notice visual issues, check whether your CSS uses very broad selectors (e.g. * { all: unset; }) that might pierce into the shadow root in older browsers.