Integration guide
Asklify + HTML / JavaScript
No framework, no build step — one script tag on any static site, and an optional programmatic pattern for loading on demand.
pub_...) from Widget → Install.Paste the snippet
<!doctype html>
<html lang="en">
<head>
<title>Your site</title>
</head>
<body>
<! ...your content... >
<script
src="https://api.asklify.in/widget.js"
data-project-id="pub_YOUR_PROJECT_ID"
defer
></script>
</body>
</html>Optional: load on demand
If you'd rather not load the widget until a visitor shows intent (e.g. clicks “Chat with us”), inject it programmatically — the template below wires a button to first-load the widget.
Ready-to-use template
Copy, paste, replace the project ID — that's the whole integration:
/** Load the Asklify widget on demand (e.g. from a "Chat with us" button). */
function loadAsklify(projectId) {
if (document.getElementById("asklify-widget-script")) return;
var script = document.createElement("script");
script.id = "asklify-widget-script";
script.src = "https://api.asklify.in/widget.js";
script.defer = true;
script.setAttribute("data-project-id", projectId);
document.body.appendChild(script);
}
document.getElementById("chat-cta")?.addEventListener("click", function () {
loadAsklify("pub_YOUR_PROJECT_ID");
// The launcher appears in the corner about a second later.
});Customization
All appearance and behavior — name, greeting, colors, theme, position, suggested questions — is configured in your dashboard under Widget settings and applies instantly without redeploying. See the widget configuration reference.
Event handling
To react to what happens in conversations — a chat starting, a customer requesting a human, feedback submitted — subscribe to webhooks. For fully custom experiences, the REST API exposes chat with streaming, knowledge search, and conversation transcripts.
Best practices
- The plain snippet is right for 99% of sites — on-demand loading only helps extremely performance-sensitive landing pages.
- Set your domain allowlist before launch so other sites can't reuse your project ID.
Troubleshooting
- Nothing appears — open DevTools; [kb-widget] console warnings name the exact problem (missing ID, blocked origin).
- CSP errors — allow script-src api.asklify.in and frame-src app.asklify.in in your Content-Security-Policy.
Still stuck? Check the error reference or email hello@asklify.in.
