Web Chat Javascript API
These are javascript functions made available by Web Chat for custom integrations. All public API functions will be available on the window._ximachat.api object.
Note: For this feature, you must be updated to version 4.0.9 or newer.
Use Cases
- Create your own Web Chat invitation
- Pass custom parameters (like Shopping Cart ID) from a customer’s website interaction to the agent handling their chat.
- Set the target routing skill based on customer context
Current Queue Status Request
_ximachat.api.getQueueStatus(onQueueStatus)
The QueueStatus will inform if there are agents ready for chats. This will fetch the current queue status of Multimedia chat queues from the server. It will execute the onQueueStatus callback function with the QueueStates object.
Arguments | |
---|---|
onQueueStatus Type: Function required | A callback function that accepts the current QueueState. |
{
"Sales": { // Skill name
"estimatedWaitTime": 100,
"theQueueIsEmpty": true,
"thereAreAgentsLoggedIn": false,
"thereAreAgentsReady": false
},
"Support": { // Skill name
"estimatedWaitTime": 100,
"theQueueIsEmpty": true,
"thereAreAgentsLoggedIn": true,
"thereAreAgentsReady": true
}
}
Subscribe to Queue Status
_ximachat.api.subscribeToQueueStatus(onQueueStatus)
The QueueStatus will inform if there are agents ready for chats. This will subscribe a callback function to queue state. Each time the QueueStatus changes on the server the onQueueStatus callback function will be executed.
Arguments | |
---|---|
onQueueStatus Type: Function required | A callback function that accepts the current QueueState. |
{
"Sales": { // Skill name
"estimatedWaitTime": 100,
"theQueueIsEmpty": true,
"thereAreAgentsLoggedIn": false,
"thereAreAgentsReady": false
},
"Support": { // Skill name
"estimatedWaitTime": 100,
"theQueueIsEmpty": true,
"thereAreAgentsLoggedIn": true,
"thereAreAgentsReady": true
}
}
Set Custom Chat Parameters
_ximachat.api.setCustomParameters(customParameters)
Set custom chat parameters. These will be sent to display for the agent that is chatting with the external customer. They are intended to be used to send useful information to the agent chatting with the customer regarding the current page that the customer is on.
Arguments | |
---|---|
customParameters Type: List of CustomParameter required | A list of custom chat parameters. |
{
"Name": “Page Title”,
“Value”: “My Page That Has Chat”
}
Set Active Skill
_ximachat.api.setSkill(skill)
Set active Multimedia skill for chat. This can be used in place of the “URL Mapping” in the chat settings. Normally the URL mapping will decide what skill will be used for the chat based on the URL. If that is not possible, then this function can be used on the page to set the skill used for the chat.
Arguments | |
---|---|
skill Type: String required | The Multimedia skill for the chat. |
Get Active Skill
_ximachat.api.getSkill()
Get active Multimedia skill for chat. If the skill has not been set, then this will be undefined.
Return Value | |
---|---|
Type: String | The Multimedia skill for the chat or undefined. |
Manually Start Chat
_ximachat.api.manuallyStartChat(skill)
Manually start a chat will an agent. This will open the form for the user to enter their information. Once the form is completed, the user will be placed in the queue and an agent will respond when available.
Arguments | |
---|---|
skill Type: String optional | The Multimedia skill for the chat. If this was previously not needed or if left undefined, then the skill will be determined by the URL mappings. |
Manually Start Xima Invite
_ximachat.api.manuallyStartXimaInvite(skill)
This is used if the “Show widget on page load” setting is set to “False.” This is intended to allow the developer of the page to decide when the chat can show and start, as well as to allow the developer to manually setting the skill.
Arguments | |
---|---|
skill Type: String optional | The Multimedia skill for the chat. If this was previously not needed or if left undefined, then the skill will be determined by the URL mappings. |
Updated almost 5 years ago