Skip to main content

Browser SDK

TeleCMI Agent Live Feed

Our browser based javascript agent live feed SDK, send ongoing calls and agent activity status directly to your browser using websocket.

You can install our agent live feed SDK directly from npm or yarn.

Install

npm

npm install telecmi-agent-livefeed

yarn

yarn add telecmi-agent-livefeed

Add a agent live feed library to your webpage

<script src="dist/telecmi-agent-livefeed.min.js"></script>

Get Started

Initialize Telecmi Object

var telecmi = new TeleCMI(); 

Register

Register using our Agent Login API. Once you sucessfully registered with our platform, our platform will create websocket connection between your browser and our TeleCMI platform.

telecmi.start('token')

Connection status Callback

onConnect This callback will trigger when agent live call feed connection will try to establish with our TeleCMI platform.

Connect

telecmi.onConnect=function(data){
//Data is JSON it contain event and status
};

Samples

 telecmi.onConnect=function(data){
if(data.status=='connected'){
//Live call feed ready start subscribe
telecmi.subscribeCalls();
}else if(data.status=='error')
{
// Invalid token please check your token
}
};

List of response

StatusDescription
connectedAgent live call feed connection established
errorAuthentication failed

Set Agent status

Online

Make agent status online

telecmi.setOnline();

Break

Make agent status break/Away

telecmi.setBreak();

Dialer

Make agent status dialer

telecmi.setDialer();

Subscribe

Call Events

Subscribe all incoming and outgoing calls events.

 telecmi.subscribeCalls();

receive incoming and outgoing callbacks

This callback will fire when you receive or make the call.

 telecmi.onCalls=function(data){
//Data is JSON it contain customer number,group id,time and call uuid
};

Example

telecmi.onCalls=function(data){
console.log(data.from) //customer number
console.log(data.agent) //Agent Id
console.log(data.time) //Incomming call time
console.log(data.status) // incomming call status is it answered or still ringing
};

Values

KeyDescription
actionIt defines channel property
  • "ch-c" = call started
  • "ch-s" = call status changed like early,answer
  • "ch-d" = call disconnected
agentA unique Id of the user(agent)
groupA unique Id of the team
fromThe number the call came from
inetnoA unique id of your app
leguuidcustomer channel uuid
namecustomer name if you saved
uuidA unique identifier for this call
statecall status is answered or ringing
  • 'early' = Call ringing to agent
  • 'answer' = Call answered by agent
  • 'bridged' = Call established between customer and agent
  • 'hangup' = Call disconnected

Click here for example.