Contents
API Commands
startChat
Initiates a new chat session with the chat server via GMS. Intended to be used by WebChat widgets only. Should not be invoked manually
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 | Chat Entry Form Data: 'nickname'. |
| firstname | string | Chat Entry Form Data: 'firstname'. |
| lastname | string | Chat Entry Form Data: 'lastname'. |
| string | Chat Entry Form Data: 'email'. | |
| subject | string | 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 | '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 | 'malformed JSON provided in userData property' |
endChat
Ends the chat session with the chat server via GMS. Intended to be used by WebChat widgets only. Should not be invoked manually.
Resolutions
| Status | When | Returns |
|---|---|---|
| resolved | When active session is ended successfully | (AJAX Response Object) |
| rejected | If no chat session is currently active | 'There is no active chat session' |
sendMessage
Send a message from the client to the chat session. Intended to be used by WebChat widgets only. Should not be invoked manually.
Options
| Option | Type | Description |
|---|---|---|
| message | string | The message you want to send. |
Resolutions
| Status | When | Returns |
|---|---|---|
| resolved | When message is successfully sent | (AJAX Response Object) |
| rejected | If no message text provided | 'No message text provided' |
| rejected | If no chat session is currently active | 'There is no active chat session' |
| rejected | When AJAX exception occurs | (AJAX Response Object) |
sendCustomNotice
Send a custom notice from the client to the chat server.
Options
| Option | Type | Description |
|---|---|---|
| message | string | A message you want to send along with the custom notice. |
Resolutions
| Status | When | Returns |
|---|---|---|
| resolved | When message is successfully sent | (AJAX Response Object) |
| rejected | When AJAX exception occurs | (AJAX Response Object) |
sendTyping
Send 'customer typing' notification to chat session. A visual indication will be shown to agent. Intended to be used by WebChat widgets only. Should not be invoked manually.
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 | '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 | '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 | 'Missing or invalid filters provided. Please provide a regular expression or an array of regular expressions.' |
updateUserData
Update the userData associated with the active chat interaction.
Options
| Option | Type | Description |
|---|---|---|
| data | object | Any userData you want to send to the server for this active interaction. |
Resolutions
| Status | When | Returns |
|---|---|---|
| resolved | When userData is successfully sent | (AJAX Response Object) |
| rejected | When AJAX exception occurs | (AJAX Response Object) |
startPoll
Start automatic polling for new messages. Intended to be used by WebChat widgets only. Should not be invoked manually.
Resolutions
| Status | When | Returns |
|---|---|---|
| resolved | When there is an active session | n/a |
| rejected | If no chat session is currently active | 'No active chat session.' |
stopPoll
Stop automatic polling for new messages. Intended to be used by WebChat widgets only. Should not be invoked manually.
Resolutions
| Status | When | Returns |
|---|---|---|
| resolved | When there is an active session | n/a |
| rejected | If no chat session is currently active | 'No active chat session.' |
resetPollExceptions
Reset the poll exception count to 0. pollExceptionLimit is set in the configuration.
Resolutions
| Status | When | Returns |
|---|---|---|
| resolved | Always | n/a |
| rejected | Never | undefined |
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 | '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. Intended to be used by WebChat widgets only. Should not be invoked manually.
Options
| Option | Type | Description |
|---|---|---|
| input | HTML Reference | An HTML reference to a text or textarea input |
Resolutions
| Status | When | Returns |
|---|---|---|
| resolved | When valid HTML input reference is provided | n/a |
| rejected | When invalid or missing HTML input reference | 'Invalid value provided for the 'input' property. An HTML element reference to a textarea or text input is required.' |
