cancel
Showing results for 
Search instead for 
Did you mean: 
cancel

Spark Up your On-Premises Contact Center, Setup

778
Views
1
Helpful
0
Comments
Contributor

The need for Device Independent Solutions


Controlling and monitoring your Contact Center via a simple and device free interface has been a big challenge for supervisors and system administrators. The Agents themselves would like to achieve tasks that can be done from any device.


The Cisco Contact Centers have rich REST API that are available for any developer to use for create the solutions that are desired. But it has always been a challenge to create solutions that are device independent. Browser based applications are one alternative, but they are a constant challenge to port to various browsers and their versions.

With the introduction of Cisco Spark Messaging, we now have an alternative that is truly device independent. Cisco Spark is an always-on secure way to communicate within an organization. It has a single consistent interface across mobile devices and desktops, and can be used to control and manage your appliances in any on-premises contact center

Architecture

The architecture to deliver the mobile experience for a Cisco on-premises contact center is based on using the Spark Messaging platform on the devices talking to the Contact Center APIs via a Node.JS application in the middle. The Node.JS can be setup in the DMZ so that the on-premises systems do not have to be exposed to the external internet.


Spark Contact Center.jpg

The Node.JS software can be installed and run on most operating systems and is easy to setup and manage. The javascript files that run in the Node.JS environment are simple text and can be edited using any text editor.

Setup NODE.JS

You can get more information about Node.JS here https://nodejs.org/en/

The Node.JS software can be installed and run on most operating systems and is easy to setup and manage. The javascript files that run in the Node.JS environment are simple text and can be edited using any text editor.


A Node.JS community provides JavaScript libraries in the form of Node Packages to ease deployment and development of scripts. For this step we would need the Node package for Cisco Spark to be able to leverage the Spark APIs.

Install the Cisco Spark JavaScript SDK via the NPM


The Cisco Spark API can be easily deployed using a Node Package. For details of how to get access to this and deploy, see here:

https://www.npmjs.com/package/ciscospark

Create a New Room

The Spark Messaging platform is based on the concept of rooms that are the way to communicate with a person or an application. The rooms can be controlled by the System administrators and provide a safe and secure way to control the flow of information.


For this step in the process, we will create a Spark room that will be the point of communication.

Easiest way is to use the API https://api.ciscospark.com/v1/rooms to create a new room.

The Spark developer forum allows the creation of rooms directly from their website here:https://developer.ciscospark.com/endpoint-rooms-post.html

or create using the following HTTP commands

Request

{

      "title": "AnilMediaSenseTest" <Use your Own>

}

Response 200 /success

{

      "id": "… Room ID…",
      "title": "AnilMediaSenseTest",
      "type": "group",
      "isLocked": false,
      "lastActivity": "2016-11-28T05:24:34.806Z",
      "creatorId": "…Creator ID…",
      "created": "2016-11-28T05:24:34.739Z"

}

Create a New JavaScript

I named mine as BasicSparkWriteMessage.js. The code is also available in GitHub at:

https://github.com/anilve/CiscoOnPremRESTAccess

// First define all the required packages

var spark = require('ciscospark');

//Get all the rooms

// Max 1000 rooms in the array

  1. spark.rooms.list({max: 1000})

.then(function(rooms)

{

    console.log ('DEBUG: Rooms Found: ', rooms.length );

        for (var i = 0 ; i < rooms.items.length ; i++)

    {

       // Going through the rooms one by one

       console.log ('DEBUG: Room: ', rooms.items[i].title);

       // Check if you found the room you are looking for

                if ( rooms.items[i].title === 'AnilMediaSenseTest' )

       {

           // Room found

           console.log ('DEBUG: Found Room ' );

                        // Now write a message out to this room

           return spark.messages.create(

           {

              text: 'I am running now!',

                                roomId: rooms.items[i].id

           });

       }

    };

})

.then(function(message)

{

    console.log ('DEBUG: Message Sent');

})

// Catch any errors

.catch(function(reason)

{

    console.log ('ERROR: ', reason);

    process.exit(1);

});

Execute the Script


The script can be run from the command line. It needs your token information to run. The Token is available from the spark developer portal here: https://developer.ciscospark.com/#

Use the following command to run the script:

CISCOSPARK_ACCESS_TOKEN=<Your Token> node BasicSparkWriteMessage.js

The ouput of the script on my computer looks like this

spark-store: constructing boundedStorage

spark-store: retrieving Credentials:authorization

storage: getting binding for `Credentials`

memory-store-adapter: returning binding

spark-store: retrieving Device:@

storage: getting binding for `Device`

memory-store-adapter: returning binding

storage: made binding for `Credentials`

storage: made binding for `Device`

plugin-storage(Device): waiting to init key `@`

plugin-storage(Device): initing `@`

spark-store: retrieving Device:@

storage: getting binding for `Device`

storage: found binding for `Device`

memory-store-adapter: reading `authorization`

memory-store-adapter: reading `@`

plugin-storage(Credentials): waiting to init key `authorization`

plugin-storage(Credentials): initing `authorization`

spark-store: retrieving Credentials:authorization

one flight: attempted to invoke _getBinding while previous invocation still in flight

memory-store-adapter: reading `@`

memory-store-adapter: reading `authorization`

storage(Credentials): no data for `authorization`, continuing

storage(Device): no data for `@`, continuing

plugin-storage(Device): no data for `@`, continuing

plugin-storage(Credentials): no data for `authorization`, continuing

DEBUG: Rooms Found:  191

DEBUG: Room:  AnilMediaSenseTest

DEBUG: Found Room

plugin-storage(Device): waiting to init key `@`

plugin-storage(Device): already inited `@`

plugin-storage(Credentials): waiting to init key `authorization`

plugin-storage(Credentials): already inited `authorization`

DEBUG: Message Sent

Conclusion


Congratulations, you have created your first Node.JS script that was able to connect to the Cisco Spark Messaging system and send a message to a room that you identified.

This is the first step in the process. Once you have the basic ability to send messages down, now we can move on to the more complex steps of communicating information between the Spark rooms and the on-premises systems.

References

Node.JS install and documentation: https://nodejs.org/en/

Cisco Spark Node Manager download: https://www.npmjs.com/package/ciscospark

Cisco Spark Developer resources: https://developer.ciscospark.com/#

Source Code for Node.JS Scripts : https://github.com/anilve/CiscoOnPremRESTAccess

Content for Community-Ad
Cisco Community October 2020 Spotlight Award Winners
This widget could not be displayed.