This is a sample project using PureCloud Embeddable Framework and PureCloud SDK. This project is written in Node JS using Express and Mongo DB as the database.
Different functions of the PureCloud Embeddable Framework are used in this project such as Click to Dial, Screen Pop Up and Process Call Logs. Visit this site for more information about Embeddable Framework. For details how to create your own framework.js file, click here.
This application show how PureCloud Platform APIs is called from the client. Outbound APIs are called in this project such as creating a contact list, adding contacts to a contact list and creating a campaign.
For details on how to integrate with PureCloud SDK, client libraries are provided which wrap the REST calls in a simple to use interface. There are two ways of using the Javascript SDK for web app:
- Client-Side Usage
- Local file or CDN reference
- Uses Implicit Grant Authentication
- Server-Side Usage
- Uses NodeJS
- Uses Client Credentials Authentication
This demo uses NodeJS and Client Credentials for Authentication.
These are the functionalities that directly make calls to the PureCloud API for Outbound Dialing:
- Creation of Contact List (/api/v2/outbound/contactlist)
- Adding Contacts to the Contact List (/api/v2/outbound/contactlists/{contactListId})
- Creation of Campaign (/api/v2/outbound/campaigns) - For the creation of the Campaign it’s also required to pull up the Queues and the Contact Lists from the org.
- Getting Progress of Campaign (/api/v2/outbound/campaigns/{campaignId}/progress)
PureCloud has an API Explorer to test API calls in the currently logged in org instance.
You will need the following things properly installed on your computer.
- Git
- Node.js (with NPM)
- Purecloud OAuth Client Id (Implicit Grant) – This will be used by Embedded Framework
- PureCloud OAuth Client ID (Client Credentials) – This will be used by Platform API SDK
- MongoDB
Open Command Prompt and run:
windows: "C:\Program Files\MongoDB\Server\3.6\bin\mongod.exe" --dbpath C:\...\PCDialer\data
osx: mongod --dbpath C:\...\PCDialer\data
Open another Instance of Command Prompt and run:
"C:\Program Files\MongoDB\Server\3.6\bin\mongo.exe"
Update framework.js file:
Copy and paste the Client ID (Implicit Grant) depending on the location to be used by the embedded agent interface.
window.Framework = {
config: {
name:"testApp",
clientIds: {
'mypurecloud.com': '',
'mypurecloud.ie': '',
'mypurecloud.com.au': '',
'mypurecloud.jp': ''
},
Update config.js file:
Copy and paste the Client ID and Secret (Client Credentials) to be used by the Platform API SDK.
module.exports = {
"clientId" : "",
"clientSecret" : ""
}
Open Command Prompt to C:...\PCDialer:
npm install
mac: run "sudo node app.js " in a terminal window
windows: run "node app.js: in a command prompt with elevated privileges.
open web browser to https://localhost/