Chats External


External chat sessions through the Xelion API is now DEPRICATED. Use the External Chat Session From Gateway implementation from now on.

External chat sessions can be created to chat to a Xelion line from an external participant. Normally the session is created by the external user. For example from an external website. The session is created through the Xelion API. This has to be done by a Xelion Administrator user for security purposes.

The first step is to create an external chat session. The Xelion phone line that is chatted needs to be specified here. After the session is generated a message can be send to this session.

The contents are the same as a normal chat message but are send through a special send external chat API call. After this API call the external chat is delivered to the internal Xelion line and the Xelion user(s) get a new chat notification.

To get the messages that are currently send in this chat session, use the general get messages call. It is not recommended to poll the messages every couple of seconds. Websockets should be used to get notifications of new chat messages. The "newExternalChatEvent" can be used to receive new chat events of an external chatsession. The websockets can also be used to checkout if the internal Xelion user is typing a new message ("chatTypingEvent"), if the chat session is idle ("chatIsIdleEvent)", if a hearbeat message is send ("chatHeartbeatEvent") or if the chat session is ended ("chatHasBeenEndedEvent").

When a new session is started, an agent is searched. When no agents are available at the moment a "chatNoAgentsAvailableEvent" is sended. After an agent has opened the chat session the "chatHasBeenActivatedEvent" is sended out including the active agent name. The active agent can change during a chat session, if this happens a "chatActiveUserHasBeenChangedEvent" is sended out with the new agent name.
A Xelion admin user is needed to start an external chat. The user credentials should be saved in a save place. It is not recommended to add the Xelion credentials to the front end application. Use some middleware to process the chats and setup the Xelion API sesson.

Example

A small example of an external chat session is availble here.
WARNING: the Xelion credentials are filled in, in this application. Normally the front end application should not do this, but for the example it is not a problem.

The example is a javascript client that starts an external session while sending and receiving messages.
The source is avaiable here.
First fill in the credentials and the line oid and login. After this is done a message can be sended. Unzip the source, and open external_chat.html in a browser

External chat resources

Create External Chat Session

Create an external chat session.

Send External Chat Message

Send message to an external chat session.

Get Chat Session’s Messages

Get all the current messages of the chat session.

External chat message delivered

Set the chat session as delivered for the external user.

External participant is typing

Tell server that the external user is typing a new message.

Websockets

General websocket documentation about the use of websockets.

Chat Has Been Activated Event

Object sended when new "chatHasBeenActivatedEvent" is received through websockets.

New Chat Event

Object sended when new "newExternalChatEvent" is received through websockets.

Chat Delivered Event

Object sended when new "chatHasBeenDeliveredEvent" is received through websockets.

Chat Read Event

Object sended when new "chatHasBeenReadEvent" is received through websockets.

Chat Typing Event

Object sended when new "chatTypingEvent" is received through websockets.

Chat Reassigned Event

Object sended when new "chatActiveUserHasBeenChangedEvent" is received through websockets.

Chat Has Been Ended Event

Object sended when new "chatHasBeenEndedEvent" is received through websockets.