Contents
Commands
startChat
Initiates a new chat session with the chat server via GMS
Options
| Option | Type | Description |
|---|---|---|
| userData | object | arbitrary data to attach to the chat session (AKA attachedData). Properties defined here will be merged with default userData set in the configuration object |
| nickname | string | Override Chat Entry Form Data: 'nickname' |
| firstname | string | Override Chat Entry Form Data: 'firstname' |
| lastname | string | Override Chat Entry Form Data: 'lastname' |
| string | Override Chat Entry Form Data: 'email' | |
| subject | string | Override Chat Entry Form Data: 'subject' |
Resolutions
| Status | When | Returns |
|---|---|---|
| resolved | When server confirms session started | (AJAX Response Object) |
| rejected | When an chat session is already active | {'type':'error', 'text':'There is already an active chat session'} |
| rejected | When AJAX exception occurs | (AJAX Response Object) |
| rejected | When server exception occurs | (AJAX Response Object) |
| rejected | When userData is invalid | {'type': 'error', 'text': 'malformed JSON provided in userData property'} |
endChat
Ends the chat session with the chat server via GMS
Resolutions
| Status | When | Returns |
|---|---|---|
| resolved | When active session is ended successfully | (AJAX Response Object) |
| rejected | If no chat session is currently active | {'type':'error', 'text':'There is no active chat session'} |
sendMessage
Send a message from the client to the chat session
Resolutions
| Status | When | Returns |
|---|---|---|
| resolved | When message is successfully sent | (AJAX Response Object) |
| rejected | If no message text provided | {'type':'error', 'text':'No message text provided'} |
| rejected | If no chat session is currently active | {'type':'error', 'text':'There is no active chat session'} |
| rejected | When AJAX exception occurs | (AJAX Response Object) |
sendTyping
Send 'customer typing' notification to chat session. A visual indication will be shown to agent
Resolutions
| Status | When | Returns |
|---|---|---|
| resolved | When AJAX request is successful | (AJAX Response Object) |
| rejected | When AJAX exception occurs | (AJAX Response Object) |
| rejected | If no chat session is currently active | {'type':'error', 'text':'There is no active chat session'} |
sendFilteredMessage
Send a message along with a regular expression to match the message and hide it from the client. Useful for sending codes and tokens through the webchat interface to the Agent Desktop
Options
| Option | Type | Description |
|---|---|---|
| message | string | Message you want to send but don't want to appear in the transcript |
| regex | RegExp | Regular expression to match the message |
Resolutions
| Status | When | Returns |
|---|---|---|
| resolved | When there is an active session | n/a |
| rejected | If no chat session is currently active | {'type':'error', 'text':'No active chat session.'} |
addPrefilter
Add a new regular expression prefilter to the prefilter list. Any messages matched using the prefilters will not be shown in the transcript
Options
| Option | Type | Description |
|---|---|---|
| filters | RegExp or Array of RegExp | Regular Expression(s) to add to the prefilter list |
Resolutions
| Status | When | Returns |
|---|---|---|
| resolved | When valid filters are provided | Array of all registered prefilters |
| rejected | When invalid or missing filters provided | {'type':'error', 'text':'Missing or invalid filters provided. Please provide a regular expression or an array of regular expressions'} |
startPoll
Start automatic polling for new messages
Resolutions
| Status | When | Returns |
|---|---|---|
| resolved | When there is an active session | n/a |
| rejected | If no chat session is currently active | {'type':'error', 'text':'No active chat session.'} |
stopPoll
Stop automatic polling for new messages
Resolutions
| Status | When | Returns |
|---|---|---|
| resolved | When there is an active session | n/a |
| rejected | If no chat session is currently active | {'type':'error', 'text':'No active chat session.'} |
configure
Configure the widget. See configuration page for WebChatService
Options
| Option | Type | Description |
|---|---|---|
| apikey | string | Apigee Proxy secure token |
| endpoint | string | Manually select the endpoint to initiate the chat on |
| dataURL | URL String | URL of GMS server |
| userData | object | Arbitrary JSON attached data to include when initiating a chat |
| ajaxTimeout | number | Number of milliseconds to wait before AJAX timeout |
Resolutions
| Status | When | Returns |
|---|---|---|
| resolved | When configuration options are provided and set | n/a |
| rejected | When no configuration options are provided | {'type': 'error', 'text': 'Invalid configuration'} |
getTranscript
Fetch an array of all messages in the chat session
Resolutions
| Status | When | Returns |
|---|---|---|
| resolved | Always | (Array) |
getAgents
Return a list of agents that have participated in the chat. Includes agent metadata
Resolutions
| Status | When | Returns |
|---|---|---|
| resolved | Always | (Object List) {name: (String), connected: (Boolean), supervisor: (Boolean), connectedTime: (int time),disconnectedTime: (int time)} |
getStats
Return stats on chat session including start time, end time, duration, and list of agents
Resolutions
| Status | When | Returns |
|---|---|---|
| resolved | Always | {agents: (Object), startTime: (int time), endTime: (int time), duration: (int time)} |
registerTypingPreviewInput
Select an HTML input to watch for key events. Used to trigger startTyping and stopTyping automatically.
Options
| Option | Type | Description |
|---|---|---|
| input | HTML Reference | An HTML reference to a text or textarea input |
Resolutions
| Status | When | Returns |
|---|---|---|
| resolved | When valif HTML input reference is provided | n/a |
| rejected | When invalid or missing HTML input reference | {type: 'error', text: 'Invalid value provided for the 'input' property. An HTML element reference to a textarea or text input is required.'} |
