Introduction
This document describes the use cases for ECE 11.6 Chat APIs.
Prerequisites
Requirements
Cisco recommends that you have knowledge of these topics:
Components Used
The information in this document is based on these software and hardware versions:
The information in this document was created from the devices in a specific lab environment. All of the devices used in this document started with a cleared (default) configuration. If your network is live, ensure that you understand the potential impact of any command.
Background Information
eGain has introduced a customer facing API that can be used to show or hide the chat button on the cutomer’s web site.
Chat APIs can be used for the following purposes:
1. Display the chat based on:
- Agent Availability
- Agent Capacity for Chats
- Queue Depth and Wait Time
- Queue Depth and Agent Availability
- Queue Depth, Wait Time and Entry Point Status
2. Submit custom chat surveys.
There are a few use cases that can be realized with the API:
- The Chat button can be enabled or disabled based on the API response
- Get the amount of time a customer has to wait before an agent is available to chat
- Find the position of customer in a queue to estimate how long a customer has to wait before an agent is available to chat
- Write new custom surveys for chat sessions to capture additional data
Agent Availability API
The agent availability API checks if there are any agents available to take the chats from a particular entry point. Media Routing Domain (MRD) restrictions apply for the agent availability. It is recommended to go through the best practices section of MRD configuration to reflect the correct results.
Request
Method
|
URL
|
GET
|
/chat/entrypoint/agentAvailability/id
|
Note: In order to address this API you have to use the following format: http://hostname/system/egain/chat/entrypoint/agentAvilability/1000
URL Parameter
Name
|
Description
|
Type
|
Required
|
Default value for optional parameters
|
ID
|
The ID of the entry point for which you want to check the agent availability
|
long
|
Yes
|
|
Success Codes
200: The agent availability status is returned. A True response means an agent is available. A false response means no agent is available.
Error Codes
500: Unable to retrieve agent availability information.
Response Body
HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8" standalone="yes"/>
<agentAvailability available="true" xmlns:ns2="http://bindIngs.egain.com/chat"
xmlns:ns4="urn:ietf:params:xml:ns:xmpp-stanzas" xmlna:ns3="jabber:client"
xmlns:ns5="http://jabber.org/protocol/httpbind"/>
Agent Capacity API
This API fetches the capacity of all agents to work on new chat activities in the queue mapped to the given entry point. It returns the difference between the maximum load (CTL) that all agents can take and the current load of all agents in the queue of the entry point.
Request
Method
|
URL
|
GET
|
/chat/entrypoint/capacity/id
|
Note: In order to address this API you have to use the following format: http://hostname/system/egain/chat/entrypoint/capacity/1000
URL Parameter
Name
|
Description
|
Type
|
Required
|
Default value for optional parameters
|
ID
|
The ID of the entry point for which you want to check the agent capacity
|
long
|
Yes
|
|
Success Codes
200: The remaining capacity of agents for the entry point is returned. A positive number reflects the remaining capacity. Zero means either there are no agents available in the system, or all agents are working to their maximum load.
Error Codes
500: Unable to retrieve agent capacity information.
Response Body
HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<availableSlots xmlns:ns2="http://bindings.egain.com/chat"
xmlns:ns4="urn:letf:params:xmlms:xmpp-smanzas"
xmlns:ns5="http://jabber.org/protocol/httbind">
<ns2:count>4</ns2:count>
</availableSlots>
Queue Depth and Wait Time API
This API is used to get details of the number of chats waiting in the queue for assignment, and the estimated wait time in the queue.
Request
Method
|
URL
|
GET
|
/chat/entrypoint/liveSessionStatus/id
|
Note: In order to address this API you have to use the following format: http://hostname/system/egain/chat/entrypoint/liveSessionStatus/1000
URL Parameter
Name
|
Description
|
Type
|
Required
|
Default value for optional parameters
|
ID
|
The ID of the entry point for which you want to check the queue depth and the wait time
|
long
|
Yes
|
|
Success Codes
200: Queue depth and wait time is returned
Error Codes
500: Unable to retrieve the queue depth and wait time.
Response Body
HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<sessionStatus xmlns:ns2="http://bindings.egain.com/chat"
xmlns:ns4="urn:letf:params:xmlms:xmpp-smanzas"
xmlns:ns5="http://jabber.org/protocol/httbind">
<ns2:waitTime>3.0</ns2:waitTime>
<ns2:queueDepth>1</ns2: queueDepth >
</sessionStatus>
Queue Depth and Availability API
This API checks eligibility of a chat entry point to handle new chat activities based on the following conditions:
- If there are any agents available to work on new chat activities
- If the queue associated with that entry point has reached its configured maximum depth i.e. total number of chats being processed by the queue is equal to the maximum number of chats that the queue can process at any given point of time
Request
Method
|
URL
|
GET
|
/chat/entrypoint/checkEligibility/id
|
Note: In order to address this API you have to use the following format: http://hostname/system/egain/chat/entrypoint/checkEligibility/1000
URL Parameter
Name
|
Description
|
Type
|
Required
|
Default value for optional parameters
|
ID
|
The ID of the entry point for which you want to check eligibility
|
long
|
Yes
|
|
Success Codes
200: Entry point eligibility is returned. responseType attribute can have any one of the following values:
- 0: The queue associated with this entry point can handle new chats
- 1: No agent is available to work on new chats
- 2: Maximum queue depth has been reached for the queue associated with the given entry point and no new chats will be processed
Error Codes
500: Unable to retrieve the queue depth and wait time.
Response Body
HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<checkEligibility xmlns:ns2="http://bindings.egain.com/chat"
xmlns:ns4="urn:letf:params:xmlms:xmpp-smanzas" xmlns:ns3="jabber:client"
xmlns:ns5="http://jabber.org/protocol/httbind" responseType=0 />
Queue Depth, Availability and Entry Point Status API
This API checks if new chats can be processed by a given chat entry point based on the following conditions:
- Chat entry point is active
- If there are any agents available to work on new chat activities
- If the queue associated with that entry point has reached its configured maximum depth i.e. total number of chats being processed by the queue is equal to the maximum number of chats that the queue can process at any given point of time
Request
Method
|
URL
|
GET
|
/chat/entrypoint/chatAllowed/id
|
Note: In order to address this API you have to use the following format: http://hostname/system/egain/chat/entrypoint/chatAllowed/1000
URL Parameter
Name
|
Description
|
Type
|
Required
|
Default value for optional parameters
|
ID
|
The ID of the entry point for which you want to check if the chat is allowed
|
long
|
Yes
|
|
Success Codes
200: If new chats can be processed by entry point this code is returned. This is identified by value of the attribute allowed. This attribute can have value either true or false. If the value is false, attribute reason can have one of the below values to identify the cause of unavailability:
- queue_depth_reached: Maximm queue depth has reached for the queue associated with the given entry point and no new chat will be processed
- agent_not_available: No agent is available to work on new chat
- service_not_running: Agent assignment service is not running
- invalid_entry_point: Entry point passed in the request is not valid
- entry_point_inactive: Entry point passed in the request is not active
- other: This entry point cannot handle new chats due to other reasons
Error Codes
500: Unable to retrieve whether this entry point can handle new chats.
Response Body
HTTP/1.1 200 OK
<?xml version="1.0. encoding="UTF-8" standalone="yes"?>
<chatAllowed xmlns:ns2="http://bindings.egain.com/chat"
xmlns:ns4="urn:ietf:params:xml:ns:xmpp-stanzas" xmlns”ns3="jabber:client"
xmlns:ns5=:http://jabber.org/protocol/httpbind" allowed="true"/>
Or
HTTP/1.1 200 OK
<?xml version="1.0. encoding="UTF-8" standalone="yes"?>
<chatAllowed xmlns:ns2="http://bindings.egain.com/chat"
xmlns:ns4="urn:ietf:params:xml:ns:xmpp-stanzas" xmlns”ns3="jabber:client"
xmlns:ns5=:http://jabber.org/protocol/httpbind" allowed="false"
reason="entry_point_inactive"/>
Custom Chat Survey API
This API can be used to submit custom survey forms shown at the end of chat session.
Request
Method
|
URL
|
POST
|
/chat/entrypoint/survey
|
Request Body
Name
|
Description
|
Type
|
Required
|
Question
|
Question which is part of the survey that is displayed to the customer
|
String
|
Yes
|
Answer
|
Answer to the corresponding question
|
String
|
Yes
|
Sample Request Body
<egainSurvey sid="1000">
<survey><question>Question 1</question> <answer>Answer 1</answer></survey>
<survey><question>Question 2</question> <answer>Answer 2</answer></survey>
<survey><question>Question 3</question> <answer>Answer 3</answer></survey>
<survey><question>Question 4</question> <answer>Answer 4</answer></survey>
</egainSurvey>
Success Codes
204: Survey is submitted successfully.