TypeScript AI chatbot

// ai-chatbot.ts
const SRC = "https://elfsightcdn.com/platform.js";
export function mountAiChatbot(container: HTMLElement, widgetId: string): void {
const el = document.createElement("div");
el.className = `elfsight-app-${widgetId}`;
el.setAttribute("data-elfsight-app-lazy", "");
container.appendChild(el);
if (!document.querySelector(`script[src="${SRC}"]`)) {
const s = document.createElement("script");
s.src = SRC;
s.async = true;
document.body.appendChild(s);
}
}
// mountAiChatbot(document.body, "YOUR-WIDGET-ID");Create your AI agent for free
- 1. Enter your website
- 2. Shape your agent
- 3. Add to website
Building an AI chatbot in TypeScript yourself
What you’d build and keep running
Your content as answers
The chat UI
Conversation memory
Guardrails
Leads and handoff
Transcripts and analytics
Upkeep
With Elfsight: one component
mountAiChatbot(document.body, "YOUR-ID");Learns from your website automatically
Lead forms and human handoff built in
Chat history, transcripts and analytics
Floating or embedded, styled in the editor
Free plan, no credit card
Add the AI chatbot to TypeScript
The component
No framework needed. A typed function you can call from any bundle or framework.
Loads the script once. Call it for several widgets; platform.js is added a single time.
Floating or embedded. Mount a floating chat on document.body; an embedded one into its container.
// ai-chatbot.ts
const SRC = "https://elfsightcdn.com/platform.js";
export function mountAiChatbot(container: HTMLElement, widgetId: string): void {
const el = document.createElement("div");
el.className = `elfsight-app-${widgetId}`;
el.setAttribute("data-elfsight-app-lazy", "");
container.appendChild(el);
if (!document.querySelector(`script[src="${SRC}"]`)) {
const s = document.createElement("script");
s.src = SRC;
s.async = true;
document.body.appendChild(s);
}
}
// mountAiChatbot(document.body, "YOUR-WIDGET-ID");What the agent does with no code of yours
Builds from your website
Creates a knowledge base
Shapes a personality
Prepares the first interaction
Equips with the right skills
Learns from conversations
Elfsight AI Chatbot vs building on a model API in TypeScript
Time to launch
Elfsight AI Chatbot
Your own build
Knowledge
Elfsight AI Chatbot
Your own build
Chat UI
Elfsight AI Chatbot
Your own build
Leads and handoff
Elfsight AI Chatbot
Your own build
Transcripts and analytics
Elfsight AI Chatbot
Your own build
Costs
Elfsight AI Chatbot
Your own build
Upkeep
Elfsight AI Chatbot
Your own build