Chatbot Integration

Embed the Jamii AI Chatbot on any website in minutes. Available on Pro and Enterprise plans.

Quick Start

Add two snippets before your closing </body> tag β€” that's all you need:

HTML
<script>
  window.JamiiAIWidget = {
    apiUrl: "https://api.jamiiai.com"
  };
</script>
<script src="https://cdn.jamiiai.com/widget/jamiiai-widget.js"></script>

A floating chat button appears in the bottom-right corner of your page. The widget auto-injects its own CSS β€” no extra stylesheet needed.

How It Works

The chatbot widget follows a simple flow:

  1. Click the floating chat button to open the panel
  2. Sign in with your email (username) and secret answer
  3. Chat with the AI assistant in real time
  4. Reset the conversation at any time with the ↻ button
  5. Logout to clear the session (token stored in sessionStorage)

The widget is fully self-contained β€” a single JavaScript file with built-in styles, i18n, authentication, and chat functionality. On the Pro plan it provides a simple chat interface using three core endpoints. On the Enterprise plan it unlocks a full multi-modality experience with 82 endpoints across 15 modalities β€” including code generation, image & video analysis, voice, document generation, knowledge base, and more.

Configuration Options

All options are set on window.JamiiAIWidget before loading the script:

Option Type Default Description
apiUrl string "" Required. Your Jamii AI API base URL
lang string "en" "en" or "fr"
position string "bottom-right" "bottom-right" or "bottom-left"
plan string "pro" "pro" or "enterprise"
theme object {} Custom colours (Enterprise only)
branding object {} Custom branding (Enterprise only)

Theme Options Enterprise

Enterprise customers can fully customise the widget's visual appearance:

Property Type Default Description
primaryColor string "#7c3aed" Buttons, user bubbles, accents
accentColor string "#22d3ee" Header gradient secondary colour
fontFamily string "'Inter', system-ui, sans-serif" Widget font stack
JavaScript
window.JamiiAIWidget = {
  apiUrl: "https://api.jamiiai.com",
  plan: "enterprise",
  theme: {
    primaryColor: "#0066ff",
    accentColor: "#00ccaa",
    fontFamily: "'Poppins', sans-serif"
  }
};

Branding Options Enterprise

Enterprise users can white-label the widget with their own branding:

Property Type Default Description
title string null Header title text
subtitle string null Header subtitle text
logo string null Custom SVG logo markup
showPoweredBy boolean false Show/hide "Powered by Jamii AI"
JavaScript
branding: {
  title: "Acme Support",
  subtitle: "We're here to help",
  logo: '<svg viewBox="0 0 32 32">...</svg>',
  showPoweredBy: false
}

Plan Comparison

Feature Pro Enterprise
Embeddable chatbot widget βœ… βœ…
Bilingual support (EN / FR) βœ… βœ…
Login / Chat / Reset flow βœ… βœ…
Mobile responsive βœ… βœ…
Position customisation βœ… βœ…
"Powered by Jamii AI" badge Required Optional
Custom branding (title, logo) β€” βœ…
Custom theme colours β€” βœ…
White-label mode β€” βœ…
Multi-Modality (Enterprise Only)
Code generation, review & refactor β€” βœ…
Text AI (translate, summarize, sentiment, extract) β€” βœ…
Image generation & description β€” βœ…
Voice (speech-to-text, text-to-speech, audio chat) β€” βœ…
Video transcription & description β€” βœ…
Document generation (Word, PowerPoint, PDF) β€” βœ…
Database natural-language queries β€” βœ…
Web page summarisation β€” βœ…
African-language AI (chat, translate, detect) β€” βœ…
Africa Life (agriculture, education, legal) β€” βœ…
Africa Culture (proverbs, storytelling) β€” βœ…
AI Agent (autonomous task execution) β€” βœ…
Embeddings & memory (store / recall / clear) β€” βœ…
Knowledge Base (ingest, query, manage) β€” βœ…
File upload & download β€” βœ…
Server-Sent Events (SSE) streaming β€” βœ…

Example β€” Pro Plan (Minimal)

HTML
<script>
  window.JamiiAIWidget = {
    apiUrl: "https://api.jamiiai.com",
    lang: "en"
  };
</script>
<script src="https://cdn.jamiiai.com/widget/jamiiai-widget.js"></script>

Example β€” Pro Plan (French, Left-Positioned)

HTML
<script>
  window.JamiiAIWidget = {
    apiUrl: "https://api.jamiiai.com",
    lang: "fr",
    position: "bottom-left"
  };
</script>
<script src="https://cdn.jamiiai.com/widget/jamiiai-widget.js"></script>

Example β€” Enterprise (White-Label)

