Developer Documentation
API Reference
Everything you need to integrate LaunchChat into your application. Widget API, REST endpoints, and code examples for every framework.
Quick Start
Add the LaunchChat widget to your website in under 2 minutes.
<!-- LaunchChat Widget -->
<script>
window.LaunchChatConfig = {
widgetId: "YOUR_WIDGET_ID"
};
</script>
<script src="https://your-domain.com/widget.js" async></script>Paste before the closing </body> tag.
JavaScript API
Control the widget programmatically using the global LaunchChatWidget object.
Methods
window.LaunchChatWidget.open()Open the chat window
window.LaunchChatWidget.close()Close the chat window
window.LaunchChatWidget.sendMessage(text: string)Send a message programmatically
window.LaunchChatWidget.on(event, callback)Listen to widget events
window.LaunchChatWidget.destroy()Remove the widget from the page
Events
| Event | Data | Description |
|---|---|---|
| open | { timestamp } | Chat window opened |
| close | { timestamp } | Chat window closed |
| message | { content, role } | Message sent or received |
| escalate | { email, message } | User requested human support |
| feedback | { messageId, type } | User gave feedback (positive/negative) |
REST API
For server-side integrations and custom implementations.
POST
/api/widget/chatSend a chat message and receive an AI response.
Request Body
{
"widgetId": "uuid",
"message": "How do I reset my password?",
"conversationId": "uuid (optional)",
"visitorId": "string (optional)"
}Response
{
"conversationId": "uuid",
"messageId": "uuid",
"answer": "To reset your password...",
"citations": [
{ "pageTitle": "Account Settings", "excerpt": "..." }
],
"confidenceScore": 0.85,
"wasRefused": false
}GET
/api/widget/config/[widgetId]Get widget configuration including appearance and settings.
Response
{
"id": "uuid",
"name": "Support Widget",
"appearance": {
"primaryColor": "#6366f1",
"greeting": "Hi! How can I help?",
"position": "bottom-right"
},
"isActive": true
}Configuration Options
LaunchChatConfig
| Option | Type | Default | Description |
|---|---|---|---|
| widgetId | string | required | Your widget ID from the dashboard |
| primaryColor | string | #6366f1 | Brand color (hex) |
| greeting | string | Hi! How can I help? | Welcome message |
| position | string | bottom-right | bottom-right or bottom-left |
| theme | string | light | light, dark, or auto |
AI-Friendly Documentation
For AI coding assistants like Cursor, Windsurf, or Claude Code: