Table of Contents

ECE Web Service API

Notes

agentAvailability - Agent Availability Check

Note: Returns true even if no agents - if “Agent Available = Not Required” on the Chat entry Config
When set to “required” this goes true as long as one agent is available.
This correctly checks that the agent is skilled in the specific chat queue.

Caveat: To allowing Chat Queuing this must be set to “Not Required - otherwise you get closed message when no agents available”

HTTP GET
http://ucce-ece-db-12.lab2.purplepi.ie/system/egain/chat/entrypoint/agentAvailability/1001

Response:

<agentAvailability available="false"/>

OR

<agentAvailability available="true"/>

Example HTML Source RAW

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<agentAvailability available="true" xmlns:ns5="http://jabber.org/protocol/httpbind" xmlns:ns2="http://bindings.egain.com/chat" xmlns:ns4="jabber:client" xmlns:ns3="urn:ietf:params:xml:ns:xmpp-stanzas"/>

capacity - Agent Capacity Check

This API does not work as I would expect today. It checks against all agents and not (as is necessary) just the revelant agents skilled for that chat.

<availableSlots><ns2:count>1</ns2:count></availableSlots>

http://ucce-ece-db-12.lab2.purplepi.ie/system/egain/chat/entrypoint/capacity/1001

Example of when 0 Agents Available Response:

<availableSlots>
	<ns2:count>0</ns2:count>
</availableSlots>

HTML Source RAW

<div xmlns="http://www.w3.org/1999/xhtml">
	<details open="" class="expandable-body">
		<summary class="expandable-opening">&lt;<span class="start-tag">availableSlots</span>&gt;</summary>
		<div class="expandable-children">
			<div>&lt;<span class="start-tag">ns2:count</span>&gt;<span class="text">0</span>&lt;/<span class="end-tag">ns2:count</span>&gt;</div>
		</div>
	</details>
	<span class="expandable-closing">&lt;/<span class="end-tag">availableSlots</span>&gt;</span>
</div>

Example when 1 agent available that is allowed to handle 3 chats

Response:

<availableSlots>
	<ns2:count>3</ns2:count>
</availableSlots>

liveSessionStatus - Display chat option based on queue depth and wait time

http://ucce-ece-db-12.lab2.purplepi.ie/system/egain/chat/entrypoint/liveSessionStatus/1001
Response:

<sessionStatus>
	<ns2:waitTime>6.0</ns2:waitTime>
	<ns2:queueDepth>0</ns2:queueDepth>
	<ns2:altEngmtTime>0</ns2:altEngmtTime>
</sessionStatus>

Example with 1 chat queuing

Response:

<sessionStatus>
	<ns2:waitTime>6.0</ns2:waitTime>
	<ns2:queueDepth>1</ns2:queueDepth>
	<ns2:altEngmtTime>0</ns2:altEngmtTime>
</sessionStatus>

checkEligibility - Display chat option based on queue depth and agent availability

http://ucce-ece-db-12.lab2.purplepi.ie/system/egain/chat/entrypoint/checkEligibility/1001

Response:

<checkEligibility responseType="0"/>

Note - we get a '0' when no agents logged in - if entry point set to Agent Availability Not required.

chatAllowed - Display chat option based on queue depth, agent availability and entry point status

http://ucce-ece-db-12.lab2.purplepi.ie/system/egain/chat/entrypoint/chatAllowed/1001

<chatAllowed allowed="true"/>

Note: Not sure how useful this is that different from Agent Availability. I do not see an ability to set Chat Queue length on ECE - but maybe could do in ICM?

Sample PHP Code

Using Capacity API

<?php
header("Content-Type: text/plain");
 
$chatentry_id='1001';
$ecehostname='ucce-ece-db-12.lab2.purplepi.ie';
 
$url = 'http://'.$ecehostname.'/system/egain/chat/entrypoint/capacity/'.$chatentry_id;
 
$ch = curl_init($url);
 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPGET, 1);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2); //connection timeout
    curl_setopt($ch, CURLOPT_TIMEOUT, 3); //timeout in seconds for transaction
 
    $output = curl_exec($ch);
    $info = curl_getinfo($ch);
    curl_close($ch);
 
echo $output;
 
$xml_data = str_replace("ns2:","",$output);
 
echo $xml_data;
 
$xml=simplexml_load_string($xml_data);
 
//echo $xml;
print_r($xml);
 
$agentcount=(int) $xml->count;
//echo "AgentCount: $agentcount";
 
if ($agentcount>0) echo "\n$agentcount Agents Available";
if ($agentcount==0) echo "\nNo Agents Available";
?>

Output

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<availableSlots xmlns:ns5="http://jabber.org/protocol/httpbind" xmlns:ns2="http://bindings.egain.com/chat" xmlns:ns4="jabber:client" xmlns:ns3="urn:ietf:params:xml:ns:xmpp-stanzas">
    <ns2:count>1</ns2:count>
</availableSlots>

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<availableSlots xmlns:ns5="http://jabber.org/protocol/httpbind" xmlns:ns2="http://bindings.egain.com/chat" xmlns:ns4="jabber:client" xmlns:ns3="urn:ietf:params:xml:ns:xmpp-stanzas">
    <count>1</count>
</availableSlots>

SimpleXMLElement Object
(
    [count] => 1
)

1 Agents Available