Webchat API Reference
Control the ReplyBase Webchat widget programmatically. Use our JavaScript API to identify users, pass custom context, and trigger widget behavior from your own application.
Global Object
window.ReplyBase object. Ensure the widget script is loaded before calling these methods.Visibility Controls
Methods to control the visibility and state of the chat widget.
ReplyBase('open')Opens the chat widget programmatically.
ReplyBase('close')Closes the chat widget.
ReplyBase('toggle')Toggles the widget state between open and closed.
User & Context API
Pass data from your application into ReplyBase to personalize the AI experience.
identify
Associates a conversation with a specific user in your database.
ReplyBase('identify', {
externalId: 'user_12345',
email: 'customer@example.com',
name: 'John Doe'
});setContext
Passes arbitrary data to the AI. This data is added to the system prompt context.
ReplyBase('setContext', {
plan: 'premium',
last_order_id: 'ORD-9921',
is_verified: true
});Event Listeners
Subscribe to widget events to trigger actions in your own UI.
ReplyBase('on', 'message_received', (data) => {
console.log('User sent a message:', data.text);
});
ReplyBase('on', 'widget_opened', () => {
// Pause your own site's notifications or trackers
});Advanced Customization
Need to white-label the widget or implement custom CSS overrides? Our Enterprise plan offers full access to the Webchat source and custom branding.
Inquire About Enterprise →