Chatbot Documentation

For user manual please visit: Chatbot User Manual

Overview

Liteed Chatbot is a lightweight web widget that answers visitor questions using your content. Install a single snippet, train on your docs and FAQs, and review sessions in your dashboard. For context on where Chatbot sits in the overall automation journey, read Business automation overview.

Getting started

  1. Sign in or sign up at ai.liteed.com/login.
  2. Create an assistant and add data to train responses.
  3. Copy the widget snippet from the dashboard and paste it into your site.
  4. Open your site and test the chat. Iterate on your training data as needed.

Integration

Integrating Liteed Chatbot requires no SDKs or code changes. You only need to paste one <script> tag into your site. The script contains your chatbot’s appKey (unique identifier). No manual editing is necessary — copy it exactly as provided in your dashboard.

Place the snippet before the closing </body> tag of your HTML. This ensures the chatbot loads after the rest of your page content, avoiding layout shifts or delays in your own scripts.

Inline integration

The inline integration loads the complete widget directly. This is the simplest option: just one script, no intermediate steps. Choose this if you want the chatbot available as soon as possible without caring about optimizing page load.

  • Pros: Easiest to set up; everything in one request.
  • Cons: Slightly more weight at initial page load since the entire widget downloads immediately.

Loader integration

The loader integration is a two-step process handled for you. A tiny bootstrap script loads first; it then fetches the full widget in the background. The chat button appears only when the widget has finished initializing. Use this if you want to minimize impact on your page’s initial load time.

  • Pros: Faster initial page render; visitors don’t download the widget until after your page is ready.
  • Cons: Chat button appears a moment later, only after background loading finishes.

Which one should I choose?

- Use inline if you want the chatbot available instantly and don’t mind adding ~30–40 KB of script weight up front.
- Use loader if you want to prioritize your site’s speed metrics (e.g. Lighthouse / Core Web Vitals). The widget will not block rendering and will appear after the page is interactive.

Both options are supported equally. You can switch between them anytime without changing anything else in your setup.

Nuxt integration

Add the chatbot as a client-only plugin.

  1. Create plugins/liteed-chatbot.client.ts.
  2. Add it to nuxt.config.ts under plugins.
  3. Deploy.

plugin file (plugins/liteed-chatbot.client.ts):

export default defineNuxtPlugin(() => {
  const appKey = 'YOUR_APP_KEY';
  const baseUrl = 'https://ai.liteed.com';
  if (!appKey || !baseUrl) return;
  const link = document.createElement('link');
  link.rel = 'preconnect';
  link.href = baseUrl;
  document.head.appendChild(link);
  const s = document.createElement('script');
  s.async = true;
  s.src = baseUrl + '/api/chat/v1/widget/' + encodeURIComponent(appKey);
  s.crossOrigin = 'anonymous';
  s.referrerPolicy = 'strict-origin-when-cross-origin';
  document.head.appendChild(s);
});

nuxt.config.ts (add or extend this section):

export default defineNuxtConfig({
  plugins: ['~/plugins/liteed-chatbot.client.ts'],
});

Host-controlled API (events)

Control the widget by dispatching browser events. The widget emits liteed-chatbot:ready when initialized.

Events emitted by the widget

  • liteed:chatbot:ready — widget is ready.

Events you can dispatch

  • liteed:ui:open — open the chat window.
  • liteed:ui:close — close the chat window.
  • liteed:ui:expand — expand to large view.
  • liteed:ui:minimize — return to compact view.
  • liteed:widget:toggle — toggle open/close.
  • liteed:ui:theme — switch theme at runtime ({ detail: { mode: 'dark' | 'light' } }).
  • liteed:message:send — send a message as if typed by the user ({ detail: { message: 'Hello from host!' } }).

Usage example

<script>
window.addEventListener('liteed-chatbot:ready', () => {
  window.dispatchEvent(new Event('liteed:ui:open'));
  window.dispatchEvent(new Event('liteed:ui:expand'));
  window.dispatchEvent(new CustomEvent('liteed:ui:theme', { detail: { mode: 'light' } }));
});
</script>

Chatbot API

Intro

Use these HTTP and WebSocket endpoints to start sessions, send messages, stream completions, and receive realtime events. Base URL: https://ai.liteed.com/api/chat/v1. Chatbot's appKey must be included in every call. Get your app key in ai.liteed.com/chatbots.

Flows

  • Basic chat: create session → get JWT → send message (sync) → read history.
  • Streaming + realtime: create session → get JWT → send message (stream) → update UI from NDJSON deltas → mirror activity via WebSocket events.

Endpoints

POST /v1/sessions

Create a chat session.

Rate limits:

  • Free beta: 10 per minute.
  • Contact us to increase.

Request:

