DoclessAI SDK
Add a context-aware AI chat assistant to your application. Define your app's features โ users ask questions, the AI answers based on what you've defined.
npm package: npm install @doclessai/sdkย ยทย Works with React, Next.js, and plain HTML.
What problem does DoclessAI solve?
Apps often have features users don't understand โ and they don't want to search through documentation to find answers. DoclessAI embeds an AI assistant directly inside your application. The assistant understands your app because you tell it what your app does โ through feature definitions you write in the dashboard.
When a user asks "How do I export my data?", the assistant doesn't guess. It answers based on the export feature you defined, including the exact route, element ID to highlight.
Two integration paths
ai.ask() to get AI responses.Quick Start
Get the assistant running in your app in a few steps.
Install the package
npm install @doclessai/sdkSet up your app in the dashboard
Go to the DoclessAI dashboard, create a new app, and copy your App Key. Store it in your environment variables.
Security: Never hardcode your App Key in source code. Use process.env.YOUR_KEY or .env.local.
Define your app's features
In the dashboard, add features as a JSON array. Each feature is what your app can do โ the AI answers questions using this context. See feature format โ
Add the widget to your React app
import { ChatWidget } from '@doclessai/sdk' export default function App() { return ( <div> {/* AI assistant is now live */} <ChatWidget appKey="your-app-key" name="your-assistant-name" /> </div> ) }Done. The floating chat button is now in your app. Users ask questions, the AI answers based on your feature definitions.
Dashboard Setup
The dashboard is where you manage your apps and the features the AI knows about.
Creating an app
Go to the dashboard and click Create App. Fill in:
- โ App name โ displayed to users in the chat widget
- โ Contact email โ associated with this app
- โ App description โ tells the AI what your app is about overall
- โ Gemini API Key โ your own Gemini key, used to power the AI responses for this app
- โ App Features (JSON) โ the feature definitions the AI learns from
After creation, you receive your App Key โ this is what you pass to the SDK.
Defining Features
Features are how you give the AI knowledge about your app. Write them as a JSON array in the dashboard. Each feature object describes one capability of your app.
Feature structure
[ {"name":"Export Data"
"description":"Users can export their data as CSV or JSON. Go to Settings โ Data โ Export, choose a format and date range. The export file is sent to the account email."
"route":"/settings/export"
"elementId":"#export-button"
}, {"name":"Team Roles"
"description":"Manage user roles and permissions within your team. Go to Settings โ Team โ Roles to define and assign roles."
"route":"/settings/team/roles"
}, ]Feature fields
| Field | Type | Required | Description |
|---|---|---|---|
| name | string | Required | Short name for the feature (e.g. "Export Data"). |
| description | string | Required | Detailed explanation. The more detail, the better the AI answers. Describe exact steps, locations, and behavior. |
| route | string | Optional | App route to navigate to (e.g./settings/export). Returned in the response so your app can redirect the user. |
| elementId | string | Optional | A DOM element ID (e.g.#export-button). Returned so your app can highlight or scroll to the relevant UI element. |
Write good descriptions. The description field is the most important. Write it like you're explaining the feature to a new user โ include navigation steps, conditions, and what the outcome is. Vague descriptions produce vague answers.
ChatWidget (React)
The simplest way to add the AI assistant. Works in React and Next.js projects.
import { ChatWidget } from '@doclessai/sdk' <ChatWidget
appKey="your-app-key"
name="your-assistant-name"
/>Props
| Prop | Type | Required | Description |
|---|---|---|---|
| appKey | string | Required | Your App Key from the DoclessAI dashboard. |
| name | string | Required | Display name of your assistant shown in the chat panel. |
What's included
- โ Floating chat button that opens a full chat panel
- โ Markdown rendering in responses (bold, code, lists)
- โ Image upload โ users send images, AI analyzes them
- โ Toast notifications for errors
- โ Fully responsive on mobile
- โ Feature navigation (uses
routefrom response)
HTML Script Tag
Not using React? Add the assistant to any HTML page with a single script tag โ no build step needed.
<!-- Before closing </body> --> <scriptsrc="https://cdn.jsdelivr.net/npm/@doclessai/sdk@0.3.5/dist/loader.standalone.js"
data-app-key="your-app-key-here"
data-name="YOUR_ASSISTANT_NAME"
></script>The script auto-initializes when the page loads. Works with any HTML page.
DoclessClient (Headless)
Use the client directly if you want to build your own chat UI. You handle the interface โ we handle the AI.
import { DoclessClient } from '@doclessai/sdk'
const ai = new DoclessClient({
appKey: 'your-app-key-here'
}) // Text queryconst res = await ai.ask(userQuery)
// Text + imageconst res = await ai.ask(userQuery, imageFile)
// Use the responseconsole.log(res.res) // AI answer text
console.log(res.route) // route to navigate to
console.log(res.elementId) // DOM element to highlight
Next.js Setup
ChatWidget is a client component. Use"use client" and pass your key via environment variable.
.env.local
NEXT_PUBLIC_DOCLESSAI_KEY=your-app-key-here
app/layout.tsx (App Router)
'use client'import { ChatWidget } from '@doclessai/sdk'
export default function RootLayout({ children }: { children: React.ReactNode }) {
return ( <html> <body> {children}<ChatWidget
appKey={process.env.NEXT_PUBLIC_DOCLESSAI_KEY}
name="Aria"
/> </body> </html> ) }Response Format
Both ChatWidget andDoclessClient.ask() return the same response shape:
{res: string // AI's text answer (markdown supported)
route: string | null // App route to navigate to
elementId: string | null // DOM element to highlight
}TypeScript Types
import { AssistantResponse } from '@doclessai/sdk'
const res: AssistantResponse = await ai.ask('How do I export data?')