HTML
<script>
  window.JamiiAIWidget = {
    apiUrl: "https://api.yourcompany.com",
    plan: "enterprise",
    lang: "fr",
    position: "bottom-left",
    theme: {
      primaryColor: "#0066ff",
      accentColor: "#00ccaa",
      fontFamily: "'Poppins', sans-serif"
    },
    branding: {
      title: "Acme Support",
      subtitle: "We're here to help",
      logo: '<svg viewBox="0 0 32 32"><circle cx="16" cy="16" r="14" fill="#0066ff"/><text x="16" y="21" text-anchor="middle" fill="#fff" font-size="14" font-weight="bold">A</text></svg>',
      showPoweredBy: false
    }
  };
</script>
<script src="https://cdn.jamiiai.com/widget/jamiiai-widget.js"></script>

Self-Hosting

Download jamiiai-widget.js and serve it from your own domain:

HTML
<script>
  window.JamiiAIWidget = {
    apiUrl: "https://api.jamiiai.com"
  };
</script>
<script src="/assets/jamiiai-widget.js"></script>

An optional standalone CSS file (jamiiai-widget.css) is also provided for customers who prefer to host styles separately. The JS file auto-injects styles by default, so the CSS file is not required.

Account Creation & Subscription

Before using the chatbot widget, users must create an account and subscribe to a plan. The website provides a signup form that collects:

  • Full name
  • Email (also used as the username β€” the part before @)
  • Phone
  • Secret question & answer (used for widget login)

After signup the user is redirected to Stripe Checkout to choose a plan (Starter $19/mo, Pro $49/mo, Enterprise $199/mo). On successful payment the subscription is recorded automatically via webhook.

Relevant endpoints

Method Path Description
POST /auth/signup Create a new customer account
POST /auth/subscribe Create a Stripe Checkout session
POST /auth/stripe-webhook Handle Stripe payment events
GET /auth/stripe-key Retrieve the Stripe publishable key

API Endpoints Used

On the Pro plan the widget uses three core endpoints. On the Enterprise plan the widget has access to 82 endpoints across 15 modalities β€” the core endpoints below plus those listed in the modality table.

POST /auth/customer/login

Authenticate a user with their email (username) and secret answer.

Request

JSON
{
  "username": "john",
  "secret_answer": "my-secret"
}

Response

JSON
{
  "access_token": "eyJhbGciOi...",
  "token_type": "bearer"
}
POST /chat Bearer

Send a chat message and receive an AI response.

Request

JSON
{
  "message": "What can you do?"
}

Response

JSON
{
  "response": "I can help you with..."
}
POST /chat/reset Bearer

Reset the conversation history and start fresh.

Response

JSON
{
  "message": "Chat reset successfully"
}

Enterprise Modality Endpoints

Enterprise users have a modality selector bar in the widget giving access to all of the following:

Modality Actions Endpoints
Chat Chat, Stream /chat, /chat/stream
Code Generate, Review, Explain, Refactor /code/generate, /code/review, /code/explain, /code/refactor
Text AI Translate, Summarize, Sentiment, Extract /text/translate, /text/summarize, /text/sentiment, /text/extract
Web Summarize URL /web/summarize
Database Query /db/chat
Africa Lang Chat, Translate, Detect Language /africa/chat, /africa/translate, /africa/detect-language
Africa Life Agriculture, Education, Legal /africa/agriculture/ask, /africa/education/ask, /africa/legal/ask
Africa Culture Proverbs, Storytelling /africa/proverbs/get, /africa/storytelling/tell
Agent Task /agent/task
Memory Store, Recall, Clear /memory/store, /memory/recall, /memory/clear
Knowledge Base Ingest, Ingest URL, Query, List, Clear /kb/ingest, /kb/ingest-url, /kb/query, /kb/list, /kb/clear
Image Describe, Q&A, Generate /image/image-to-text, /image/image-to-answer, /image/text-to-image
Document Word, PowerPoint, PDF /document/text-to-word, /document/text-to-powerpoint, /document/text-to-pdf
Voice Speech→Text, Text→Speech, Audio Chat /voice/speech-to-text, /voice/text-to-speech, /voice/audio-to-audio
Video Transcribe, Describe /video/video-to-text, /video/video-to-description

Authentication Flow

  1. User clicks the floating chat button
  2. A login form requests email (username) and secret answer
  3. Credentials are sent to /auth/customer/login, which returns a JWT
  4. The JWT is stored in sessionStorage (cleared on logout or tab close)
  5. All subsequent API calls include the token as Authorization: Bearer
  6. On a 401 response (expired token), the user is returned to the login form

Browser Support

Browser Minimum Version
Chrome 60+
Firefox 55+
Safari 12+
Edge 79+

Troubleshooting

Issue Cause Solution
Chat button doesn't appear Script not loaded Verify the <script> tag path loads without a 404
"API URL not configured" error Missing apiUrl Set apiUrl in window.JamiiAIWidget before loading the script
"Cannot reach the server" CORS or network issue Ensure your API allows requests from the embedding domain
Login fails with valid credentials Wrong endpoint Confirm your API has the /auth/customer/login endpoint
Widget styles conflict with page CSS specificity clash All widget classes use the jcb- prefix β€” no collisions expected