{
  "appKey": "YOUR_APP_KEY"
}

Response:

{
  "sessionId": "sid_xxx",
  "createdAt": "2025-09-15 12:34:56",
  "expiresAt": "2025-09-22 12:34:56"
}

POST /v1/session/token

Exchange sessionId for a short-lived JWT.

Rate limits:

  • Free beta: 60 per minute. 10 per 10 seconds.
  • Contact us to increase.

Request:

{
  "sessionId": "sid_xxx"
}

Response:

{
  "jwt": "eyJhbGciOi..."
}

GET /v1/session/messages

Get full message history for a session. Header: Authorization: Bearer <jwt>.

Rate limits:

  • Free beta: 6 per minute. 2 per second.
  • Contact us to increase.
[
  {
    "role": "user",
    "message": "Hi",
    "date": "2025-09-15 13:00:10"
  },
  {
    "role": "assistant",
    "message": "Hello!",
    "date": "2025-09-15 13:00:12"
  }
]

POST /v1/message

Send a message and wait for the full reply. Header: Authorization: Bearer <jwt>.

Request:

{
  "message": "How can you help me?"
}

Response:

{
  "content": "Here’s how I can help..."
}

cURL:

curl -X POST "https://ai.liteed.com/api/chat/v1/message" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $JWT" \
  -d '{"message":"Hello!"}'

POST /v1/message/stream

Stream a reply as NDJSON lines ({"type":"delta"}{"type":"done"}). Header: Authorization: Bearer <jwt>.

const res = await fetch(
  "https://ai.liteed.com/api/chat/v1/message/stream",
  {
    method: 'POST',
    headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + jwt },
    body: JSON.stringify({ message })
  }
);

const reader = res.body.getReader();
const decoder = new TextDecoder();
let buffer = '';
let full = '';

for (;;) {
  const { done, value } = await reader.read();
  if (done) break;
  buffer += decoder.decode(value, { stream: true });
  let idx;
  while ((idx = buffer.indexOf('\n')) >= 0) {
    const line = buffer.slice(0, idx).trim();
    buffer = buffer.slice(idx + 1);
    if (!line) continue;
    const obj = JSON.parse(line);
    if (obj.type === 'delta') full += obj.delta;
    if (obj.type === 'done')  console.log('final:', obj.content ?? full);
  }
}

NDJSON sample:

{"type":"delta","delta":"Launching "}
{"type":"delta","delta":"dreams "}
{"type":"delta","delta":"in code—"}
{"type":"done","content":"Launching dreams in code—..."}

GET /v1/ws

WebSocket realtime changelog. Authenticate via Sec-WebSocket-Protocol: jwt::<jwt>.

Events you may receive:

  • {"type":"ready","sessionId":"SID"}
  • {"type":"ping","t":...} (reply {"type":"pong"})
  • {"type":"user_message","content":"..."}
  • {"type":"sending_state","isSending":true|false}
  • {"type":"chatbot_message","content":"..."}
  • {"type":"error","message":"..."}

Client messages you can send:

  • {"type":"pong"}
  • {"type":"user_send_start","message":"..."}
const ws = new WebSocket(
  'wss://ai.liteed.com/api/chat/v1/ws',
  ['jwt::' + jwt]
);

ws.onmessage = (e) => {
  const evt = JSON.parse(e.data);
  if (evt.type === 'ping') ws.send(JSON.stringify({ type: 'pong' }));
  if (evt.type === 'user_message')    {/* show user message */}
  if (evt.type === 'sending_state')   {/* toggle loader */}
  if (evt.type === 'chatbot_message') {/* show assistant reply */}
  if (evt.type === 'error')           {/* display error */}
};

// Before your HTTP POST, optionally:
// ws.send(JSON.stringify({ type: 'user_send_start', message: userText }));

Changelog

October 24, 2025

  • Definable chatbot actions: prompts, links, request call back.
  • Wirable events (through Liteed Management Console).
  • POST /v1/event
  • 3rd party integration via events.
  • Chatbot user menu and "Contact me".
  • Self-awareness and current context awareness (current page).
  • Host-controlled API.
  • Improved UX.

October 11, 2025

  • Markdown support:
    • **strong**
    • *italic*
    • [link text](https://example.com)
    • https://example.com will be converted into link
    • - bullet list
  • Actionable prompt suggestions.

September 16, 2025

  • Added API support for direct chatbot integration.
  • Added Host-controlled API (page events to control widget).
  • Added WebSocket realtime events for multi-tab and live changelog.

September 8, 2025

Released the first version of Liteed Chatbot.

  • Integratable web widget.
  • Fully automated chat trained on company data.
  • View history of chat sessions in the management console.
  • Launch of the free beta plan, allowing creation of unlimited chatbots with different contexts for different platforms.