The non-gadget Python sample presents a Python script that utilizes the Finesse REST APIs to sign in/out, change the agent state, and do a GET on the user. The example script implements the logic to connect to the Finesse Notification Service using the SleekXMPP Library to receive Finesse notifications. Other Python XMPP libraries are also available. All responses and events will simply print to the console. This script does NOT integrate these Finesse notifications back to the User object. This code has been tested with Finesse 11.5 and Python 3.4.2.
This sample contains the following files:
finesse.py
PythonSample.pdf
- The sample gadget and the Finesse JavaScript library requires a deployment that includes Cisco Finesse. If you do not have a system that includes Cisco Finesse, you can reserve a DevNet sandbox for developing your gadget.
- requests: This script requires the requests library to be installed and imported. This library is used to make the Finesse REST API requests. Please see the Usage section for installation instructions.
- XMPP Library: SleekXMPP is the XMPP library used to connect to the Notification Service to receive events. The python script depends on the library be installed and imported. Developers can have a choice of using this library or utilizing their own. Please see the Usage section for installation instructions.
In order to run this Finesse Python script, you will need to install Python, the Requests library, and the SleekXMPP library.
- Install Python
- Install Python 3.4.2 or above for your operating system.
- Download the installer here: https://www.python.org/downloads
- Install the Requests Library
- Learn about the Requests Library
- To install Requests for Python 3 on Mac OS, use these command line commands:
sudo curl -O https://bootstrap.pypa.io/get-pip.py
sudo python3 get-pip.py
pip3 install requests- To install Requests on Windows:
- Pip comes with Python 3.4 Windows
- Check to see if Pip is in your python 3 path:
C:\>pip –V
pip 1.5.6 from C:\Python34\lib\site-packages * If pip is in the Python34 path, the execute
pip install requests- Install SleekXMPP
- Learn about the SleekXMPP Library
- To install SleekXMPP, execute this command line command:
pip3 install sleekxmpp- Run the Finesse Python Script
- Execute this command line command on MacOS:
python3 finesse.py- Execute this command line command on Windows:
py –3 finesse.pyor
python finesse.pyDocumentation for the Finesse REST API can be found in the Finesse Developer Guide.
This sample code is only a sample and is NOT guaranteed to be bug free and production quality.
The sample code is meant to:
- Serve as an example of the step by step process of writing a python script using the Finesse REST APIs.
- Provided as a guide for a developer to see how to use a Python XMPP library to process the Finesse notifications.
Support for the sample code is provided on a "best effort" basis via DevNet. Like any custom deployment, it is the responsibility of the partner and/or customer to ensure that the customization works correctly and this includes ensuring that the sample code is properly integrated into 3rd party applications.
Cisco Systems, Inc.
http://www.cisco.com
http://developer.cisco.com/site/finesse