Expertise AI Knowledge Base

Triggering with our API

Last updated on September 26, 2025

ChatSimple Widget API Documentation

The ChatSimple Widget exposes a JavaScript API that allows you to programmatically interact with the chat widget from your website's code. This API is available globally as `window.chatsimpleWidget` once the widget has loaded.
 

Getting Started

Checking API Availability

Before using the API, ensure the widget has loaded and the API is available:
Embed to ensure available.
if (window.chatsimpleWidget && window.chatsimpleWidget._isInitialized) { // API is ready to use window.chatsimpleWidget.open(); console.log('API LIVE!') } else { console.warn('ChatSimple Widget API not yet available'); }
 

API Reference

sendMessage()

Programmatically send a message to the chat widget and open the widget if it's closed.
window.chatsimpleWidget.sendMessage(message) Parameters: - `message` (string, required): The message text to send to the chatbot Returns: `void` Example: // Simple message window.chatsimpleWidget.sendMessage("I need help with pricing");
 

open()

window.chatsimpleWidget.open() Parameters: None Returns: `void` Example: // Open the widget when user clicks a custom button document.getElementById('chat-help').addEventListener('click', () => { window.chatsimpleWidget.open(); });
 

restart()

window.chatsimpleWidget.restart() Parameters: None Returns: `void` // Reset chat for a new user session function startFreshChat() { window.chatsimpleWidget.restart(); window.chatsimpleWidget.sendMessage("I'm a new visitor, can you help me?"); }
 

identify()

Syntax: window.chatsimpleWidget.identify(metadata) Parameters: - `metadata` (object, required): An object containing user information Common metadata fields: - `name` (string): Full name - `first_name` (string): First name - `last_name` (string): Last name - `email` (string): Email address - `phone` (string): Phone number - `company` (string): Company name - Custom fields as configured in your ChatSimple dashboard Returns: `void` Example: // Basic user identification window.chatsimpleWidget.identify({ name: "John Doe", email: "john@example.com", phone: "+1-555-0123" }); // With custom fields window.chatsimpleWidget.identify({ first_name: "John", last_name: "Doe", email: "john@example.com", company: "Acme Corp", role: "CTO", source: "website-signup" });