Documentation Index
Fetch the complete documentation index at: https://aimnahai.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Aimna Website Widget
The Aimna embeddable website widget is a production-ready, customizable, and secure widget for websites, powered by the Aimna API. The widget is embeddable via a single<script> tag and uses the Aimna public key system, allowing direct API calls from the frontend — no backend proxy required.
The widget supports two modes:
- Chat Widget: Text-based conversations — requires a chat agent
- Callback Widget: Phone-based conversations — requires a voice agent
Prerequisites
Before embedding either widget, you’ll need:-
Create an Agent:
- For chat widget: Create a chat agent using the Create Chat Agent guide
- For callback widget: Create a voice agent to handle phone conversations
-
Get Your Credentials:
- Your Aimna Public Key
- Your agent ID (chat agent ID for chat widget, voice agent ID for callback widget)
- For callback widget: Your Aimna phone number
Chat Widget
The chat widget provides text-based conversations through a chat interface. This widget requires a chat agent — it does not work with voice agents.Setup
Add the following script tag to your HTML, within the<head> tag:
Chat Widget Attributes
Required:data-public-key- Your Aimna public keydata-agent-id- Your chat agent ID
data-agent-version- Agent version (if unset, uses latest version)data-title- Custom chat window titledata-logo-url- URL of your logo imagedata-color- Hex color code for widget theme (e.g.,"#FFA07A")data-bot-name- Bot name for popup messagesdata-position- Widget position:"bottom-right"(default) or"bottom-left"data-popup-message- Popup message before users open chatdata-show-ai-popup- Set to"true"to enable popup messagesdata-show-ai-popup-time- Seconds to delay before showing popup (default: 0)data-auto-open- Set to"true"to auto-open chat widget on page loaddata-dynamic- JSON string with dynamic variables for the chat agentdata-recaptcha-key- Google reCAPTCHA v3 site key for bot protection (Note: Only reCAPTCHA v3 is supported)
reCAPTCHA Protection
The chat widget supports Google reCAPTCHA v3 for bot protection. Important: Only reCAPTCHA v3 is supported. To enable reCAPTCHA:- Include the Google reCAPTCHA v3 script in your HTML
<head>tag:
-
Add the
data-recaptcha-keyattribute to your widget script with your reCAPTCHA v3 site key - Enable reCAPTCHA protection for your public key in the Aimna Public Keys settings
How Chat Widget Works
- User clicks the chat widget button (displays a chat icon)
- Chat interface opens in a modal window
- User types messages and receives responses from the chat agent
- Chat sessions are automatically handled and persisted in localStorage
- If reCAPTCHA is enabled, bot protection is automatically applied
Testing Chat Widget
After adding the widget to your website:- Load your website
- Click the floating button (bottom right, chat icon)
- Start a conversation with your agent
Example: Chat Widget
Callback Widget
The callback widget collects user information and initiates a phone call instead of a chat session. This widget requires a voice agent — use this if you want to add a widget to your website for a voice agent.Setup
Add the following script tag to your HTML, within the<head> tag:
Callback Widget Attributes
Required:data-public-key- Your Aimna public keydata-agent-id- Your voice agent ID (not chat agent)data-widget-type="callback"- Enables callback modedata-phone-number- Your Aimna phone number that will make the outbound call
data-title- Custom widget titledata-color- Hex color code for widget themedata-position- Widget position:"bottom-right"(default) or"bottom-left"data-countries- Comma-separated country codes for country selector (e.g.,"US,CA,GB")data-tc- URL to your terms and conditions pagedata-recaptcha-key- Google reCAPTCHA v3 site key for bot protection
How Callback Widget Works
The callback widget supports the same reCAPTCHA v3 protection as the chat widget. To enable it, follow the instructions in the reCAPTCHA Protection section above.
- User clicks the callback widget button (displays a phone icon)
- A form appears collecting:
- Name (required)
- Phone number (required)
- Email (optional)
- Terms & conditions agreement checkbox (if
data-tcis set)
- User submits the form
- If reCAPTCHA is enabled, the form submission is validated
- The widget creates a phone call using the Aimna API
- User receives a call from your specified phone number
- The conversation is handled by your configured voice agent
Testing Callback Widget
After adding the widget to your website:- Load your website
- Click the floating button (bottom right, phone icon)
- Fill out the contact form
- Submit and wait for the phone call
Example: Callback Widget
Widget Behavior Summary
| Widget | Agent Type | Icon | Behavior |
|---|---|---|---|
| Chat Widget | Chat agent | Chat icon | Opens chat interface for text conversations |
| Callback Widget | Voice agent | Phone icon | Opens form to collect contact info and initiates a phone call |