Back to Dashboard

Documentation

Learn how to use Asyntai

Solid Component

Add the Asyntai AI chat assistant to your Solid or SolidStart app

Create Account

Overview

Solid is a JavaScript framework for building fast web apps, and SolidStart is its full-stack version. The Asyntai package is one npm component. Add it to your app, and the chat bubble is on every page.

The assistant answers your visitors from your own content, in more than 80 languages, day and night.

Requirements

  • Solid 1.6 or later, including Solid 2
  • An Asyntai account. The Free plan is enough to try the widget

Installation

Follow these steps to add Asyntai to your Solid app:

1

Get Your Widget ID

Sign in to Asyntai and open the Install page. The widget ID is the value of data-asyntai-id in the snippet shown there. It starts with asyntai_.

2

Add the Package

Run this command in your project folder:

npm install solid-ai-chatbot
3

Add the Component

Add it once, in the part of your app that every page shares:

import { AiChatbot } from 'solid-ai-chatbot';

export default function App() {
  return (
    <>
      <MyRoutes />
      <AiChatbot widgetId="asyntai_1a2b3c4d5e6f" />
    </>
  );
}

With Solid Router or SolidStart, put it in the root layout:

import { Router } from '@solidjs/router';
import { FileRoutes } from '@solidjs/start/router';
import { Suspense } from 'solid-js';
import { AiChatbot } from 'solid-ai-chatbot';

export default function App() {
  return (
    <Router
      root={(props) => (
        <>
          <Suspense>{props.children}</Suspense>
          <AiChatbot widgetId="asyntai_1a2b3c4d5e6f" />
        </>
      )}
    >
      <FileRoutes />
    </Router>
  );
}
4

Open Your Site

Run your app and open it in a browser. The chat bubble is in the corner of every page, and it stays open while visitors move between routes.

Props

PropTypeDefaultWhat it does
widgetIdstringrequiredYour Asyntai widget ID
enabledbooleantrueSet it to false to hold the widget back. It loads when the value turns true
scriptUrlstringthe Asyntai CDNAdvanced. Load the widget from another URL

The props are reactive, so you can load the widget after a visitor gives consent:

<AiChatbot widgetId="asyntai_1a2b3c4d5e6f" enabled={hasConsent()} />

A missing or malformed widgetId writes a message to the browser console that says how to fix it. Your app keeps running.

How It Works

The component renders nothing into your app, because the widget draws its own bubble. It adds the widget script after the page's load event, so your own app always renders first. It runs only in the browser, so it is safe with SolidStart server rendering.

A page that already has the Asyntai snippet keeps it and gets no second one. Once loaded, the widget stays until the next full page load, even when the component is removed.

Answering From Your Content

Asyntai reads your published pages. Add your site URL in the dashboard, and the assistant answers from the same pages the widget sits on. You can also add documents, and question and answer pairs.

Removing It

Delete the <AiChatbot /> line and build again. The chat bubble is gone.

Plans & Pricing

The package is free. View pricing.

Need Help?

If you have any questions or run into issues, contact us at [email protected].