Introduction
This guide shows you how to get started with the AutobotX Chat Web SDK. The Web SDK gives businesses and developers the flexibility to build and customize a chat experience that meets their specific design and brand requirements.
The SDK is exposed as window.abxChat. All API methods, events, and constants are accessible through this object. An internal full-form alias window.AutobotXChatWidget is also available but abxChat is the recommended way to interact with the SDK.
Concepts
The Web SDK is a JavaScript library embedded via a script tag. It automatically handles the real-time connection with the chat servers and manages the visitor session. It provides a list of events and convenient methods so you can focus on integration.
API Conventions
- Getter methods (e.g.
.getVisitorInfo()) return values synchronously. - Setter / action methods (e.g.
.setVisitorInfo()) are asynchronous and accept an optional Node.js-style callbackfunction(err, data) { ... }. .on()and.off()(or.un()on the shorthand alias) are the main methods to register/de-register real-time events.
// Getter - synchronous
console.log(abxChat.getVisitorInfo());
// Setter - async with optional callback
abxChat.setVisitorInfo(
{ display_name: 'Jane' },
function(err) {
if (!err) {
console.log('Updated:', abxChat.getVisitorInfo());
}
}
);
// Callback is optional - this also works:
abxChat.setVisitorInfo({ display_name: 'Jane' });Event Registry
The SDK provides an event registry for real-time updates. Register listeners with .on() and remove them with .off(). The .on() method returns an unsubscribe function for convenience.
function listener(detail) { /* ... */ }
// Register
abxChat.on('connection_update', listener);
// De-register (option 1)
abxChat.off('connection_update', listener);
// De-register (option 2) - using .un() alias
abxChat.un('connection_update', listener);
// De-register (option 3) - using return value
var unsub = abxChat.on('chat', listener);
unsub(); // removes the listenerError Handling
There are two types of errors:
- Validation errors — occur when methods are called with invalid parameters. These are logged to the console unless suppressed via
suppress_console_error: trueininit(). You can also capture them via the'error'event. - Execution errors — passed as the first argument to the callback function (
err). If successful,errisnull.
abxChat.init({
account_key: 'YOUR_API_TOKEN',
suppress_console_error: true
});
// Or capture errors via the event
abxChat.on('error', function(err) {
console.error('SDK Error:', err);
});Chat Participants
Every chat participant has a unique nick property. For visitors it is 'visitor'. For agents it follows the format 'agent:<agent-id>'.
Guide
Getting Started
Add the embed script to your page. This creates the widget iframe and exposes window.abxChat and window.abxChat.
<!-- Begin AutobotX Chat Widget -->
<script type="text/javascript">
window.abxChat || (function(d, s, id) {
var w = (window.abxChat = function(c) { w._.push(c); });
w._ = [];
w.q = function() { w._.push([].slice.call(arguments)); };
var m = ['init','open','close','toggle','on','off','identify',
'sendChatMsg','sendTyping','setVisitorInfo','sendOfflineMsg',
'addTags','removeTags','endChat','sendChatRating','sendChatComment',
'sendFile','sendEmailTranscript','sendVisitorPath','updateConfig'];
m.forEach(function(k) { w[k] = function() {
w._.push([k].concat([].slice.call(arguments))); }; });
var e = d.createElement(s);
e.async = true; e.id = id;
e.src = "https://agent-builder.autobotx.ai/api/widget?key=YOUR_KEY";
var t = d.getElementsByTagName(s)[0];
t.parentNode.insertBefore(e, t);
})(document, "script", "autobotx-chat-widget");
</script>
<!-- End AutobotX Chat Widget -->Place this snippet before the closing </body> tag. You can safely call SDK methods immediately — they will be queued and executed once the script loads:
// These work BEFORE the script finishes loading:
abxChat.open();
abxChat.on('connection_update', function(status) {
console.log('Connection:', status);
});Initializing the SDK
If you need to pass additional configuration (e.g. a different API token or suppress errors), call init():
abxChat.init({
account_key: 'YOUR_API_TOKEN',
suppress_console_error: false
});
// Wait for connection before consuming APIs
abxChat.on('connection_update', function(status) {
if (status === 'connected') {
// Ready to use API methods
console.log('Account status:', abxChat.getAccountStatus());
}
});Chat
A chat starts when the visitor or agent sends the first message. When this happens, a chat.memberjoin event fires. Use sendChatMsg() to send messages and endChat() to end the session.
// Send a message
abxChat.sendChatMsg('Hello!', function(err) {
if (!err) console.log('Message sent');
});
// Listen for incoming messages
abxChat.on('chat', function(event_data) {
if (event_data.type === 'chat.msg') {
console.log(event_data.display_name + ': ' + event_data.msg);
}
});Typing
// Tell agents the visitor is typing
abxChat.sendTyping(true);
// Listen for agent typing
abxChat.on('chat', function(event_data) {
if (event_data.type === 'typing') {
console.log('Agent typing:', event_data.typing);
}
});Chat Transcript
Visitors can request the transcript to be emailed when the chat ends:
abxChat.sendEmailTranscript('visitor@example.com', function(err) {
if (!err) console.log('Transcript scheduled');
});Chat Feedback
// Rate the chat
abxChat.sendChatRating('good', function(err) { /* ... */ });
// Leave a comment
abxChat.sendChatComment('Very helpful!', function(err) { /* ... */ });Attachments
// Send a file (max 20MB)
var fileInput = document.getElementById('fileInput');
abxChat.sendFile(fileInput.files[0], function(err, data) {
if (!err) {
console.log('File URL:', data.url);
}
});
// Receive attachments via 'chat' event
abxChat.on('chat', function(event_data) {
if (event_data.type === 'chat.file') {
console.log('Attachment:', event_data.attachment.url);
}
});Offline Messages
abxChat.sendOfflineMsg({
name: 'John',
email: 'john@example.com',
phone: '12345678',
message: 'Please get back to me'
}, function(err) {
if (!err) console.log('Offline message sent');
});API Reference
The complete list of API methods available on abxChat (and abxChat).
abxChat.init(options)
Initializes the SDK with your API token and optional configuration.
| Parameter | Type | Required | Description |
|---|---|---|---|
options | Object | Yes | Configuration object |
Properties of options:
| Parameter | Type | Required | Description |
|---|---|---|---|
account_key | String | Yes | Your API token (also accepts apiToken) |
suppress_console_error | Boolean | No | Set true to suppress validation errors in the console. Defaults to false. |
abxChat.init({
account_key: 'YOUR_API_TOKEN',
suppress_console_error: false
});abxChat.getAccountStatus()
Returns the current account status synchronously.
Sync Getter| Value | Type | Description |
|---|---|---|
'online' | String | Account is online |
'away' | String | Account is away |
'offline' | String | Account is offline |
var status = abxChat.getAccountStatus();
// 'online'abxChat.getConnectionStatus()
Returns the current connection state synchronously.
Sync Getter| Value | Type | Description |
|---|---|---|
'connected' | String | Connection established |
'connecting' | String | Connection in progress |
'closed' | String | Connection closed |
var conn = abxChat.getConnectionStatus();
// 'connected'abxChat.getVisitorInfo()
Returns the current visitor's information synchronously.
Sync GetterReturned VisitorInfo object:
| Value | Type | Description |
|---|---|---|
display_name | String | Display name of visitor |
email | String | Email of visitor |
phone | String | Phone number of visitor |
var info = abxChat.getVisitorInfo();
// { display_name: 'John', email: 'john@example.com', phone: '' }abxChat.setVisitorInfo(options, callback)
Updates the current visitor's information.
Async ActionCallback Optional| Parameter | Type | Required | Description |
|---|---|---|---|
options | Object | Yes | Visitor info to update |
callback | Function | No | Optional Node.js-style callback (err, data) |
Properties of options:
| Parameter | Type | Required | Description |
|---|---|---|---|
display_name | String | No | Display name (max 255 chars) |
email | String | No | Must match EMAIL_REGEX |
phone | String | No | Numeric, max 25 chars |
abxChat.setVisitorInfo({
display_name: 'Jane Doe',
email: 'jane@example.com'
}, function(err) {
if (!err) console.log('Updated');
});
// Without callback (also valid)
abxChat.setVisitorInfo({ display_name: 'Jane' });abxChat.sendVisitorPath(options, callback)
Sends the visitor's current page path. Useful for single-page apps to track navigation.
Async ActionCallback Optional| Parameter | Type | Required | Description |
|---|---|---|---|
options | Object | Yes | Page information |
callback | Function | No | Optional callback |
Properties of options:
| Parameter | Type | Required | Description |
|---|---|---|---|
title | String | Yes | Page title |
url | String | Yes | Valid URL |
abxChat.sendVisitorPath({
title: 'Pricing',
url: 'https://example.com/pricing'
});abxChat.getQueuePosition()
Returns the visitor's queue position as an integer. Returns 0 if not in queue.
Sync Getter| Value | Type | Description |
|---|---|---|
queue_position | Integer | Visitor's position in the queue, or 0 |
var pos = abxChat.getQueuePosition();
// 3abxChat.getAllDepartments()
Returns an array of all departments.
Sync GetterDepartment object:
| Value | Type | Description |
|---|---|---|
id | Integer | Department ID |
name | String | Department name |
status | String | 'online', 'away', or 'offline' |
var depts = abxChat.getAllDepartments();
// [{ id: 1, name: 'Sales', status: 'online' }, ...]abxChat.getDepartment(id)
Returns a specific department by ID.
Sync Getter| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer | Yes | Department ID |
var dept = abxChat.getDepartment(1);
// { id: 1, name: 'Sales', status: 'online' }abxChat.getVisitorDefaultDepartment()
Returns the visitor's default department, or undefined if not set.
Sync GetterabxChat.setVisitorDefaultDepartment(id, callback)
Sets the visitor's default department.
Async ActionCallback Optional| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer | Yes | Department ID |
callback | Function | No | Optional callback |
abxChat.setVisitorDefaultDepartment(1, function(err) {
if (!err) console.log('Default department set');
});abxChat.clearVisitorDefaultDepartment(callback)
Clears the visitor's default department. Only works before chat starts.
Async ActionCallback Optional| Parameter | Type | Required | Description |
|---|---|---|---|
callback | Function | No | Optional callback |
abxChat.sendChatMsg(msg, callback)
Sends a chat message from the visitor. Should only be used when the account is online.
Async ActionCallback Optional| Parameter | Type | Required | Description |
|---|---|---|---|
msg | String | Yes | Message to send (1-2000 chars) |
callback | Function | No | Optional callback |
abxChat.sendChatMsg('Hello!', function(err) {
if (!err) console.log('Sent');
});abxChat.sendFile(file, callback)
Sends a file attachment from the visitor. Max file size: 20MB.
Async ActionCallback Optional| Parameter | Type | Required | Description |
|---|---|---|---|
file | File | Yes | File object to send |
callback | Function | No | Callback with (err, data). Data has: mime_type, name, size, url |
abxChat.sendFile(file, function(err, data) {
if (!err) {
console.log('Uploaded:', data.name, data.url);
}
});abxChat.sendOfflineMsg(options, callback)
Sends an offline message when the account or department is offline.
Async ActionCallback Optional| Parameter | Type | Required | Description |
|---|---|---|---|
options | Object | Yes | Message data |
callback | Function | No | Optional callback |
Properties of options:
| Parameter | Type | Required | Description |
|---|---|---|---|
name | String | Yes | Visitor name (max 255 chars) |
email | String | Yes | Must match EMAIL_REGEX |
phone | String | No | Phone (numeric, max 25 chars) |
message | String | Yes | The offline message |
abxChat.sendOfflineMsg({
name: 'John',
email: 'john@example.com',
phone: '12345678',
message: 'I need help with my order'
}, function(err) {
if (!err) console.log('Offline message sent');
});abxChat.addTags(tags, callback)
Adds visitor tags. Tags are automatically lowercased.
Async ActionCallback Optional| Parameter | Type | Required | Description |
|---|---|---|---|
tags | Array[String] | Yes | Tags to add |
callback | Function | No | Optional callback |
abxChat.addTags(['vip', 'premium'], function(err) {
if (!err) console.log('Tags added');
});abxChat.removeTags(tags, callback)
Removes existing visitor tags.
Async ActionCallback Optional| Parameter | Type | Required | Description |
|---|---|---|---|
tags | Array[String] | Yes | Tags to remove |
callback | Function | No | Optional callback |
abxChat.removeTags(['vip'], function(err) { /* ... */ });abxChat.sendTyping(is_typing)
Sends the visitor's typing status to the agents.
| Parameter | Type | Required | Description |
|---|---|---|---|
is_typing | Boolean | Yes | true if typing, false otherwise |
abxChat.sendTyping(true); // visitor is typing
abxChat.sendTyping(false); // visitor stoppedabxChat.getChatInfo()
Returns the visitor's rating and comment for the current chat.
Sync GetterChatInfo object:
| Value | Type | Description |
|---|---|---|
rating | String | null | 'good', 'bad', or null |
comment | String | null | Visitor comment or null |
var info = abxChat.getChatInfo();
// { rating: 'good', comment: 'Very helpful' }abxChat.sendChatRating(rating, callback)
Sends the visitor's chat rating.
Async ActionCallback Optional| Parameter | Type | Required | Description |
|---|---|---|---|
rating | String | Yes | 'good', 'bad', or null to remove |
callback | Function | No | Optional callback |
abxChat.sendChatRating('good', function(err) { /* ... */ });abxChat.sendChatComment(comment, callback)
Sends the visitor's chat comment.
Async ActionCallback Optional| Parameter | Type | Required | Description |
|---|---|---|---|
comment | String | Yes | Comment text (max 1000 chars) |
callback | Function | No | Optional callback |
abxChat.sendChatComment('Great support!', function(err) { /* ... */ });abxChat.isChatting()
Returns whether there is an ongoing chat session.
Sync Getter| Value | Type | Description |
|---|---|---|
true | Boolean | There is an ongoing chat |
false | Boolean | No active chat |
if (abxChat.isChatting()) {
console.log('Chat in progress');
}abxChat.getChatLog()
Returns the chat log messages for the current session. This is a convenience getter for the chat event.
Sync Gettervar log = abxChat.getChatLog();
// Returns a Promise that resolves to an array of chat messagesabxChat.getServingAgentsInfo()
Returns information about agents currently serving in the chat.
Sync GetterAgentInfo object:
| Value | Type | Description |
|---|---|---|
nick | String | Agent nick (e.g. 'agent:123') |
display_name | String | Agent display name |
avatar_path | String | URL to agent avatar |
title | String | Agent title / byline |
var agents = abxChat.getServingAgentsInfo();
// [{ nick: 'agent:1', display_name: 'Agent Smith', ... }]abxChat.getOperatingHours()
Returns the account's operating hours, or undefined if not configured.
Sync GetterOperatingHours object:
| Value | Type | Description |
|---|---|---|
enabled | Boolean | true if operating hours is enabled |
type | String | 'account' or 'department' |
timezone | String | Timezone string |
account_schedule | Schedule | Account schedule (if type is 'account') |
department_schedule | Object | Department schedules (if type is 'department') |
var hours = abxChat.getOperatingHours();
// { enabled: true, type: 'account', timezone: 'America/New_York', ... }abxChat.sendEmailTranscript(email, callback)
Schedules the chat transcript to be emailed when the chat ends.
Async ActionCallback Optional| Parameter | Type | Required | Description |
|---|---|---|---|
email | String | Yes | Valid email address |
callback | Function | No | Optional callback |
abxChat.sendEmailTranscript('john@example.com', function(err) {
if (!err) console.log('Transcript scheduled');
});abxChat.fetchChatHistory(callback)
Fetches past chat history. Paginated internally — successive calls fetch older items.
Async ActionCallback Optional| Parameter | Type | Required | Description |
|---|---|---|---|
callback | Function | No | Callback with (err, data). Data has: count, has_more |
abxChat.fetchChatHistory(function(err, data) {
if (!err) {
console.log('Fetched', data.count, 'items');
console.log('Has more:', data.has_more);
}
});abxChat.markAsRead()
Updates the last read timestamp. Only works during an active chat.
abxChat.markAsRead();abxChat.reconnect()
Reconnects when the connection status is 'closed'.
if (abxChat.getConnectionStatus() === 'closed') {
abxChat.reconnect();
}abxChat.endChat(options, callback)
Ends the current chat session.
Async ActionCallback Optional| Parameter | Type | Required | Description |
|---|---|---|---|
options | Object | No | End chat options |
callback | Function | No | Optional callback |
Properties of options:
| Parameter | Type | Required | Description |
|---|---|---|---|
clear_dept_id_on_chat_ended | Boolean | No | true to reset department on next chat. Defaults to false. |
abxChat.endChat(
{ clear_dept_id_on_chat_ended: true },
function(err) { /* ... */ }
);abxChat.logout()
Logs out an authenticated visitor. Closes the connection. Re-initialize with init() to reconnect.
abxChat.logout();Constants
abxChat.EMAIL_REGEX / abxChat.EMAIL_REGEX
The email validation regex used by the SDK.
var regex = abxChat.EMAIL_REGEX;
// /^[^\s@]+@[^\s@]+\.[A-Z|a-z]{2,}\b/Internal rate-limiting constants:
| Constant | Value |
|---|---|
MAX_CHAT_MESSAGE_LENGTH | 2000 |
MIN_CHAT_MESSAGE_LENGTH | 1 |
MAX_CHAT_COMMENT_LENGTH | 1000 |
MAX_DISPLAY_NAME_LENGTH | 255 |
MAX_PHONE_LENGTH | 25 |
MAX_TAGS_PER_SESSION | 50 |
MAX_TAG_LENGTH | 50 |
MAX_OFFLINE_MESSAGE_LENGTH | 2000 |
MAX_OFFLINE_MESSAGES_PER_MINUTE | 5 |
MAX_CHAT_MESSAGES_PER_MINUTE | 10 |
MAX_FILE_SEND_OPERATIONS_PER_MINUTE | 10 |
FILE_SEND_TIMEOUT | 30000 ms |
CHAT_HISTORY_ITEMS_PER_PAGE | 20 |
Events
Real-time events are emitted and can be listened to via .on(event_name, handler) and removed via .off(event_name, handler).
'account_status' event
Fired when the account's online/offline status changes.
| Value | Type | Description |
|---|---|---|
'online' | String | Account is online |
'away' | String | Account is away |
'offline' | String | Account is offline |
abxChat.on('account_status', function(status) {
console.log('Account is now:', status);
});'connection_update' event
Fired when the WebSocket connection state changes.
| Value | Type | Description |
|---|---|---|
'connecting' | String | Connection is being established |
'connected' | String | Connection established, data is current |
'closed' | String | Connection closed |
abxChat.on('connection_update', function(status) {
if (status === 'connected') {
// Safe to use API methods
}
});'department_update' event
Fired when any department's status changes.
Department object:
| Value | Type | Description |
|---|---|---|
id | Integer | Department ID |
name | String | Department name |
status | String | 'online', 'away', or 'offline' |
abxChat.on('department_update', function(dept) {
console.log(dept.name, 'is', dept.status);
});'visitor_update' event
Fired when the visitor's information changes.
abxChat.on('visitor_update', function(visitorInfo) {
console.log('Visitor:', visitorInfo.display_name);
});'agent_update' event
Fired when an agent's information changes (e.g., agent joins chat).
AgentInfo object:
| Value | Type | Description |
|---|---|---|
nick | String | Agent nick |
display_name | String | Agent name |
avatar_path | String | Avatar URL |
title | String | Agent title |
abxChat.on('agent_update', function(agentInfo) {
console.log('Agent joined:', agentInfo.display_name);
});'chat' Event
The chat event encompasses all real-time chat activity. The event_data.type property indicates the specific type:
| Type | Description |
|---|---|
chat.msg | A chat message arrives |
chat.file | A file attachment arrives |
chat.queue_position | Visitor's queue position changed |
chat.memberjoin | Visitor or agent joins the chat |
chat.memberleave | Visitor or agent leaves the chat |
chat.request.rating | Agent requests a rating |
chat.rating | Visitor updates chat rating |
chat.comment | Visitor updates chat comment |
typing | Agent starts or stops typing |
last_read | Last read timestamp updated |
chat.msg
Fired when a chat message arrives.
| Value | Type | Description |
|---|---|---|
type | String | Always 'chat.msg' |
nick | String | Sender nick |
display_name | String | Sender display name |
timestamp | Integer | Server timestamp in ms |
msg | String | Message content |
abxChat.on('chat', function(e) {
if (e.type === 'chat.msg') {
console.log(e.display_name + ': ' + e.msg);
}
});chat.file
Fired when a file attachment is received.
| Value | Type | Description |
|---|---|---|
type | String | Always 'chat.file' |
nick | String | Sender nick |
display_name | String | Sender display name |
timestamp | Integer | Server timestamp in ms |
attachment | Attachment | File attachment object |
Attachment object:
| Value | Type | Description |
|---|---|---|
mime_type | String | MIME type (e.g. 'image/png') |
name | String | File name |
size | Integer | File size in bytes |
url | String | URL to the file |
abxChat.on('chat', function(e) {
if (e.type === 'chat.file') {
console.log('File:', e.attachment.name, e.attachment.url);
}
});chat.queue_position
Fired when the visitor's position in the wait queue changes.
| Value | Type | Description |
|---|---|---|
type | String | Always 'chat.queue_position' |
nick | String | Always 'system:queue' |
queue_position | Integer | Position in queue, or 0 if not queued |
abxChat.on('chat', function(e) {
if (e.type === 'chat.queue_position') {
console.log('Queue position:', e.queue_position);
}
});chat.memberjoin
Fired when a visitor or agent joins the chat.
| Value | Type | Description |
|---|---|---|
type | String | Always 'chat.memberjoin' |
nick | String | Participant nick |
display_name | String | Participant display name |
timestamp | Integer | Server timestamp in ms |
abxChat.on('chat', function(e) {
if (e.type === 'chat.memberjoin') {
console.log(e.display_name + ' joined');
}
});chat.memberleave
Fired when a visitor or agent leaves the chat.
| Value | Type | Description |
|---|---|---|
type | String | Always 'chat.memberleave' |
nick | String | Participant nick |
display_name | String | Participant display name |
timestamp | Integer | Server timestamp in ms |
abxChat.on('chat', function(e) {
if (e.type === 'chat.memberleave') {
console.log(e.display_name + ' left');
}
});chat.request.rating
Fired when an agent requests a rating from the visitor.
| Value | Type | Description |
|---|---|---|
type | String | Always 'chat.request.rating' |
nick | String | Agent nick |
display_name | String | Agent display name |
timestamp | Integer | Server timestamp in ms |
chat.rating
Fired when the visitor updates the chat rating.
| Value | Type | Description |
|---|---|---|
type | String | Always 'chat.rating' |
nick | String | Always 'visitor' |
new_rating | String | undefined | New rating ('good' or 'bad') |
rating | String | undefined | Previous rating |
chat.comment
Fired when the visitor updates the chat comment.
| Value | Type | Description |
|---|---|---|
type | String | Always 'chat.comment' |
nick | String | Always 'visitor' |
new_comment | String | undefined | New comment |
comment | String | undefined | Previous comment |
typing
Fired when an agent starts or stops typing.
| Value | Type | Description |
|---|---|---|
type | String | Always 'typing' |
nick | String | Agent nick |
typing | Boolean | true if agent is typing |
abxChat.on('chat', function(e) {
if (e.type === 'typing') {
console.log(e.nick, 'typing:', e.typing);
}
});last_read
Fired when the last read timestamp is updated.
| Value | Type | Description |
|---|---|---|
type | String | Always 'last_read' |
nick | String | Participant nick |
timestamp | Integer | Server timestamp in ms |
'history' event
Emitted when chat history items are fetched via fetchChatHistory(). Follows the same type structure as 'chat' events.
abxChat.on('history', function(event_data) {
if (event_data.type === 'chat.msg') {
console.log('History message:', event_data.msg);
}
});'error' event
Fired when a validation error occurs.
| Value | Type | Description |
|---|---|---|
message | String | Error message |
context | String | Method that triggered the error |
extra | Any | Additional error info |
abxChat.on('error', function(err) {
console.error('SDK error in', err.context, ':', err.message);
});Pre-load Queue & Aliases
Pre-load Command Queue
The embed snippet creates abxChat as a lightweight stub with method queuing. You can call SDK methods before the script finishes loading — they are queued and automatically replayed once the SDK is ready. Both styles work:
// Style 1: Direct method calls (queued automatically)
abxChat.open();
abxChat.on('connection_update', function(status) {
console.log(status);
});
abxChat.sendChatMsg('Hello!');
// Style 2: Callback wrapper (also queued)
abxChat(function() {
// Runs once SDK is fully loaded
console.log('Status:', abxChat.getAccountStatus());
});.un() Alias
abxChat.un(event, handler) is a convenience alias for .off(event, handler). Both do the same thing:
// These are equivalent:
abxChat.off('chat', handler);
abxChat.un('chat', handler);Alternate Global Name
The SDK is also accessible via window.AutobotXChatWidget (internal full-form name). Both globals point to the same API. Use abxChat in your integration code.
Extended API
These are additional methods beyond the core chat SDK surface.
Widget Control
| Method | Returns | Description |
|---|---|---|
open() | void | Opens the chat widget |
close() | void | Closes the chat widget |
toggle() | void | Toggles widget open/closed |
isOpen() | Promise<boolean> | Returns whether the widget is open |
identify(userData) | void | Sends user identification to the widget |
updateConfig(config) | void | Updates widget configuration |
// Open the widget
abxChat.open();
// Identify a user
abxChat.identify({
name: 'John Doe',
email: 'john@example.com',
id: '12345'
});Tags (Extended)
| Method | Description |
|---|---|
getTags(callback) | Gets current visitor tags |
clearTags(callback) | Clears all visitor tags |
Tracking & Privacy
| Method | Description |
|---|---|
enableURLTracking() | Enables URL change tracking |
disableURLTracking() | Disables URL change tracking |
enableReferrerTracking() | Enables referrer tracking |
disableReferrerTracking() | Disables referrer tracking |
enableVisitorTracking() | Enables visitor activity tracking |
disableVisitorTracking() | Disables visitor activity tracking |
setConsent({ analytics, functional }) | Sets GDPR consent preferences |
getConsent() | Gets current consent state |
deleteUserData() | Deletes all stored user data |
exportUserData() | Exports all stored user data |
getReferrerData() | Returns referrer tracking data |
getTrafficSource() | Returns traffic source classification |
getCampaignData() | Returns UTM / campaign data |
Capabilities
| Method | Returns | Description |
|---|---|---|
getCapabilities() | Object | Detected browser capabilities |
getCapabilityTier() | Number | 1=CORE, 2=ENHANCED, 3=ADVANCED |
isFeatureSupported(feature) | Boolean | Checks if a feature is supported |
getStorageType() | String | 'localStorage' or 'memoryCache' |
enableFingerprinting() | void | Enables device fingerprinting |
disableFingerprinting() | void | Disables device fingerprinting |
generateFingerprint() | Object|null | Generates device fingerprint |
getFingerprint() | Object|null | Returns current fingerprint |
getFingerprintSignature() | String|null | Returns fingerprint signature |
getFingerprintConfidence() | Number | Returns fingerprint confidence (0-1) |