Skip to content

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:

index.html
<script
  src="https://api.asklify.in/widget.js"
  data-project-id="pub_YOUR_PROJECT_ID"
  defer
></script>
  • Loads async — the defer attribute 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.

FieldTypeDescription
displayNamestringHeader title. Defaults to the project name.
greetingstringFirst message visitors see. Default: "Hi! How can I help?"
inputPlaceholderstringPlaceholder text in the message input.
suggestedQuestionsstring[]Quick-start questions shown before the first message.
primaryColorstringBrand color for the launcher and user bubbles (hex).
theme"light" | "dark"Widget color scheme.
position"bottom-right" | "bottom-left"Corner where the launcher sits.
borderRadiusnumberCorner radius of the chat panel, in pixels.
avatarUrlstring | nullAssistant avatar shown next to replies.
logoUrlstring | nullLogo shown in the widget header.
showBrandingbooleanToggle the “Powered by Asklify” footer (paid plans).
customCssstring | nullAdvanced: 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.

Leave the allowlist empty only during development. Set it before you launch — it's the main guard against strangers consuming your message quota.

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 missing data-project-id or 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.