Getting started
Widget installation
The widget is a single script tag that injects a launcher button and a sandboxed chat iframe. All configuration lives in your dashboard — change it any time without touching code.
Install
Paste this before your closing </body> tag, with the project ID from Widget → Install in your dashboard:
<script
src="https://api.asklify.in/widget.js"
data-project-id="pub_YOUR_PROJECT_ID"
defer
></script>- Loads async — the
deferattribute keeps it off your critical rendering path. - Isolated— the chat UI runs in an iframe, so your site's CSS and the widget never conflict.
- Idempotent — if the script is included twice, only one widget is injected.
Configuration
Everything below is configured in Widget settings and applied instantly — no redeploys. The widget fetches its config from GET /api/v1/widget/{publicId}/config on load.
| Field | Type | Description |
|---|---|---|
displayName | string | Header title. Defaults to the project name. |
greeting | string | First message visitors see. Default: "Hi! How can I help?" |
inputPlaceholder | string | Placeholder text in the message input. |
suggestedQuestions | string[] | Quick-start questions shown before the first message. |
primaryColor | string | Brand color for the launcher and user bubbles (hex). |
theme | "light" | "dark" | Widget color scheme. |
position | "bottom-right" | "bottom-left" | Corner where the launcher sits. |
borderRadius | number | Corner radius of the chat panel, in pixels. |
avatarUrl | string | null | Assistant avatar shown next to replies. |
logoUrl | string | null | Logo shown in the widget header. |
showBranding | boolean | Toggle the “Powered by Asklify” footer (paid plans). |
customCss | string | null | Advanced: extra CSS injected inside the widget iframe. |
Domain restrictions
Your project ID is public by design. To stop other sites from embedding your assistant, set an allowed domains list in widget settings. Requests from any other origin are rejected. Chat requests are also rate-limited per visitor.
Identifying your users
The widget keeps anonymous visitors' conversation history in their browser. If your site has logged-in users and you build on the /chat API instead, pass a stable endUserId so conversations thread across devices — see the REST reference.
Single-page apps
The widget survives client-side route changes — it's injected once at page load and lives outside your app's root element. For React, Vue, Angular and friends, see the framework guides for idiomatic wrappers that mount and clean up the script correctly.
Troubleshooting
- Widget doesn't appear — check the browser console for
[kb-widget]warnings. A missingdata-project-idor a domain not on your allowlist are the usual causes. - 403 on config— your page's origin isn't in the allowed domains list. Add it (including the exact subdomain and protocol).
- Launcher appears but replies fail— your plan's monthly message quota may be exhausted; check Usage & billing in the dashboard.
- Duplicate widgets— you're injecting the script on every route change. Include it once in your root HTML instead.
