Developer API

Getting started with the Chime developer API.

Try Cloud Version

Connecting To The Web Client

The web client is accessed by opening a browser window to the url for the webClient.html file, with parameters for the queue to hit, and optionally the user connecting to the chat.

The URL for the web client might look something like: http://Chime.server/Chime/webclient?id=1
Note* - Chime.server is a reference to your internal IP address where Chime is stationed

Opening the web client using JavaScript

To open the web client, first we need to know a couple of values.

Variable Where To Locate
chatURL The Internal Web Client Address found in Queue Settings / Advanced
Ex: http://Chime.server/Chime/webclient?id=1
queueId The Integer at the end of the Internal Web Client Address
Ex: http://Chime.server/Chime/webclient?id=1

Here are some examples on how you might open a chat session with a queue. These examples assume you have jQuery on your page.

Sample Button Markup - The queueId (integer) is included in the markup data-queueid="queueId"


<button id="chat-btn" data-queueid="1">Chat Now!</button>

<!--Using the data-queueid attribute allows the use of the same script for all buttons.
Changing the data-queueid will change which queue the button is referencing. -->
<button id="chat-btn" data-queueid="1">Chat Now!</button>
<button id="chat-btn" data-queueid="2">Chat Now!</button>
<button id="chat-btn" data-queueid="3">Chat Now!</button>

            

Sample Script Launching New Window (using jQuery)


$(document).ready(function() {

    // In this example, we leave off the last number in the URL which signifies the queueId.
    // It will be concatenated when we call our startChat() function.
    var chatURL = "http://Chime.server/Chime/webclient?id=";

    var chatWindow = null;
    var windowFeatures = "width=600,height=600,locationbar=no,toolbar=no,menubar=no,resizable=yes";


   function startChat(queueId){
        if (chatWindow === null || chatWindow.closed) {
            chatWindow = window.open(
                chatURL + queueId,
                "LetsChat",
                windowFeatures
            );
        }else {
            chatWindow.focus();
        }
    }

   // Call function to start chat
    $('#chat-btn').click(function() {
        startChat($(this).data('queueid'))
    });
});

            

Sample Script Using Iframe (using jQuery)


$(document).ready(function() {
    var iframeChatWindow = null;

    var startiframeChat = function() {
        if(iframeChatWindow === null) {
            $('#input-iframe').html('<iframe src="http://Chime.server/Chime/webclient?id=1" id="chat"></iframe>');
        }
        iframeChatWindow = true;
    };

    $(#chat-btn).click(function() {
        startiframeChat();
    });

});

Queue API

Chime for Lync® has an API available to determine queue availability and wait times, which may be useful when exposing click-to-chat links out on various portal pages. This guide should outline the API calls available, and their responses.

All API calls are made as GET requests to ChimeServer/Api/MethodName

Queue Info

Method GetQueueInfo
Parameters queueID (int)
Response

{
    "queueID": 1,
    "queueName": "Main Engineering",
    "isAvailable": true,
    "onlineAgentCount": 1,
    "averageWaitTime": "00:00:00",
    "longestWaitTime": "00:00:00"
}

                        
Sample (using jQuery)

$.get('http://Chime.server/Chime/Api/GetQueueInfo',
    { queueID: 1 },
    function(response){
        //Do something with the response
    }
);

                         

Queue Wait Time

Method GetQueueWaitTime
Parameters queueID (int)
Response

{
    "averageWaitTime": "00:00:00",
    "longestWaitTime": "00:00:00"
}

                    
Sample (using jQuery)

$.get('http://Chime.server/Chime/Api/GetQueueWaitTime',
    { queueID: 1 },
    function(response){
        //Do something with the response
    }
);

                    

Staging External Web Client With Chime Hub

To stage out a click-to-chat link to route conversations through ChimeHub, you will need two pieces of information:

  1. Your Chime Engine name
  2. The Queue ID of the queue you want to expose

The engine name is the name registered with the ChimeHub service, in the Admin > Advanced settings area within the Chime application. The Queue ID is an integer representing the internal ID of the Queue in your Chime system. This can be seen retrieved from the Advanced tab in the Queue Settings for the queue, where Chime displays the URL needed to open a chat window through ChimeHub.

Click steps to expand for screen shot examples.

Note: User must have admin rights to follow instructions below.

For a PDF of the instructions click here » Staging_External_Web_Client_With_Chime_Hub.pdf

After completing the steps above, here is way you could stage the Chime Hub URL:

A click to chat button might look like this:

The markup might look like this:

Queue Info

Method isQueueAvailable
Parameters engineID (string), queueID (int)
Response

    {
    "isAvailable": true,
    }

                    
Sample (using jQuery)

    $.get('https://chimehub.com/Webclient/isQueueAvailable', {
        engineID: 'ChimeDemo',
        queueID: 1
    }, function(data){
        if(data.isAvailable){
            $('.startChimeChat').show();
        } else{
            $('.startChimeChat').hide();
        }
    });