Cention
API Documentation
Cention Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Standard Chat Advanced Functions Manual

When Update
2013-01-24 Create initial version for document
2014-05-14 Add new section about starting chat
2014-05-24 Extend section about status with information about JSONP
2015-02-03 Extend section about status with information about status 4
2016-02-23 Update document for version 4.1
2016-10-13 Update document for version 4.3 - Update for API URL (Chat URL Name)

Introduction

The Cention Standard Chat is a pre-built chat client that can be used with Cention Contact Centre to offer chat on your web site. This chat client is used instead of building your own client by following the Cention Contact Centre Chat Developers Manual. This manual describes advanced functions found in the standard chat that. You are in not in any way required to make use any of these functions to use the Cention Standard Chat. These advanced functions have been made available to make it possible to further integrate your web site with the Cention Standard Chat.

Get status

The chat client has three different statuses. Either it is open and agents are available, closed because no agents are available or closed because the chat client’s opening hours at the current time of the request says the chat as closed.

It is possible to find out what the current status with a web service. The web service is invoked is by performing a HTTP GET request to the right URL.

The corresponding Cention Chat Area Chat URL Name must be configured. This value will be referred to as {ChatURLName} in the rest of this document.

URL

https://api.cention.com/s/demo/external/{ChatURLName}/chat/-/status

Example URL

https://api.cention.com/s/demo/external/marketing/chat/-/status

The web service will return a JSON object with information about the chat area status.

Example return value

{
	status: 1,
	message: "Chat is open with available agents"
}

It is possible to have the status web service return JSONP instead of plain JSON. To that invoke the the following URL.

URL (JSONP)

https://api.cention.com/s/demo/external/{ChatURLName}/chat/-/status/jsonp/mycallback

Example URL

https://api.cention.com/s/demo/external/marketing/chat/-/status/jsonp/mycallback

Example return value

mycallback({ status: 1, message: "Chat is open with available agents" });

Available statuses

Status Message
1 Chat is open with available agents
2 Chat is open but no agents are available
3 Chat is closed
4 Chat is open but queue is full

Note about queue

If chat in your Cention system is configured to put new chat requests in a queue this web service will never return status 2.

This is because when new chat requests are not put in a queue it is not possible to start a new chat if there is no available agent which can be assigned the chat at the exact moment you try to start the chat.

When new chat requests are put in a queue to wait for an available agent it can never be closed because there are no available agents because you will always be allowed to start a chat if the current time is within the chat client’s defined opening hours because you will then wait in the queue until an agent has been assigned to you.

However there is one optional setting which allows you to configure the amount of chat requests that are allowed to wait in the queue at the same time. Status 4 will be returned when the limit is reached.

Start chat

When you visit the chat client in a web browser the first thing you have to do to start a chat with an agent is enter your name and email address and optionally if the chat has been configured that way also enter the first question.

By performing a HTTP POST request to the right URL with the right parameters it is possible to immediately start a chat and in that way bypass the first view were you enter your information. The information is then instead passed in as parameters in the HTTP POST request.

The HTTP POST request will return the HTML for the chat client’s chat view.

Parameters

All parameters are required. However some of them can be empty strings.

Parameter Type Empty Description
name String No Name of the person starting the chat
email String No Email address to person starting the chat
question String Yes First question from person starting the chat
data String Yes External data that will be made available as the externalData field in Chat message object

URL

https://api.cention.com/s/demo/external/{ChatURLName}/chat/-/create

Example URL

https://api.cention.com/s/demo/external/marketing/chat/-/create

Example HTTP POST

POST /external/marketing/chat/-/create HTTP/1.0
Content-Type: application/x-www-form-urlencoded
Content-Length: 166

name=John%20Doe&email=john.doe%40example.com&question=Where%20is%20your%20office%20located%3F&data=%3Cstrong%3EThis%20is%20an%20important%20customer%21%3C%2Fstrong%3E