Overview

The 8x8 Recording Control API is an HTTP API that allows tenant to pause and resume the audio feed to your call recording. If you also use Quality Management screen recording the screen recording will be paused during the time the audio is paused.  The typical usage of this API is for CRM triggers to control when to pause and resume call recording during a transaction. Since the API only pauses the audio feed to your recording, there will be silence in the portion of the recording where the pause was initiated.
This document describes the supported parameters for running Recording Control API. Example use cases are provided for reference.
There are three different APIs to control the recording. All these APIs have the same function, but with different parameters and requirements
The first API is authenticated using client cookie along with tenant API action token. Agents with valid 8x8 Agent Workspace session and valid tenant API action token will be able to run the API. The API can only be successfully run on thebrowser window that shares the session as the agent UI. 
If the requirement is to issue the request outside the context of the agent browser session one of the following two appoaches must be used.
The second API is accessed by providing tenantId and agentId. This one is authenticated with basic Auth, which needs tenantId as the username and action token of the tenant as the password. It can be accessed by using curl or postman.
The third API is accessed by providing tenantId and agent email address. The agent email address must be unique in this case to keep the function working. This API is authenticated with basic Auth, which needs tenantId as the username and action token of the tenant as the password. It can be accessed by using curl or postman.
For security reasons, the Recording Control API only accepts requests using HTTPS, so that request headers and response data are encrypted.

API Usage Leveraging the session cookie from agent browser.

The examples in this section WILL ONLY work when issued with the context of the agent session and where the cookie is passed.  If you wish to issue the command from outside this context use the PUT and agentId or agentEmail as described in the following section.
The Recording Control API makes it easy to submit a query, for experimentation, testing or debugging purposes. From a web browser, simply enter the URL. You will be prompted to close the window. In the meantime, the corresponding request will be sent. For example:
https://vcc-na4.8x8.com/AGUI/controlRecording.php?action=pause&token=d3078e5b5817f3a8ad4baf32adc124cf
Will pause the recording of the active line for agent sharing the same session with agent login on the browser.
Revise your query URL based on the login URL of your Tenant. Refer to the Platform URL Guide to retrieve your login URL.

Query Parameters

GET/POST Parameters
The following parameters are allowed to GET or POST parameters passing along with the Control Recording URL. All the parameter data should be URL encoded.
The agents session cookie must accompany the request, if making the request outside the context of the agent session leverage the agentId/email approach in the following section.
Parameter Name Description Accepted Value
action Control action pause or resume
token Authentication token Valid action token generated by Contact Center Configuration Manager for the tenant

Examples

Example 1: The following request pauses the current recording:
https://vcc-na7.8x8.com/AGUI/controlRecording.php?action=pause&token=d3078e5b5817f3a8ad4baf32adc124cf
Example 2: The following request resumes the current recording:
https://vcc-na7.8x8.com/AGUI/controlRecording.php?action=resume&token=d3078e5b5817f3a8ad4baf32adc124cf
Example 3: The following JavaScript code sample shows how to implement a dynamic approach to resume or pause the current recording:
function controlRecording(action) {
        var query = [
            "action=" + action,
            "token=d3078e5b5817f3a8ad4baf32adc124cf"
        ];

        var url = "https://vcc-instance.8x8.com/AGUI/controlRecording.php?" + query.join("&");
        var iframe = document.createElement('iframe');
        iframe.src = url;
        iframe.onload = function () {
            document.body.removeChild(iframe);
        }
        document.body.appendChild(iframe);
    }

    controlRecording("resume"); // or "pause"

API leveraging tenantId and agentId or email to identify agent from any source.

These requests DO NOT require the agent session cookie and can be issued from any source.
In a Linux environment, the curl utility will submit an HTTP request, and allow you to view the result.
curl -X PUT -u {tenantId}:{token} 'https://vcc-sb1.8x8.com/api/tstats/rccontrol/{action}/{tenantId}/agentId/{agentId}'
curl -X PUT -u {tenantId}:{token} 'https://vcc-sb1.8x8.com/api/tstats/rccontrol/{action}/{tenantId}/email/{email}'

Query Parameters

PUT Parameters
Parameter Name Description Accepted Value
action Control action pause or resume
token Authentication token Valid action token generated by Configuration Manager for Contact Center for the tenant
tenantID Tenant Object ID Object ID of target tenant
agentID Agent Object ID Object ID of target agent
email Agent email address Email address of the target agent

Examples

Example 1
The following requests can pause the current recording, either of them can be used to pause:
curl -X PUT -u dev10pedro:00a5c5dd78ba119df8e361288b709e4c2d19ef440c0f2af96d48ead1faa78c9b 'https://vcc-sb1.8x8.com/api/tstats/rccontrol/pause/dev10pedro/agenId/yzhuang'
 curl -X PUT -u dev10pedro:00a5c5dd78ba119df8e361288b709e4c2d19ef440c0f2af96d48ead1faa78c9b 'https://vcc-sb1.8x8.com/api/tstats/rccontrol/pause/dev10pedro/email/yiyang.zhuang@8x8.com'
Example 2
The following requests can resume the current recording, either of them can be used to resume: 
curl -X PUT -u dev10pedro:00a5c5dd78ba119df8e361288b709e4c2d19ef440c0f2af96d48ead1faa78c9b 'https://vcc-sb1.8x8.com/api/tstats/rccontrol/resume/dev10pedro/agenId/yzhuang'
curl -X PUT -u dev10pedro:00a5c5dd78ba119df8e361288b709e4c2d19ef440c0f2af96d48ead1faa78c9b 'https://vcc-sb1.8x8.com/api/tstats/rccontrol/resume/dev10pedro/email/yiyang.zhuang@8x8.com'

Response Codes

Code Number Code Label Description
200 (Status: success) OK The request was successful. Attempt to close browser window for the successful request.
200 (Status: nothing to be modified) OK There is no active transaction when the recording control API is called.
200 (Status: not enabled) OK The recording feature is not enabled for the target agent.
400 Bad request The action type is not known from the request.
401 Unauthorized The request was not allowed, usually due to incorrect authentication or invalid Agent Workspace session.
404 Not found The Agent is not found in the target Tenant.
500 Server Error Internal server error to prevent the request to be completed.

Additional Information

  • There is no return error for any failure of pausing or resuming recordings.
  • There is no support for starting recording from this API. For the transaction that recording has not been started, pause and resume requests will be ignored.
  • The request applies on the active transaction the corresponding agent is currently with.

Overview

The 8x8 real time statistics reporting API is composed of a set of URIs that identify and request real time statistical data from the 8x8 system. This style of API makes it very easy to compose and send a query, which is always done using an HTTP GET request.
The API provides real time data about agents and queues. It allows queries on all agents and queues or particular agent and queue with provided ID. The data returned by the API is from a server cache that is refreshed every 10 seconds. All API requests are authenticated using a token that is issued to a valid 8x8 tenant. The API supports XML and JSON as the response formats. For security reasons, the Real Time Statistics API only accepts request using HTTPS, so that request headers and response data are encrypted.

Testing Using A Browser

The Statistics API makes it easy to submit a query, for experimentation, testing or debugging purposes. From a web browser, simply enter the URL. You will be prompted to enter a username and password. Enter your tenant name as the username, and your authentication token as the password. Then, the query result will be displayed in your browser. For example,
https://vcc-na4.8x8.com/api/rtstats/stats/agents
will return information about all agents in XML format.
Revise your query URL based on the login URL of your Tenant. (Refer to the Platform URL Guide to retrieve your login URL.)

Testing Using Curl

In a Linux environment, the curl utility will submit an HTTP request, and allow you to view the result.
curl -u acme:ac12343934687a839cf https://vcc-na4.8x8.com/api/rtstats/stats/agent/jdoe.json
will return the data of agent with login id jdoe, in JSON format. The -u argument identifies the username and password; use your tenant name as the username, and your authentication token as the password.

Agents

List all agents

/agents
Returns a list of details for all agents.

Show a named agent

/agent/{agent-id}
Shows details of a single agent. The agent id is the login id of desired agent.
<agent>
    <active-customer-chat-count>-1</active-customer-chat-count>
    <agent-guid>
detestacct801-ag3276621-cb1f16ae-d5a8-4658-a467-e1d9c3b8467f
    </agent-guid>
    <agent-id>ag3276621</agent-id>
    <agent-media-id>0</agent-media-id>
    <agent-name>Marie Sanders</agent-name>
    <agent-status>9</agent-status>
    <agent-sub-status>none</agent-sub-status>
    <assigned-skill-count>3</assigned-skill-count>
    <day-accepted-count>0</day-accepted-count>
    <day-available-time>0</day-available-time>
    <day-avg-processing-time>0</day-avg-processing-time>
    <day-break-time>0</day-break-time>
    <day-login-time>0</day-login-time>
    <day-offline-time>0</day-offline-time>
    <day-processing-time>0</day-processing-time>
    <day-rejected-count>0</day-rejected-count>
    <day-wrap-up-time>0</day-wrap-up-time>
    <enabled-skill-count>3</enabled-skill-count>
    <group-id>108</group-id>
    <idle-start-time>-1</idle-start-time>
    <last-login-time>-1</last-login-time>
    <longest-active-customer-chat-duration>-1</longest-active-customer-chat-duration>
    <max-concurrent-customer-chat>1</max-concurrent-customer-chat>
    <phone-line1-status>-1</phone-line1-status>
    <phone-line1-status-time>0</phone-line1-status-time>
    <phone-line2-status>-1</phone-line2-status>
    <phone-line2-status-time>0</phone-line2-status-time>
    <status-code-item-id/>
    <status-code-item-short-code/>
    <status-code-list-id/>
    <thirty-min-accepted-count>0</thirty-min-accepted-count>
    <thirty-min-available-time>0</thirty-min-available-time>
    <thirty-min-avg-handling-time>0</thirty-min-avg-handling-time>
    <thirty-min-break-time>0</thirty-min-break-time>
    <thirty-min-offline-time>0</thirty-min-offline-time>
    <thirty-min-processing-time>0</thirty-min-processing-time>
    <thirty-min-rejected-count>0</thirty-min-rejected-count>
    <thirty-min-wrap-up-time>0</thirty-min-wrap-up-time>
    <time-in-status>206526</time-in-status>
</agent>

Queues

List all queues

/queues
Returns a list of details of all queues.

Show a named queue

/queue/{queue-id}
Shows details of a single queue. The queue id is the id of a queue. The queue id can be retrieved by going to the queues tab in the configuration manager.
<queue>
    <agent-count-busy>0</agent-count-busy>
    <agent-count-loggedOut>1</agent-count-loggedOut>
    <agent-count-onBreak>0</agent-count-onBreak>
    <agent-count-postProcess>0</agent-count-postProcess>
    <agent-count-waitTransact>0</agent-count-waitTransact>
    <agent-count-workOffline>0</agent-count-workOffline>
    <day-abandoned>0</day-abandoned>
    <day-accepted>0</day-accepted>
    <day-avg-duration>0</day-avg-duration>
    <day-avg-wait-time>0</day-avg-wait-time>
    <day-queued>0</day-queued>
    <day-sla-activity>0</day-sla-activity>
    <assigned-agent-count>1</assigned-agent-count>
    <enabled-agent-count>1</enabled-agent-count>
    <longest-wait-time>0</longest-wait-time>
    <media-type>vmail</media-type>
    <number-in-offered>0</number-in-offered>
    <number-in-progress>0</number-in-progress>
    <queue-id>116</queue-id>
    <queue-name>Tech Support</queue-name>
    <queue-size>0</queue-size>
    <queue-type>vmail</queue-type>
    <sla-activity>0</sla-activity>
    <sla-target>0</sla-target>
    <thirty-min-abandoned>0</thirty-min-abandoned>
    <thirty-min-accepted>0</thirty-min-accepted>
    <thirty-min-avg-duration>0</thirty-min-avg-duration>
    <thirty-min-avg-wait-time>0</thirty-min-avg-wait-time>
    <thirty-min-longest-wait-time>0</thirty-min-longest-wait-time>
    <thirty-min-queued>0</thirty-min-queued>
    <thirty-min-sla-activity>0</thirty-min-sla-activity>
</queue>

Authentication

In order to make an API request, you must first obtain an authentication token that has been issued for your tenant. This token combines username and password into a single long string.
To get your authentication token:
  1. Log in to Configuration Manager.
  2. Select Integration.
  3. Select the API Token tab.
  4. Next to Data Request Token, select New Token.
This generates a new private token for your tenant. You will use this token in all requests to the Statistics API. You may generate a new token at any time.

Responses

Each resource returned in XML or JSON format.
To specify, add ".xml" or ".json" to the URL:
https://vcc-na4.8x8.com/api/rtstats/stats/agent/ag1.json
The default response format is XML.
The following table describes the meaning of each of the fields in the response type.

Agent

Field Name Description Remarks
agent-id Agent login ID  
agent-name Agent full name (Firstname Lastname)  
agent-status Agent current status (in status code)
0: available
1: transaction offered
2: busy
3: post processing
4: on break
5: work offline
9: logged out
agent-media-id The media type ID of the transaction this agent last processed or currently processing.
0: no media since system start
1: Phone
2: Chat
3: Email
4: Voice Mail
assigned-skill-count Total number of skill assigned to this agent  
day-accepted-count Total accepted transaction count from beginning of the day  
day-available-time Total available time from beginning of the day Data is in seconds
day-avg-processing-time Average transaction processing time from beginning of the day Data is in seconds
day-break-time Total break time from beginning of the day Data is in seconds
day-login-time Total login time from beginning of the day Data is in seconds
day-rejected-count Total rejected transaction count from beginning of the day  
day-offline-time Total time of working offline from beginning of the day Data is in seconds
day-processing-time Total transaction processing time from beginning of the day Data is in seconds
day-wrap-up-time Total transaction wrap up time from beginning of the day Data is in seconds
enabled-skill-count Total number of skill enabled to this agent  
group-id Group ID of the group this agent belong to  
last-login-time Last login time stamp in UTC seconds. Value -1 means system has been restarted and no previous record of the data yet.
phone-line1-status Current status of phone line 1
Supported status code are:
-1: not use
0: idle or at post-processing
1: on hold
2: on mute
3: being offered with transaction
4: monitoring5: busy
phone-line1-status-time Status time of the current status of phone line 1 Data is in seconds
phone-line2-status Current status of phone line 2
Supported status code are:
-1: not use
0: being offered with transaction
1: on hold
2: on mute
3: error
4: monitoring
5: busy
phone-line2-status-time Status time of the current status of phone line 2 Data is in seconds
status-code-item-id Code ID of current status code of this agent 0: Session closed from Jabber
1: Session Timed-Out
2: Maintenance Mode
3: Logout from Operation Dashboard
4: Call Ignored from phone
5: Interaction Timed Out
6: Agent Relogin
status-code-item-short-code Short code of current status code of this agent  
status-code-list-id Code List ID of the current status code of this agent  
thirty-min-accepted-count Total accepted transaction count in last 30 minutes  
thirty-min-available-time Average available time in last 30 minutes Data is in seconds
thirty-min-avg-handling-time Average transaction handling time in last 30 minutes Data is in seconds
thirty-min-break-time Total break time in last 30 minutes Data is in seconds
thirty-min-offline-time Total time of working offline in last 30 minutes Data is in seconds
thirty-min-processing-time Total transaction processing time in last 30 minutes Data is in seconds
thirty-min-rejected-count Total number of transaction rejected by this agent in last 30 minutes  
thirty-min-wrap-up-time Total transaction wrap up time in last 30 minutes Data is in seconds
time-in-status Total time in current status Data is in seconds
Agent-sub-status Agent-sub-status is for agents who can handle more than one chat transaction at a time  

Queue

Field Name Description Remarks
agent-count-busy Agents busy on interactions from this queue and other queues. Busy state includes agents, who are being offered with a transaction.
agent-count-loggedOut Agents enabled for this queue, who are logged out.  
agent-count-onBreak Agents enabled for this queue, who are on break.  
agent-count-postProcess Agents post processing interactions from this queue and other queues.  
agent-count-waitTransact Agents available to take interactions from this queue.  
agent-count-workOffline Agents enabled for this queue, who are working offline.  
day-accepted Total number of accepted transaction from beginning of the day  
day-avg-duration Average duration among all accepted transaction from beginning of the day Data is in seconds
day-avg-wait-time Average wait time among all queued transaction from beginning of the day Data is in seconds
day-queued Total number of queued transaction from beginning of the day  
day-sla-activity SLA activity from beginning of the day In Percent
assigned-agent-count Current number of assigned agents to this queue  
enabled-agent-count Number of agents currently enabled in this queue. Includes agents enabled by the administrator as well as enabled in the Agent Profile.
longest-wait-time Duration (sec) of the longest waiting interaction in this queue.  
media-type Queue type of this queue Possible data are: phone, chat, vmail, email
number-in-offered Interactions from this queue in the state of alerting agents.  
number-in-progress Agents busy on interactions from this queue. The statistics include agents in processing and post processing states.
queue-id Queue ID of this queue This is the queue ID displayed on CM queues tab.
queue-name Queue Name of this queue  
queue-size Number of interactions waiting in the queue. Does it include transaction in progress?
sla-activity Current SLA activity In percent
sla-target Target hours for raising SLA This is the configuration from SLA tab of this queue.
thirty-min-accepted Total number of accepted transactions in last 30 minutes  
thirty-min-avg-duration Average duration of accepted transactions in last 30 minutes Data is in seconds
thirty-min-avg-wait-time Average wait time of the queued transactions in last 30 minutes Data is in seconds
thirty-min-longest-wait-time Longest wait time among the queued transaction in last 30 minutes Data is in seconds
thirty-min-queued Total number of queued transactions in last 30 minutes  
thirty-min-sla-activity SLA activity in last 30 minutes In percent. Value -1 means no SLA activity available.
​​​​​​​

Response Codes

Code Error Description
200 OK Request was successful
400 Bad request The syntax of the request was wrong
403 Forbidden The request was not allowed, usually due to incorrect authentication
404 Not found The requested resource was not found
500 Internal error The server encountered an unexpected condition which prevented it from fulfilling the request
503 Server busy The server is currently unable to handle the request due to temporary overloading

Overview

NoteAll future API enhancements will be on the APIs listed in the 8x8 Developer site and within Analytics for Contact Center. Analytics for Contact Center offers a full suite of SummaryDetailed and Realtime APIs. These newer APIs directly match the capabilities of Analytics for Contact Center and provide the same extensive range of metrics and dimensions. While there is no current end of service for the APIs below, it is strongly advised to leverage the Analytics for Contact Center APIs for any new projects and consider adopting them in existing projects.
The 8x8 Contact Center statistics reporting API is composed of a set of URIs that identify and request statistical data from the Historical Reporting database. This style of API makes it very easy to compose and send a query, which is always done using an HTTP GET request.
The Historical Reporting database contains data about agents and their interactions, statuses, status stats and outbound calls, and queues and their interactions.
The Historical Reporting database contains two types of data; event and aggregated. Some queries will return unique event records, but most will return data that has been aggregated into 30 minute periods.
Note: There would be instances where when querying the API data, 25 columns will not have values; destinationorignal, destinationtranslated, directiontransaction, interactiontype, agentid, agentname, accepttimestamp, processtime, postprocess, totaltime, recordingfilename, maxhold, holdcount, totalhold, leg1postdial, leg2postdial, leg1answertime, leg2answertime, leg1sipid, leg2sipid, campaignname, recordid, recordstatus, dispositioncode, agentaccepttime. This is due to the API query being run less than one hour before the calls were accepted by agents.
All API requests are authenticated using a token that is issued to a valid Virtual Contact Center tenant. Responses are sent in either XML,CSV or JSON format. A sample Java program is available, which demonstrates how to issue a request and work with the response.
For security reasons, the Statistics API only accepts request using HTTPS, so that request headers and response data are encrypted.
The API allows you to fetch data on agents' skills. You can pass an API request to fetch:
  • Skill levels of an agent for all the queues he is a member of
  • Skill levels of all agents for a given queue
The response to the request will display agents' skill levels with the status. Click here for sample requests.
The NA/EU server numbers used in the URLs in this document are only an example. If copying and pasting the code, edit the code to the appropriate server number, this can be seen in the URL when logging in to 8x8 Contact Center. For an example, if on na2, the code should read,  
http://vcc-na2.8x8.com/api/stats/agents/fred.xml
Revise your query URL to include the login URL of your tenant. Refer to the Platform URL Guide to retrieve your login URL.

Testing Using A Browser

The Statistics API makes it easy to submit a query, for experimentation, testing or debugging purposes. From a web browser, simply enter the URL. You will be prompted to enter a username and password. Enter your tenant name as the username, and your authentication token as the password. Then, the query result will be displayed in your browser.
For example:
http://vcc-na4.8x8.com/api/stats/agents/fred.xml
will return information about fred, in XML format.
The NA server numbers above are only an example. If copying and pasting the code, edit the code to the appropriate NA server number. For an example, if on na2, the code should read:
http://vcc-na2.8x8.com/api/stats/agents/fred.xml
Revise your query URL to include the login URL of your tenant. Refer to the Platform URL Guide to retrieve your login URL.

Testing Using Curl

In a Linux environment, the curl utility will submit an HTTP request, and allow you to view the result.
curl -u acme:ac12343934687a839cf http://vcc-na4.8x8.com/api/stats/groups.csv
will return a list of groups, in CSV format. The -u argument identifies the username and password; use your tenant name as the username, and your authentication token as the password.

Groups

List groups

/groups
Returns a list of all groups.
<?xml version='1.0'  encoding='UTF-8' ?>
<groups>
    <group>

        <group-id>122</group-id>
        <group-name>Support</group-name>
        <deleted>No</deleted>
    </group>

    <group>
        <group-id>123</group-id>
        <group-name>East Coast Sales</group-name>
        <deleted>Yes</deleted>

    </group>
    <group>
      ... 
    </group>
</groups>

Agents

List all agents

/agents?n={offset}
Returns a list of details for all agents.

List agents in a group

/groups/{group-id}/agents?n={offset}
Returns a list of details for all agents for a named group.

Show a named agent

/agents/{agent-id}
Shows details of a single agent.
<?xml version='1.0'  encoding='UTF-8' ?>
<agents>
    <agent>
        <agent-id>fred</agent-id>
        <group-id>148</group-id> 
        <date-hired-date>2008-03-23</date-hired-date> 
        <direct-agent-access>no</direct-agent-access> 
        <email-address>fred@acme.com</email-address> 
        <enabled>Y</enabled> 
        <first-name>Fred</first-name> 
        <full-name>Fred Bloggs</full-name> 
        <last-name>Bloggs</last-name> 
        <phone-used>PSTN</phone-used> 
        <phone-extension>007</phone-extension>

        <user-rights>agent</user-rights> 
        <voice-mail-activated>no</voice-mail-activated> 
    </agent>
    <agent>
      ... 
    </agent>

</agents>

Activities

List activities for a named agent

/agents/{agent-id}/activities?d={date range}&n={offset}
Returns a list of activities for a named agent.

List activities for all agents in a group

/groups/{group-id}/activities?d={date range}&n={offset}
Returns a list of activities for all agents in a named group.
<?xml version='1.0'  encoding='UTF-8' ?>
<activities>
    <activity>
        <agent-id>fred</agent-id>

        <agent-name>Fred Bloggs</agent-name>
        <group-id>122</group-id>
        <group-name>Sales</group-name>
        <media-type>Phone</media-type>

        <channel-id>62</channel-id>
        <channel-obj-id>5030001</channel-obj-id>
        <queue-obj-id>tenantp1~~queue~~phone~~102</queue-obj-id>
        <queue-name>phoneq1</queue-name>

        <transaction_id>133</transaction_id>
        <origination>4245567232</origination>
        <customer-name>N/A</customer-name>
        <trans-accept-time>2009-06-03T23:09:04-07:00</trans-accept-time>

        <trans-proc-time>8</trans-proc-time>
        <trans-post-proc-time>7</trans-post-proc-time>
        <trans-total-time>15</trans-total-time>
        <trans-transfer-from />

        <trans-conference-from />
        <case-id />
        <tcl-list-id>1</tcl-list-id>
        <tcl-item-id>1</tcl-item-id>
        <tcl-item-shortcode-text>c1</tcl-item-shortcode-text>

        <tcl-item-report-text>transcode1</tcl-item-report-text>
        <recording-filename>S20090604/R200906040609030100.wav</recording-filename>
    </activity>
</activities>

Agent Interactions

Interaction reports only include Queued interactions.

List interactions for a named agent

/agents/{agent-id}/interactions?d={date range}&n={offset}&{query vars}
Returns a list of interactions for a named agent.

List interactions for all agents in a group

/groups/{group-id}/interactions?d={date range}&n={offset}&{query vars}
Returns a list of interactions for all agents in a named group.
<?xml version='1.0'  encoding='UTF-8' ?>
<interactions>
    <interaction>
        <interaction-id>1428</interaction-id>
        <agent-id>fred</agent-id>

        <agent-name>Fred Bloggs</agent-name>
        <group-id>132</group-id>
        <group-name>Support</group-name>
        <accept-timestamp>2008-03-09T09:13:02-07:00</accept-timestamp>

        <process-time>104</process-time>
        <post-process-time>70</post-proc-time>
        <finish-timestamp>2008-03-09T09:23:09-07:00</finish-timestamp>
        <transfer-from></transfer-from>

        <conference-from></conference-from>
    </interaction>
    <interaction>
      ... 
    </interaction>
</interactions>

Queue Interactions

List interactions

/interactions/?d={date range}&n={offset}&{query vars}
Returns a list of interactions.

List interactions for a queue

/queues/{queue-id}/interactions?d={date range}&n={offset}&{query vars}
Returns a list of interactions for a queue.

List interactions for a channel

/channels/{channel-id}/interactions?d={date range}&n={offset}&{query vars}
Returns a list of interactions for a channel.
There are several supported media types:
  • T = Telephone
  • V = Voice Mail
  • C = Chat
  • Z = Email
<?xml version='1.0'  encoding='UTF-8' ?>
<interactions>
    <interaction>
        <interaction-id>463</interaction-id>
        <queue-name>Support</queue-name>

        <channel-id>12</channel-id>
        <media-type>T</media-type>
        <create-timestamp>2008-02-09T14:13:32-07:00</create-timestamp>
        <accept-timestamp></accept-timestamp>

        <process-time>0</process-time>
        <post-process-time>0</post-process-time>
        <abandon-timestamp></abandon-timestamp>
        <finish-timestamp></finish-timestamp>

        <voice-message-left>Y</voice-message-left>
        <origination>Y</origination>
        <customer-name>Y</customer-name>
        <ivr-treatment-time>10</ivr-treatment-time>

        <max-hold-time>0</max-hold-time> 
        <hold-count>0</hold-count> 
        <total-hold-time>0</total-hold-time> 
        <call-leg1-post-dial-delay>2</call-leg1-post-dial-delay> 
        <call-leg2-post-dial-delay>2</call-leg2-post-dial-delay> 
        <call-leg1-answer-time>0</call-leg1-answer-time> 
        <call-leg2-answer-time>0</call-leg2-answer-time> 
        <call-leg1-sip-id>088e926d2f05a78e23f568557699891d</call-leg1-sip-id> 
        <call-leg2-sip-id>1b82fe39718634c548d04cfd373c5a8c</call-leg2-sip-id>

        <inbound-sip-id>6a4e7e2-1f1bee-4b433660@192</inbound-sip-id>
    </interaction>
</interactions>

Campaign Interactions

List interactions for a campaign

/campaigns/{campaign-id}/interactions?d={date range}&n={offset}&{query vars}
Returns a list of interactions for a campaign.
There are several predefined record status:
  • = New
  • 1 = Queued
  • 2 = Accepted
  • 3 = Completed
  • 4 = Scheduled
  • 5 = API Scheduled - scheduled via API
  • 6 = Deleted
  • 7 = Sent to Interaction Router (cached to dial)
and server predefined disposition code:
  • 1000 = None
  • 1001 = Try Again
  • 1002 = Scheduled Call Back
process-time and post-process-time are in seconds.
total-process-time = process-time + post-process-time.
Note: We can only delete records from campaigns in VCC when their status is 04 or 5. In VCC v9.10.6.1 onwards, there was an improvement to enable record deletion in the following statuses: 014 and 5.
<?xml version='1.0'  encoding='UTF-8' ?>
<interactions>
    <interaction>
        <campaign-name>Sales Campaign</campaign-name>
        <campaign-id>555</campaign-id>

        <agent-name>Fred Bloggs</agent-name>
        <queue-name>Sales Queue</queue-name>
        <accept-timestamp>2011-02-28T18:52:55-08:00</accept-timestamp>
        <record-status>1</record-status>

        <record-id>0015000000WIBJrAAP</record-id>
        <interaction-id>188</interaction-id>
        <wrap-up-code>retry</wrap-up-code>
        <wrap-up-text>Try Again Later</wrap-up-text>

        <disposition-code>1001</disposition-code>
        <called-number>5551234</called-number>
        <ext-trans-data>[AccountName|John Smith]</ext-trans-data>
        <process-time>125</process-time>

        <post-process-time>60</post-process-time>
        <total-process-time>185</total-process-time>
        <recordinf-filename>S20110228/R20110228175312223.wav</recording-filename>
    </interaction>

    <interaction>
      ... 
    </interaction>
</interactions>

All Interactions

This also includes non queued interactions such as agent to agent or direct to agent calls.

List all interactions

/allinteractions/?d={date range}&n={offset}&{query vars}
Returns a list of all interactions. Those include agent/queue/campaign interactions, but also abandoned/direct agent access/Forward to external number transactions.
media-type can be either Phone, Chat, Email or Voice Mail.
interaction-direction can be empty, or set to either inbound or outbound.
interaction-type can be empty, or set to one of the following values:
  • Web Callback
  • DAA
  • Fwd to Ext. Number
  • Campaign
  • Consult
For possible values for record-status and disposition-code, see the previous paragraph (Campaign Interactions).
<?xml version='1.0'  encoding='UTF-8' ?>
<interactions>
    <interaction>
        <media-type>Phone</media-type>
        <channel-obj-id>9691000</channel-obj-id>
        <queue-name>Engineering Phone Queue</queue-name>
        <interaction-id>7</interaction-id>
        <orig-interaction-id />
        <origination>pma</origination>
        <destination-original />
        <destination-translated />
        <customer-name>N/A, N/A</customer-name>
        <case-id />
        <interaction-direction />
        <interaction-type />
        <dial-code />
        <dial-text />
        <create-timestamp>2011-09-22T18:35:10-07:00</create-timestamp>
        <agent-name />
        <accept-timestamp />
        <process-time />
        <post-process-time />
        <total-time />
        <abandon-timestamp>2011-09-22T18:35:30-07:00</abandon-timestamp>
        <voice-message-left />
        <recording-filename />
        <ivr-treatment-time>2</ivr-treatment-time>
        <transfer-from />
        <conference-from />
        <max-hold-time>0</max-hold-time> 
        <hold-count>0</hold-count> 
        <total-hold-time>0</total-hold-time> 
        <call-leg1-post-dial-delay>0</call-leg1-post-dial-delay> 
        <call-leg2-post-dial-delay>0</call-leg2-post-dial-delay> 
        <call-leg1-answer-time>0</call-leg1-answer-time> 
        <call-leg2-answer-time>0</call-leg2-answer-time> 
        <call-leg1-sip-id />
        <call-leg2-sip-id />
        <inbound-sip-id>MTM2MjZkNDdiMzU3ZmQ3OTQ1OWM3MmI0M2E4ZGI</inbound-sip-id>
        <notes />
        <campaign-name />
        <record-id />
        <record-status />
        <disposition-code />
        <ext-trans-data />
        <wrap-up-code>N/A</wrap-up-code>
        <wrap-up-text>N/A</wrap-up-text>
    </interaction>
</interactions>

Interaction Statistics

List statistics for an agent

/agents/{agent-id}/statistics?d={date range}&n={offset}&{query vars}
Returns a list of interaction statistics for an agent, reported in 30 minute periods.

List statistics for a queue

/queues/{queue-id}/statistics?d={date range}&n={offset}&{query vars}
Returns a list of interaction statistics for a queue, reported in 30 minute periods.

List statistics for a channel

/channels/{channel-id}/statistics?d={date range}&n={offset}&{query vars}
Returns a list of interaction statistics for a channel, reported in 30 minute periods.
<?xml version='1.0'  encoding='UTF-8' ?>
<statistics>
    <statistic>
        <queue-name>Support</queue-name>

        <channel-id>23</channel-id>
        <time-stamp>2008-02-22T13:30:00-07:00</time-stamp>
        <media-type>T</media-type>
        <entered-count>24</entered-count>

        <accepted-count>21</accepted-count>
        <sla-met-count>18</sla-met-count>
        <abandoned-count>1</abandoned-count>
        <finish-processing-count>2</finish-processing-count>

        <finish-post-count>2</finish-post-count>
        <voice-message-left-count>0</voice-message-left-count>
        <time-waiting>845</time-waiting>
        <time-processing>512</time-processing>

        <time-post-processing>142</time-post-processing>
        <total-time-to-abandon>56</total-time-to-abandon>
        <time-max-wait-accept>110</time-max-wait-accept>
        <time-max-wait-abandon>56</time-max-wait-abandon>

    </statistic>
</statistics>

SLAs

SLAs are data about the number of interactions accepted or abandoned, split by time period. The SLA response differs, depending on whether the queue being queried is an "on line" (telephony, chat), or an "off line" (emails, voice mails) queue.

List on-line SLAs for a queue

/queues/{queue-id}/online_slas?d={date range}&n={offset}&{query vars}
Returns a list of SLA stats for an online (telephony, chat) queue, reported in 30 minute periods.

List online SLAs for a channel

/channels/{channel-id}/online_slas?d={date range}&n={offset}&{query vars}
Returns a list of SLA stats for an online (telephony, chat) channel, reported in 30 minute periods.
<?xml version='1.0'  encoding='UTF-8' ?>
<online_slas>
    <online_sla>

        <queue-name>Support</queue-name>
        <channel-id>23</channel-id>
        <time-stamp>2008-02-22T13:30:00-07:00</time-stamp>
        <media-type>T</media-type>

        <entered-count>24</entered-count>
        <accepted-count>21</accepted-count>
        <sla-met-count>18</sla-met-count>
        <accepted>

            <t0-5sec>8</t0-5sec>
            <t5-10sec>5</t5-10sec>
            <t10-20sec>2</t10-20sec>
            <t20-30sec>3</t20-30sec>

            <t30-40sec>2</t30-40sec>
            <t30-45sec>0</t30-45sec>
            <t45-1min>1</t45-1min>
            <t1-2min>0</t1-2min>

            <t2-5min>0</t2-5min>
            <t5-10min>0</t5-10min>
            <t10-or-more>0</t10-or-more>
        </accepted>

        <abandoned>
            <t0-5sec>0</t0-5sec>
            <t5-10sec>0</t5-10sec>
            <t10-20sec>0</t10-20sec>

            <t20-30sec>0</t20-30sec>
            <t30-40sec>0</t30-40sec>
            <t30-45sec>0</t30-45sec>
            <t45-1min>0</t45-1min>

            <t1-2min>0</t1-2min>
            <t2-5min>0</t2-5min>
            <t5-10min>0</t5-10min>
            <t10-or-more>0</t10-or-more>

        </abandoned>
    </online_sla>
</online_slas>

List off-line SLAs for a queue

/queues/{queue-id}/offline_slas?d={date range}&n={offset}&{query vars}
Returns a list of SLA stats for an offline (email, voicemail) queue, reported in 30 minute periods.
/channels/{channel-id}/offline_slas?d={date range}&n={offset}&{query vars}
Returns a list of SLA stats for an offline (email, voicemail) channel, reported in 30 minute periods.
<?xml version='1.0'  encoding='UTF-8' ?>
<offline_slas>
    <offline_sla>
        <queue-id>32</queue-id>

        <queue-name>Support</queue-name>
        <channel-id>18</channel-id>
        <time-stamp>2008-02-22T13:30:00-07:00</time-stamp>
        <media-type>E</media-type>

        <entered-count>12</entered-count>
        <accepted-count>8</accepted-count>
        <sla-met-count>8</sla-met-count>
        <accepted>

            <t0-30min>4</t0-30min>
            <t30min-1hr>4</t30min-1hr>
            <t1hr-1hr30min>2</t1hr-1hr30min>
            <t1hr30min-2hr>1</t1hr30min-2hr>

            <t2hr-3hr>0</t2hr-3hr>
            <t3hr-or-more>1</t3hr-or-more>
        </accepted>
    </offline_sla>
</offline_slas>

Agent Statuses

List statuses for a named agent

/agents/{agent-id}/statuses?d={date range}&n={offset}
Returns a list of statues for a named agent.

List statuses for all agents in a group

/groups/{group-id}/statuses?d={date range}&n={offset}
Returns a list of statuses for all agents in a named group.
<?xml version='1.0'  encoding='UTF-8' ?>
<statuses>
    <status>
        <agent-id>fred</agent-id>

        <agent-name>Fred Bloggs</agent-name>
        <group-id>12</group-id>
        <group-name>grp2</group-name>
        <status>On Break</status>

        <event-time>2009-05-21T14:23:05-07:00</event-time>
        <scl-list-id></scl-list-id>
        <scl-item-id></scl-item-id>
        <scl-item-shortcode-text>Scheduled break</scl-item-shortcode-text>

        <scl-item-report-text>Scheduled break</scl-item-report-text>
        <transaction-id>1000</transaction-id>
    </status>
</statuses>

Agent Statuses Statistics

List statuses statistics for a named agent

  /agents/{agent-id}/statuses/statistics?d={date range}&n={offset}
Returns a named agent’s aggregated data about her statuses.
<statuses>
    <status>
            <period-start>2015-07-08T14:30:00-07:00</period-start>
            <period-end>2015-07-08T15:00:00-07:00</period-end>
            <agent-id>pma</agent-id>
            <agent-name>Agent Smith</agent-name>
            <group-id>101</group-id>
            <group-name>DEV</group-name>
            <status-waiting>0</status-waiting>
            <status-processing>0</status-processing>
            <status-post-processing>0</status-post-processing>
            <status-working-offline>0</status-working-offline>
            <status-transaction-offered>0</status-transaction-offered>
            <status-break>1696</status-break>
            <time-logged-in>1696</time-logged-in>

    </status>

<statuses>

Agent / Queue Skills

List skills by agent id

/agents/{agent-id}/skills
Returns a list of skills for a named agent. This API does not support any query parameters.
<?xml version='1.0'  encoding='UTF-8' ?>
<skills>
    <skill>
        <enabled>Y</enabled>
        <queue-id>102</queue-id>
        <agent-id>kol</agent-id>
        <skill-level>high</skill-level>
</skill>
    <skill>
        <enabled>N</enabled>
        <queue-id>103</queue-id>
        <agent-id>kol</agent-id>
        <skill-level>medium</skill-level>
    </skill>
</skills>

List skills by queue id

/queues/{queue-id}/skills
Returns a list of agent skills for a given queue. This API does not support any query parameters.
<?xml version='1.0'  encoding='UTF-8' ?>
<skills>
    <skill>
        <enabled>Y</enabled>
        <agent-id>phegde</agent-id>
        <queue-id>102</queue-id>
        <skill-level>high</skill-level>
</skill>
    <skill>
        <enabled>N</enabled>
        <agent-id>kol</agent-id>
        <queue-id>102</queue-id>
        <skill-level>medium</skill-level>
    </skill>
</skills>

Outbound Calls

List outbound calls for a named agent

/agents/{agent-id}/outboundcalls?d={date range}&n={offset}
Returns a list of outbound calls for a named agent.

List outbound calls for all agents in a group

/groups/{group-id}/outboundcalls?d={date range}&n={offset}
Returns a list of outbound calls for all agents in a named group.
<?xml version='1.0'  encoding='UTF-8' ?>
<outboundcalls>
    <outboundcall>
        <agent-id>fred</agent-id>
        <agent-name>Fred Bloggs</agent-name>

        <group-id>12</group-id>
        <transaction-id>123</transaction-id>
        <destination>14155524562</destination>
        <start-time>2009-05-26T17:53:55-07:00</start-time>

        <total-time>14</total-time>
        <tcl-list-id>1</tcl-list-id>
        <tcl-item-id>1</tcl-item-id>
        <tcl-item-shortcode-text>c1</tcl-item-shortcode-text>

        <tcl-item-report-text>report text 1</tcl-item-report-text>
        <tcl-outbound-list-id>2</tcl-outbound-list-id>
        <tcl-outbound-item-id>3</tcl-outbound-item-id>
        <tcl-outbound-item-shortcode-text>ttt</tcl-outbound-item-shortcode-text>

        <tcl-outbound-item-report-text>ttt</tcl-outbound-item-report-text>
        <recording-filename>S20090526/R20090526175312223.wav</recording-filename>
        <max-hold-time>0</max-hold-time> 
        <hold-count>0</hold-count> 
        <total-hold-time>0</total-hold-time> 
        <call-leg1-post-dial-delay>2</call-leg1-post-dial-delay> 
        <call-leg2-post-dial-delay>2</call-leg2-post-dial-delay> 
        <call-leg1-answer-time>0</call-leg1-answer-time> 
        <call-leg2-answer-time>0</call-leg2-answer-time> 
        <call-leg1-sip-id>088e926d2f05a78e23f568557699891d</call-leg1-sip-id> 
        <call-leg2-sip-id>1b82fe39718634c548d04cfd373c5a8c</call-leg2-sip-id>

    </outboundcall>
</outboundcalls>

Queues

List all queues

/queues?n={offset}
Returns a list of details for all queues

List a single queue

/queues/{queue-id}
Show details for a single queue.
There are several supported media types:
  • T = Telephone
  • V = Voice Mail
  • C = Chat
  • Z = Email
<?xml version='1.0'  encoding='UTF-8' ?>
<queues>
    <queue>
        <queue-id>121</queue-id>

        <queue-name>Support</queue-name>
        <queue-desc>First tier support</queue-desc>
        <media-type>T</media-type>
        <enabled>Y</enabled>

        <sla-enabled>N</sla-enabled>
        <sla-time>0</sla-time>
    </queue>
</queues>

Channels

List all channels

/channels?n={offset}
Returns a list of details for all channels
<?xml version='1.0'  encoding='UTF-8' ?>
<channels>
    <channel>
        <channel-id>52</channel-id>

        <channel-name>sales@acme.com</channel-name>
        <channel-desc>Sales Email</channel-desc>
    </channel>
</channels>

Campaigns

List all campaigns

/campaigns?n={offset}
Returns a list of details for all campaigns

List a single campaign

/campaigns/{campaign-id}
Show details for a single campaign.
There are several predefined campaign status:
  • 0 = New
  • = Manual Started
  • 2 = Schedule Started
  • 3 = Manual Running
  • 4 = Schedule Running
  • 5 = Manual Stopped
  • 6 = Completed
  • 7 = Scheduled Stopped
  • 8 = Manual Paused
  • 9 = Schedule Paused 
  • 10 = Manual Purged 
  • 11 = Schedule Purged
retry-interval is in minutes.
daily-start-time and daily-end-time are integer values of minutes from beginning of the day.
<?xml version='1.0'  encoding='UTF-8' ?>
<campaigns>
    <campaign>
        <campaign-name>Sales Campaign</campaign-name>

        <campaign-id>123</campaign-id>
        <enabled>Y</enabled>
        <status>6</status>
        <no-of-records>100</no-of-records>

        <caller-id>5551234</caller-id>
        <start-time>2011-02-01T10:00:00-08:00</start-time>
        <end-time>2011-02-28T17:30:00-08:00</end-time>
        <actual-run-time>2011-02-01T10:00:30-08:00</actual-run-time>

        <actual-stop-time>2011-02-23T12:09:36-08:00</actual-stop-time>
        <daily-start-time>600</daily-start-time>
        <daily-end-time>1110</daily-end-time>
        <retry-interval>90</retry-interval>

        <max-retry>3</max-retry>
    </campaign>
</campaigns>

Campaign Records

List all records of a single campaign

/campaigns/{campaign-id}/records?n={offset}
Show details for all records of s campaign.
There are several predefined record status:
  • 0 = New
  • 1 = Queued
  • 2 = Accepted
  • 3 = Completed
  • 4 = Scheduled
, status code:
  • 0 = Default
  • 1 = Max Attempt Reached
  • = Skipped
  • = No Phone Number
  • = Invalid Phone Number
and disposition code:
  • 1000 = None
  • 1001 = Try Again
  • 1002 = Scheduled Call Back
<?xml version='1.0'  encoding='UTF-8' ?>
<records>
    <record>
        <campaign-name>Sales Campaign</campaign-name>
        <campaign-id>123</campaign-id>

        <record-id>0015000000WIBJrAAP</record-id>
        <phone-list>Phone|(650)555-1234</phone-list>
        <status>3</status>
        <status-code>0</status-code>

        <ext-trans-data>[AccountName|John Smith]</ext-trans-data>
        <disposition-code>1000</disposition-code>
    </record>
    <record>
      ...
    </record>

</recordss>

Transaction Code List

List all transaction codes

/tcls?n={offset}
Returns a list of details for all transaction codes
<?xml version='1.0'  encoding='UTF-8' ?>
<tcl-trans>

    <tcl-tran>
        <tcl-list-id>1</tcl-list-id>
        <tcl-name>ag-trans-code</tcl-name>
        <tcl-description>agent transaction code</tcl-description>

        <tcl-admin-notes />
        <tcl-active>Y</tcl-active>
        <tcl-autosort>N</tcl-autosort>
        <tcl-used>Y</tcl-used>

        <tcl-category-id />
        <tcl-assignment-type>groups</tcl-assignment-type>
        <tcl-required>Y</tcl-required>
        <tcl-multiple-choice>Y</tcl-multiple-choice>

        <tcl-required-before-outbound>Y</tcl-required-before-outbound>
        <tcl-item-id>1</tcl-item-id>
        <tcl-item-ordinate>0</tcl-item-ordinate>
        <tcl-item-active>Y</tcl-item-active>

        <tcl-item-used>Y</tcl-item-used>
        <tcl-item-call-line-id>140823322222</tcl-item-call-line-id>
        <tcl-lang-id>en_US</tcl-lang-id>
        <tcl-item-menu-text>code 1</tcl-item-menu-text>

        <tcl-item-report-text>code 1</tcl-item-report-text>
        <tcl-item-shortcode-text>c1</tcl-item-shortcode-text>
    </tcl-tran>
</tcl-trans>

Status Code List

List all status codes

/scls?n={offset}
Returns a list of details for all status codes
<?xml version='1.0'  encoding='UTF-8' ?>
<scl-trans>
    <scl-tran>
        <scl-list-id>1</scl-list-id>

        <scl-name>ag-status-code</scl-name>
        <scl-description>agent status code</scl-description>
        <scl-admin-notes />
        <scl-active>Y</scl-active>

        <scl-autosort>N</scl-autosort>
        <scl-used>Y</scl-used>
        <scl-category-id />
        <scl-item-id>1</scl-item-id>

        <scl-item-ordinate>0</scl-item-ordinate>
        <scl-item-active>Y</scl-item-active>
        <scl-item-used>Y</scl-item-used>
        <scl-lang-id>en_US</scl-lang-id>

        <scl-item-menu-text>code 1</scl-item-menu-text>
        <scl-item-report-text>code 1</scl-item-report-text>
        <scl-item-shortcode-text>c1</scl-item-shortcode-text>
    </scl-tran>

</scl-trans>

Authentication

In order to make an API request, you must first obtain an authentication token that has been issued for your tenant. This token combines username and password into a single long string.
To get your authentication token:
  1. Log in to Configuration Manager.
  2. Select Integration.
  3. Select the API Token tab.
  4. Next to Data Request Token, select New Token.
This generates a new private token for your tenant. You will use this token in all requests to the Statistics API. You may generate a new token at any time.

Dates

Date formats in queries adhere to the ISO 8601 standard. The {date range} argument can take one of two forms. To specify records from a given day, specify the date, with an optional time zone parameter:
http://vcc-na4.8x8.com/api/stats/agents/{agentId}/interactions?d=2007-08-05&tz=America/New_York
Note that if no time is given, a day begins at midnight (00:00:00), and if no time zone is specified, the time defaults to the tenant time zone. A list of valid time zones can be found here (TZ column): List of valid time zones. To specify a date range, separate the dates with a comma (",")
http://vcc-na4.8x8.com/api/stats/agents/fred/interactions?d=2007-08-05,2007-08-07
You can include times in date ranges as well, separated with a space ("%20″ in the URI):
http://vcc-na4.8x8.com/api/stats/queues/Sales/interactions?d=2007-08-05 13:15Z,2007-08-07 14:30Z
"Z" is the time zone designator, signifying that the time is in UTC (Coordinated Universal Time). Dates may also be formatted as a single string, with no separators, and a capital "T" separating date and time:
http://vcc-na4.8x8.com/api/stats/queues/Sales/interactions?d=20070805T1315Z,20070807T1430Z
There are several date constants available to represent relative dates:

today

  • the current date, at the start of the day (midnight)

today-1d

  • yesterday, at the start of the day (midnight)

today-7d

  • seven days ago, at the start of the day (midnight)
To see yesterday's status changes for Sally:
http://vcc-na4.8x8.com/api/stats/agents/sally/statuses?d=today-1d,today&tz=America/Denver
Dates in responses also adhere to the ISO 8601 standard.
They take the form:
2008-02-14T10:12:13-08:00
where "-08:00″ represents the offset with the UTC timezone (Coordinated Universal Time). A negative offset typically represents timezones west UTC.

Pagination

Requests that would return a large number of records will respond with 50 records per request. You can iterate through these response sets by setting the {offset} argument. In this example, we are asking for agent interactions, starting with the 101st record.
http://vcc-na4.8x8.com/api/stats/agents/{agentId}/interactions?n=101
Note: VCC APIs have a max return of 50 entries. To get the next 50 entries, the API request will have to be modified to return rows starting at 51.
For example: https://vcc-eu2.8x8.com/api/stats/queues?n=51

Query Variables

Queries that return interaction data may be further constrained by supplying query variables. These take the form of field=value where field is any field normally returned by the query.
For example, to return only the set of telephone interactions (as opposed to chat or email, say):
http://vcc-na4.8x8.com/api/stats/agents/{agentId}/interactions?media-type=T
For telephone interactions for a single queue:
http://vcc-na4.8x8.com/api/stats/agents/{agentId}/interactions?media-type=T&queue-id=102

Responses

Each resource may be returned in either XML, CSV, or JSON format.
To specify, add ".xml", ".csv" or ".json" to the URL:
http://vcc-na4.8x8.com/api/stats/agents/{agentId}.csv
The default is XML.

Response Codes

Code Error Description
200 OK Request was successful
400 Bad request The syntax of the request was wrong
403 Forbidden The request was not allowed, usually due to incorrect authentication
404 Not found The requested resource was not found
500 Internal error The server encountered an unexpected condition which prevented it from fulfilling the request
503 Server busy The server is currently unable to handle the request due to temporary overloading

Examples

These examples are to be used as a guide only. For testing the API, use either a Browser, cURL or Postman.

List interactions using the Python Requests Module

Note: This will return the first page of 50 results only.
01 import requests
02  
03 url = f"https://vcc-na4.8x8.com/api/stats/interactions.json"
04  
05 headers = {
06   'Authorization'"Basic {yourCredentials}"
07 }
08  
09 response = requests.request("GET", url, headers=headers)
10  
11 print(response.text)

Overview

The 8x8 Tenant Schedule API is composed of set of URIs to allow the tenants to download the information related to daily schedules/exceptions. Tenant has a choice of adding/modifying schedules at configuration manager user interface. This style of API makes it very easy to compose and send a query, which is always done using an HTTP GET request.
The Tenant schedule Reporting database contains data, related to all or individual schedule(s).
All API requests are authenticated using a token that is issued to a valid 8x8 tenant. Responses are sent in either XML or JSON format.
For security reasons, the Tenant schedule API only accepts request using HTTPS, so that request headers and response data are encrypted.
For compatibility reasons, 8x8 Tenant schedule API does not give CSV type of response.

Testing Using A Browser

In the following examples some parts of the URL are expressed as {valuename}. The curly brackets are not included in the final URL.  Also values such as schedule names may have spaces in the name. The spaces have to be replaced by %20 for the value to be accepted.  So if the ending of a URL is /{schedule-name} and you wanted to specify the schedule named Default Schedule the end of your URL would be /Default%20Schedule.
The Tenant schedule API makes it easy to submit a query, for experimentation, testing or debugging purposes. From a web browser, simply enter the URL. You will be prompted to enter a username and password. Enter your tenant name as the username, and your authentication token as the password. Then, the query result will be displayed in your browser. For example:
https://vcc-na4.8x8.com/api/provisioning/schedules
Will return the all schedules information. Response will give all schedules; each schedule will have weekday information along with exception(s).
Revise your query URL based on the login URL of your Tenant. Refer to the 8x8 Contact Center Platform URL Guide to retrieve your login URL.
<?xml version='1.0'  encoding='UTF-8' ?>
<schedules>
    <schedule>
        <id>122</id>
        <name>myschedule</name>
        <time-zone>PST8DT</time-zone>
        <week-days>
           <week-day>
              <day>0</day>
              <properties>
                 <status>-1</status>
                 <start-time>08:00</start-time>
                 <end-time>09:00</end-time>
              </properties>
           </week-day>            ... 
    <schedule>
      ... 
</schedules>

Some other examples for finding schedule information

https://vcc-na4.8x8.com/api/provisioning/schedulesbyname/{schedule-name}
Will return specific schedule with name matching {schedule-name}, provided in request. To find the id of a specific schedule; you can query schedule by name and get the schedule id from response.
https://vcc-na4.8x8.com/api/provisioning/schedules/{schedule-id}
Will return specific schedule with id matching {schedule-id}, provided in request.

Examples for finding schedule status information

https://vcc-na4.8x8.com/api/provisioning/schedules/{schedule-id}/status
Will return specific schedule status with id matching {schedule-id}, provided in request. To find the id of a specific schedule; you can query schedule by name and get the schedule id from response.
Schedule status will be calculated at current time in time zone of specific schedule. If schedule does not have a time zone; status will be calculated at current time in time zone of tenant.
https://vcc-na4.8x8.com/api/provisioning/schedules/{schedule-id}/status?utctime=1360821949898
Will return specific schedule status with id matching {schedule-id}, provided in request.
Schedule status will be calculated at user provided time in time zone of specific schedule. If schedule does not have a time zone; status will be calculated at user provided time in time zone of tenant.
https://vcc-na4.8x8.com/api/provisioning/schedules/{schedule-id}/status?offset=600
Current schedule status will be calculated at current time with additional offset seconds in time zone of specific schedule. If schedule does not have a time zone; status will be calculated in time zone of tenant.
https://vcc-na4.8x8.com/api/provisioning/schedules/{schedule-id}/status?utctime=1360821949898offset=600
Current schedule status will be calculated at user given time with additional offset seconds in time zone of specific schedule. If schedule does not have a time zone; status will be calculated in time zone of tenant.
https://vcc-na4.8x8.com/api/provisioning/schedules/{schedule-id}/nextstatus
Next schedule status along with current schedule status will be calculated at current time in time zone of specific schedule. If schedule does not have a time zone; status will be calculated at current time in time zone of tenant.
https://vcc-na4.8x8.com/api/provisioning/schedules/{schedule-id}/nextstatus?utctime=1360821949898
Next schedule status along with current schedule status will be calculated at user provided time in time zone of specific schedule. If schedule does not have a time zone; status will be calculated at user provided time in time zone of tenant.

Testing Using curl

In a Linux environment, the curl utility will submit an HTTP request, and allow you to view the result.
curl -u acme:ac12343934687a839cf https://vcc.na4.8x8.com/api/provisioning/schedules/{schedule-id}  -o {filename}
will return either a XML or JSON output as a file for the schedule. The -u argument identifies the username and password; use your tenant name as the username, and your authentication token as the password.
The -o argument will take the file name as input from user. This will be name of file where content will be saved.

Authentication

In order to make an API request, you must first obtain an authentication token that has been issued for your tenant. This token combines username and password into a single long string. To get your token, log into the Configuration Manager, select "Integration", and click the "API Token" tab. Next, click the "New Token" button next to "Data Request Token". This generates a new private token for your tenant. You will use this token in all requests to the Recordings API. You may generate a new token at any time.

Meaning of status codes

Code Number Code Label Description
0 OPEN Status is in open state.
-1 CLOSED Status is in close state.
Choice #1 CHOICE Status is in choice states.
Choice #2 CHOICE Status is in choice states.
Choice #3 CHOICE Status is in choice states.
Choice #4 CHOICE Status is in choice states.
Choice #5 CHOICE Status is in choice states.
Choice #6 CHOICE Status is in choice states.

API response codes

Code Number Code Label Description
200 OK Request was successful.
400 Bad request The syntax of the request was wrong.
401 Unauthorized The request was not allowed, usually due to incorrect authentication.
404 Not found The requested resource was not found.
500 Internal error The server encountered an unexpected condition which prevented it from fulfilling the request.
503 Server busy The server is currently unable to handle the request due to temporary overloading. This is to prevent denial of service. Another reason of this error is to allow only single request per customer at a time. Same error is also given if more than 10 customers hitting the CCM API at the same time.

Overview

The 8x8 External IVR API is a HTTP API that provides tenants the ability to integrate with an external IVR system. The feature is embedded in the current 8x8 virtual contact center IVR server. Once a customer call enters the 8x8 IVR server, a tenant administrator has the capability to configure the IVR script to relay a call to an external IVR server. This document describes the supported parameters for using the External IVR API. Examples are provided for references. All API requests are authenticated using a token that is issued to a valid 8x8 tenant. For security reasons, the External IVR API only accepts request using HTTPS, so that request headers and response data are encrypted.

Authentication

In order to make an API request, you must first obtain an authentication token that has been issued for your tenant. This token combines username and password into a single long string. To get your token, log into the Configuration Manager, select Integration, and click the API Token tab. The Action Request Token needs to be used in all API requests. Next, click New Token. This generates a new private token for your tenant. You will use this token in all requests to this API. You may generate a new token at any time; however, once a new token is generated, the old token becomes invalid.

Configuration

Follow the steps below to set up an incoming call channel to route a call to external IVR.
  1. Add new Forward to External IVR node to an existing IVR script.
  2. Assign label name and access phone number of the external IVR server.
  3.  Add resume action when external IVR server terminate the call without sending API request via this API interface or fail to connect the external IVR server. If an external IVR request was successfully submitted before the call the terminated, the resume action will have no effect and the call will be routed base on the API request.

Query Parameters

GET/POST Parameters

The following parameters are allowed parameters that can be passed along with the External IVR URL using GET or POST method.
There is a limit of 500 characters.
Parameter Name Description Accepted value Mandatory
tenant Tenant name System provided tenant id Yes
token Authentication token   Yes
sip_id Unique sip call id The unique sip call id of the call, which is defined in Call-ID header of a SIP message Yes
action Type of call routing action to be executed wForwardACDwForwardAgent (not yet available) Yes
param Action parameter. The parameter will be defined base on action type. wForwardACD – a valid queue idwForwardAgent – a valid agent id Yes
extIvrData This attribute can be used to pass name value pairs that will be used for populating the transaction panel when an agent is offered the interaction. Each name value pair is enclosed by [ ] and the name/value are separated by “|”. There is a limit of 500 characters. No

Tenant Name

Tenant name can be found in Configuration Manager under HomeProfile panel.

Queue Id

The per-tenant unique queue id can be obtained under the Queues panel in Configuration Manager

External Data

External call data to be passed back to 8x8 Virtual Contact Center platform, which will then be available for agent to view in AGUI call transaction panel. The data should be in name value pair separated by | character. And each name value pair should be enclosed with open and close square brackets, such as [name|value] Example:
extIvrData=[First Name|John][Last Name|Smith]
 
Sample API Request URL
The web callback API makes it easy to submit a query, for experimentation, testing or debugging purposes. From a web browser, simply enter the URL. For example,
https://vcc-na4.8x8.com/SC/externalIvrAction.php?tenant=klvm2&token=92bd5cbf9ab120b3a47bdef9284b323d&sip_id=MDc5ZGI5ZDgyYjY2NGRiNjNjMjQ3ZjkyMGQyMzljMzY&action=wForwardACD&param=102
The request above will try to route to call to queue with id 102 after the call is terminated from the external IVR system.
Revise your query URL based on the login URL of your Tenant. Refer to the 8x8 Contact Center Platform URL Guide to retrieve your login URL.

Examples

VoiceXML Example:
The following script will redirect a call to queue with id 114 once the IVR server hangs up the call.
<callxml version="3.0">
  <do label="mainmenu" choices="1" repeat="10">
    <say>
      Welcome to the 8 by 8 External IVR Demo.
      To redirect your call to an ACD queue, press 1.
    </say>
    <wait value="5s"/>
    <on event="choice:1" next="#redirectQ"/>
    <on event="choice:nomatch">
        <say>Invalid choice. Please try again.</say>
    </on>
  </do>
  <do label="redirectQ">
    <assign var="tenant" value="klvm2"/>
    <assign var="token" value="92bd5cbf9ab120b3a47bdef9284b323d"/>
    <assign var="action" value="wForwardACD"/>
    <assign var="sip_id" value="$session.SIPCallID;"/>
    <assign var="param" value="114"/>
    <assign var="extIvrData" value="[First Name|John][Last Name|Smith][Account
 ID|12345678]"/>
 
    <prompt>
    Please wait while we redirect your call.
    </prompt>
    <fetch value="https://8x8.com/SC/externalIvrAction.php" submit="sip_id, tenant, 
token, action, param, extIvrData" method="post" var="retValue" />
    <prompt>
    thank you for waiting. your call is being redirected to queue $param;.
    </prompt>
    <hangup/>
  </do>
</callxml>

Overview

8x8 Contact Center has APIs across a broad range of areas that allow for integration of 8x8 with other platforms and services allow for flexibility and to maximize investments in technology.
Use cases include:
  • Making Realtime and Historical data available in other systems to drive business intelligence
  • Enhancing workflows by embedding chat and or callbacks
  • Integration with websites and bots allowing customized chat experiences and or integration with bots, including visibility into current workload and schedule status
  • Ability for CRMs or other systems to make and manage calls on behalf of agents.
  • Control campaigns and outreach, for ordered, efficient calls for renewals, expiration notices or other critical customer touch points.
  • Reduced customer frustration by popping the caller’s account information to the agent as soon as the call comes in
8x8 representatives can assist in validating use cases and guiding customers in leveraging APIs.

8x8 Contact Center APIs

Additional Information

For even more detailed guidance and use case application, see the 8x8 Developer Hub.

Overview

The 8x8 Recordings API is composed of a set of URIs that identify and request recordings data from the 8x8 database. This style of API makes it very easy to compose and send a query, which is always done using an HTTP GET request.
The Recordings database contains data about call recordings; the recording file name, phone number called, customer ANI, and so on.
All API requests are authenticated using a token that is issued to a valid 8x8 tenant. Responses are sent in either XML or CSV format.
For security reasons, the Recordings API only accepts request using HTTPS, so that request headers and response data are encrypted.

Authenticate

In order to make an API request, you must first obtain an authentication token that has been issued for your tenant. This token combines the username and password into a single long string. To get your token:
  1. Log in to Configuration Manager for Contact Center.
  2. Open Integration, and go to the API Token tab.
  3. Next to Data Request Token, click the New Token button to generate a new private token for your tenant. Use this token in all requests to the Recordings API. You may generate a new token at any time.

    DataRequest.png

Test Using a Browser

The Recordings API makes it easy to submit a query for experimentation, testing, or debugging purposes.
  1. From a web browser, enter your API query URL, which contains your platform URL. The platform URL varies based on the tenant your system is hosted on. For details, refer to the 8x8 Contact Center Platform URL Guide. In the following example, replace "X" in the URL as needed based on your tenant platform URL:
    https://vcc-naX.8x8.com/api/recordings/files/
  2. At the prompt, enter a username and password. Enter your tenant name as the username, and your authentication token as the password. The query result is then displayed in your browser.
The query returns information about all call recording files, in XML format.

Test Using curl

In a Linux environment, the curl utility submits an HTTP request, and allows you to view the result:
curl -u acme:ac12343934687a839cf https://vcc-naX.8x8.com/api/recordings/files.csv
The query returns a list of recording files, in CSV format. The -u argument identifies the username and password; use your tenant name as the username, and your authentication token as the password.

Files

You can use a query to look up files.

List All Call Recording Files

/files
The above query returns a list of all call recording files:
<?xml version='1.0'  encoding='UTF-8' ?>
<recordings>
  <file>
    <startDate>2007-12-19T19:16:36-08:00</startDate>
    <agentID>bill</agentID>
    <phoneNumber>bill</phoneNumber>
    <channel>5027780</channel>
    <caseID>0</caseID>
    <duration>27</duration>
    <filename>S20071220/R2007122003163601000.wav</filename>
    <queueID>fernandez~~queue~~phone~~102</queueID>
    <queueName>phoneq1</queueName>
    <accountNumber>0</accountNumber>
    <transactionID>1</transactionID>
    <extVar1>0</extVar1>
    <extVar2>0</extVar2>
    <outDialCode />
    <wrapUpCode>
    <transactionCodes>
    <transactionCode>
    <listName>Gauffre</listName>
    <name>Gauffre 1</name>
    </transactionCode>
    </transactionCodes>
    </wrapUpCode> 
  </file>
</recordings>
To get a recording file for a completed call, use the parameters supplied in the post-call screen pop:
https://vcc-naX.8x8/api/recordings/files?agentID=bill&channel=8005557780&phoneNumber=4155551234&finish-date=2007-12-19 19:16:58Z
The type of data returned for each recording could be one of the following:
  • Outbound
  • Inbound
  • Direct Agent Access
To interpret the type of recording, use the value provided in the channel field. For different call types, the value in the phone number field represents different attributes of the call.
Call Type Channel Phone Number Queue ID Queue Name
Busy (Inbound/Outbound) Channel of the call dialing to (for inbound only) Caller ID of the caller Queue ID of the queue Queue Name of the queue
Outbound #virtual_outbound# Dial-out number QUEUE_OUTBOUND QUEUE_OUTBOUND
Direct Agent Access #virtual_daa# Caller ID of the caller QUEUE_DIRECT_AGENT_ACCESS QUEUE_DIRECT_AGENT_ACCESS

Delete a Call Recording File

/files/S20071220/R200712200316361000[.wav]

Chat Transcripts

You can either get a list of your existing chat transcripts, or examine the messages in a specific chat transcript.

List All Chat Transcripts

/transcripts
The above query returns a list of all chat transcripts:
<?xml version='1.0'  encoding='UTF-8' ?>
<recordings>
  <transcript>
    <startDate>2007-12-19T19:16:36-08:00</startDate>
    <agentID>bill</agentID>
    <agentName>Bill,Jackson</agentName>
    <contactID>guest_at_dev6chatrec@vm05dev187.dev.whitepj.net/CtlGuest191gafdDQNAStnY7DaKuDKwPwd5jYsoh</contactID>
    <contactName>Jeff Waugh</contactName>
    <queueID>104</queueID>
    <queueName>chat_recording_2</queueName>
    <channelID>103</channelID>
    <channelName>chatrec_channel</channelname>
    <caseID>24482</caseID>
    <targetIP>10.191.210.31</targetIP>
    <transactionID>11</transactionID>
    <interactionGUID>int-14a0febe466-bLfK0EF6BKKvFMZmhhFdW14v0-chat-03-tenant</interactionGUID>
    <transcriptType>A2C</transcriptType>
    <duration>54</duration>
    <metaDatas>
      <metaData>
        <fieldName>Color</fieldName>
        <fieldValue>Blue</fieldValue>
      </metaData>
      <metaData>
        <fieldName>Fruit</fieldName>
        <fieldValue>Cherry</fieldValue>
      </metaData>
    </metaDatas>
  </transcript>
</recordings>

List All Messages in a Specified Transcript

/transcripts/{interactionGUID}
The above query returns a list of all messages in the specified interaction:
<?xml version='1.0'  encoding='UTF-8' ?>
<transcript>
  <startDate>2007-12-19T19:16:36-08:00</startDate>
  <agentID>bill</agentID>
  <agentName>Bill,Jackson</agentName>
  <contactID>guest_at_dev6chatrec@vm05dev187.dev.whitepj.net/CtlGuest191gafdDQNAStnY7DaKuDKwPwd5jYsoh</contactID>
  <contactName>Jeff Waugh</contactName>
  <queueID>104</queueID>
  <queueName>chat_recording_2</queueName>
  <channelID>103</channelID>
  <channelName>chatrec_channel</channelname>
  <caseID>24482</caseID>
  <targetIP>10.191.210.31</targetIP>
  <transactionID>11</transactionID>
  <interactionGUID>int-14a0febe466-bLfK0EF6BKKvFMZmhhFdW14v0-chat-03-tenant</interactionGUID>
  <transcriptType>A2C</transcriptType>
  <duration>54</duration>
  <metaDatas>
    <metaData>
      <fieldName>Color</fieldName>
      <fieldValue>Blue</fieldValue>
    </metaData>
    <metaData>
      <fieldName>Fruit</fieldName>
      <fieldValue>Cherry</fieldValue>
    </metaData>
  </metaDatas>
  <messages>
    <message>
      <messageTime>2007-12-19T19:16:36-08:00</messageTime>
      <messageFrom>C</messageFrom>
      <originalLanguage>en</originalLanguage>
      <originalMessage>Hi How r u</originalMessage>
      <translatedLanguage/>
      <translatedMessage/>
    </message>
  </messages>
</transcript>

Remove Transcripts of an Interaction

The following query removes all messages of a specified transcript. 
DELETE 
/transcripts/{interactionGUID} 
Notes:
  • All messages will be removed, but the interaction continues to exist (with a dummy message).
  • If the interaction does not exist, the return code will be 204 (No content).
Dates
Date formats in queries adhere to the ISO 8601 standard. The {date range} argument can take one of two forms. To specify records from a given day, specify the date. You can include an optional time zone parameter:
https://vcc-naX.8x8.com/api/recordings/files?d=2007-08-05&tz=America/New_York
Note that if no time is given, a day begins at midnight (00:00:00), and if no time zone is specified, the time defaults to the tenant time zone. To view a list of valid time zones, click here, and look through the "TZ" column of the table. To specify a date range, separate the dates with a comma.
https://vcc-naX.8x8.com/api/recordings/files?d=2007-08-05,2007-08-07
You can include times in date ranges as well, separated with a space ("%20″ in the URI):
https://vcc-naX.8x8.com/api/recordings/files?d=2007-08-05%2013:15Z,2007-08-07%2014:30Z
The time zone designator ("Z" in the URI) signifies that the time is in UTC (Coordinated Universal Time). Dates may also be formatted as a single string, with no separators, and a capital "T" separating date and time:
https://vcc-naX.8x8.com/api/recordings/files?d=20070805T1315Z,20070807T1430Z
There are several date constants available to represent relative dates:
  • today: The current date, at the start of the day (midnight)
  • today-1d: Yesterday, at the start of the day (midnight)
  • today-7d: Seven days ago, at the start of the day (midnight)
To see yesterday's recordings:
https://vcc-naX.8x8.com/api/recordings/files?d=today-1d,today&tz=America/Denver
Dates in responses also adhere to the ISO 8601 standard. They take the form:
2008-02-14T10:12:13-08:00
In the query, "-08:00″ represents the offset with the UTC time zone (Coordinated Universal Time). A negative offset typically represents time zones west of UTC.

Keep in Mind

When entering dates:
  • start-date should be used to find voice recordings that started within 5 seconds (plus or minus) of a given date(/time). If no time is provided, the API will default to midnight (+-5 seconds).
  • finish-date should be used to find voice recordings that ended within 5 seconds (plus or minus) of a given date(/time). If no time is provided, the API will default to midnight (+-5 seconds).
  • start-date and finish-date cannot be used together to emulate a date range. You should use a date range in reference to the "d" variable, as shown in the section above. If you still try to use both variables in a same query, only "start-date" will be used.

Pagination

Requests that would return a large number of records respond with 50 records per request. You can iterate through these response sets by setting the {offset} argument. In this example, we are asking for agent interactions, starting with the 101st record:
https://vcc-naX.8x8.com/api/recordings/files?n=101

Query Variables

Queries that return interaction data may be further constrained by supplying query variables. These take the form of field=value, in which field is any field normally returned by the query (such as agentID, phoneNumber, channel, and so on). There are two exceptions worth mentioning:
  • start-date: "start-date" should be used instead of "startDate"
  • finish-date: "finish-date" is not one of the output fields
Note that query variables are case-sensitive (use "start-date" instead of  "Start-Date"). For example, to return only the set of recordings for a particular channel:
https://vcc-naX.8x8.com/api/recordings/files?channel=8005551234

Metadata Variables

Queries that return interaction data may be further constrained by supplying the metadata field name and/or field value. These parameters are provided as metaData_fieldName=val and metaData_fieldValue=val. The metadata field name and value can have the value of a complete sentence. Since it could be difficult for user to provide the exact value, we have provisioned to match the sub-string as well. Let's say that the metadata field name is "Number of alphabets in your native language"; if the user only provides the fragment "alphabets in", the query still searches the record. Note that search remains case-sensitive.

Responses

Each resource may be returned in either XML, JSON, or CSV format. To specify, add ".xml", ".json", or ".csv" to the URL:
https://vcc-naX.8x8.com/api/recordings/files.csv
If you do not specify the file type, the default is XML.
For compatibility reasons, .../transcripts/{interactionGUID} API does not give a CSV response.

Response Codes

Code Number Code Label Description
200 OK The request was successful.
400 Bad request The syntax of the request was wrong.
401 Unauthorized The request was not allowed, usually due to incorrect authentication.
404 Not found The requested resource was not found.
500 Internal error The server encountered an unexpected condition which prevented it from fulfilling the request.
503 Server busy The server is currently unable to handle the request due to temporary overloading.

Overview

The 8x8 Embedded Chat API is composed of a set of topics that can be subscribed to or published to a message bus. The tenant can use these topics to send commands to the embedded chat, as well as listen to events triggered by it.

How to access the Message Bus

In order to communicate with the embedded chat, the tenant must have a reference to the message bus object that is used to publish messages and subscribe to chat events. This reference can only be accessed inside the onInit callback function, as its first parameter.
The onInit callback function must be defined and assigned to the configuration object present in the embedded chat code snippet. This function (if defined) is automatically called once the chat has been initialized and is ready to publish and subscribe to events in the message bus:
  /**
       * Callback function called after the chat has been initialized.
       *
       * @param bus The message bus used to publish and subscribe to topics
       */
       onInit: function(bus) {
          // Message bus created and ready to be used,
                                window.bus = bus;
                     }            
       };

How to publish to a topic

As soon as the tenant has access to the message bus, they can control some embedded chat behaviors by publishing messages to it. The messages are sent through this bus using the publish method, which requires a topic and an optional data object, passed to subscribers to that same topic.
Example:
  // Publish to other-topic, sending some data
  bus.publish("other-topic", {
      message: "Hello world!"
  });

How to subscribe to a topic

The tenant can also subscribe to topics using the subscribe method in order to listen to messages published by the embedded chat. This method requires a topic to subscribe to and a handler function that will be called when a message is published to the message bus using such topic. The handler function gets passed some data as its first parameter (which can be null if the sender did not publish any data).
Example:
  // Subscribe to some-topic, and log the event data
  var subscription = bus.subscribe("some-topic", function(data) {
      console.log(data);
  });

How to unsubscribe from a topic

The subscribe method also returns a subscription object with a single remove method, which can be used to unsubscribe from that topic.
Example:
  // Unsubscribe from a previously created subscription
  subscription.remove();
 

How to set a variable in a script

To set a variable for use in the Chat script.  See here for more information on Chat Variables
// set the _options variable to "DEF"
bus.publish("chat:set-variables", {"_options":"DEF"});

Customer Information

Introduction

A tenant may have relevant information about a customer currently using the embedded chat. For example, if a customer is using the embedded chat while viewing a product inside an ecommerce website, the tenant could, in principle, already know the customer name, age and other personal details, as well as which product is being viewed by the customer.
If the tenant could send this information to the agent, through the embedded chat, the customer wouldn't need to enter the same information to the agent. To solve this problem, the API allows the tenant to set and reset the customer information at any time after the embedded chat has been initialized. The passed data is submitted to the server when the customer is assigned to a queue or sends an offline form, and the tenant can choose to be notified about the customer information submission event.

Usage

The following messages are used to set and reset the customer information:
  • customer:set-info: Sets the customer information, passing an object containing the desired properties. These properties are merged to any previously set customer information, overwriting properties with the same name.
Example:
  bus.publish("customer:set-info", {
      "First name": "John",
      "Last name":  "Doe",
      "Age":        25,
      "Premium":    true
  });
  • customer:reset-info: Resets the customer information, erasing any properties previously set.
Example:
  bus.publish("customer:reset-info");
The embedded chat publishes the following messages related to the customer information:
  • customer:info-sent: Published as soon as the customer information is sent to the server, passing the information just submitted as well as the current chat phase.
Example:
  bus.subscribe("customer:info-sent", function(data) {
      // data.info contains the customer information just sent
      // to the server, and data.phase the current chat phase
  });

Implementation Example

The following code exemplifies the complete implementation of an onInit callback function body, and the results when the customer information is successfully submitted to the server after being added to a chat queue:
  // Set the customer info
  bus.publish("customer:set-info", {
      "First name": "John",
      "Last name":  "Doe",
      "Age":        25,
      "Premium":    true
  });
  // Remove the customer's first name, keeping all other
  // previously set values
  bus.publish("customer:set-info", {
      "First name": null
  });
  // Listen to the customer info sent event, triggered when
  // the customer info has been sent to the server
  bus.subscribe("customer:info-sent", function(data) {
      console.log(data);
      // -> {
      //      info: {"Last name": "Doe", "Age": 25, "Premium": true}
      //      phase: "chatWindow"
      //    }
  });

Screenshots

The customer information is available in the following locations, depending on how it was submitted:
  • Customer information in agent transcript.
EmChat_CustomerInfo.png
  • Customer information in case details.
EmChat_CRM.png
  • Customer information in offline form email.
customer-info-offline-email-600x233.png

Important Notes

  • The customer information can be set and/or reset at any time using the message bus and the respective customer:set-info and customer:reset-info topics, but it will only be actually sent to the server when the customer is added to a queue and/or has submitted an offline form.
  • Whenever the customer information is submitted to the server, a message containing the data that was just sent will be immediately published to the message bus using the customer:info-senttopic. The tenant has no control over when the data is submitted to the server.
  • Only primitive data types (strings, numbers and booleans) are allowed as values. Trying to set the customer information with non-primitive data types (e.g., objects, arrays and functions) will result in console warnings, and their values will be discarded.
  • Setting a customer information already previously set will overwrite that information, unless the new value is undefined. If the new value is null, that information will be removed from the customer information and will not be sent to the server from that moment on, unless it is set again with a non-null, defined value.
  • The customer information key:value pair is limited in 100 characters for the key and 500 character for the value. Any key:pair bigger than the specified value will be ignored.

Troubleshooting

  • Make sure that, when trying to remove properties from the customer information without resetting all its properties (i.e., by using the customer:set-info topic), the passed properties have null values (and not undefined), as setting undefined values to properties do not have any effect on the final customer information.
  • If the message Customer info <info> is not of a primitive type and will be discarded is shown in the browser console when trying to set the customer information, it means that the logged property value is of a data type unsupported by the embedded chat. Only primitive data types (strings, numbers and booleans) are currently allowed.
  • If the message Customer info <info> key is too big and will be discarded is shown in the browser console when trying to set the customer information, it means that the key string length is too big. Only strings with length less than 100 characters are allowed.
  • If the message Customer info <info> value is too big and will be discarded is shown in the browser console when trying to set the customer information, it means that the value string length is too big. Only strings with length less than 500 characters are allowed.

Chat Language

Introduction

A tenant may want to set the chat language manually instead of using a question in the Pre-Chat. For example, the tenant may already have this information and may not want to ask the customer again.
The API allows the tenant to set the chat language by sending a message through the bus with the language code.
The list of supported languages are:
  • English: en
  • Russian: ru
  • German: de
  • Japanese: ja
  • Spanish: es
  • French: fr
  • Portuguese: pt
  • Italian: it
  • Polish: pl
  • Croatian: hr
  • Hindi: hi
  • Dutch: nl
  • Arabic: ar
  • Danish: da
  • Korean: ko
  • Norwegian: no
  • Swedish: sv
  • Vietnamese: vi
  • Welsh: cy
  • Thai: th
  • Simplified Chinese: zh-CN
  • Traditional Chinese: zh-TW

Usage

The following messages is used to set the chat language:
  • chat:set-language: Set the chat language.
Example:
  bus.publish("chat:set-language", "pt");

Important Notes

  • The chat language can be set on any time before starting a chat (customer enter a queue) and you can change it as many time as you want, only the last value will be considered.
  • Only system messages and the chat transcription will be localized to the configured language.
  • This event should be published in the same bus as when setting the customer information.
  • If there is a chat form with language question, the selected language has priority over language configured in chat-api.
  • If there is a chat form with language question, the "set-language" sets the default language on the drop-down.
  • The  set-language (default language) on the drop-down has priority over the browser language and the default language configured in the chat form.

Troubleshooting

  • If the message "Chat language <language> is not valid and will be discarded" is shown in the browser console when trying to set the chat language, it means that the language code is not valid. Only language codes specified in the list of available languages above are valid.

End Chat Trigger

Introduction

A tenant may want to trigger the end chat from a different element instead of the default close chat button.
The API allows the tenant to configure the page to send a message through the bus indicating when to trigger the End chat.

Usage

The following messages is used to trigger the end chat:
  • Chat: end: Trigger the chat end.
Example: 
  bus.publish("chat:end");

Important Notes

  • The API call to end the chat closes the chat window if an agent is not connected.
  • The API call to end the chat triggers the confirmation to close if an agent is connected.
  • The API call to end chat must be called on the same bus as the customer information.

Invitation Window Trigger

Introduction

A tenant may want to trigger the Invitation window manually instead of waiting for a fixed time. For example, the tenant may have additional information from the customer and may want to trigger the Invitation window after a specific customer action.
The API allows the tenant to configure the page to send a message through the bus indicating when to trigger the Invitation window.

Usage

The following messages is used to trigger the Invitation window:
  • chat:trigger-invitation: Trigger the Invitation window.
Example:
  bus.publish("chat:trigger-invitation");

Important Notes

  • When triggering the Invitation, it will only be open if the customer is not in a Pre-chat, Chat window or Offline form. So, it will show the Invitation window if the chat is closed or if it is displaying another Invitation. In this last case, the Invitation will be replaced by the new one.
  • Calling this message will trigger the Invitation window, which is displayed only if an Invitation window is available for display in the Chat Script.
  • If you don’t want your Invitation window to be automatically displayed (only by calling chat:trigger-invitation), set all your Invitations nodes in the Chat Script as Invitation to chat pops up after (seconds): Custom.
  • This message must be called in the same bus as the Customer Information.
  • When triggering the Invitation, a flag will be displayed on both Transaction Information Panel and Chat Log to identify the interaction was started by Chat API.

Troubleshooting

  • Triggering the Invitation window is not a guarantee that a Invitation will be shown. The request will be sent to the server in order to check for an Invitation window in the Chat Script. So, if there isn’t any Invitation window available, none will be displayed.
  • If the message Missing next step from step initInvitation [invitation] is shown in the browser console when trying to trigger the Invitation, it means that the Invitation is not available given the Chat Script conditions.

Pre-Chat window trigger

Introduction

A tenant may want to trigger the Pre-Chat window manually. For example, the tenant may have additional information from the customer and may want to trigger the Pre-Chat window after a specific customer action.
The API allows the tenant to configure the page to send a message through the bus indicating when to trigger the Pre-Chat window.

Usage

The following message is used to trigger the Pre-Chat window:
  • chat:trigger-pre-chat
Trigger the Pre-Chat window.
Example:
bus.publish("chat:trigger-pre-chat");

Important Notes

  • When triggering the Pre-Chat, it will only be open if the customer is not in a Pre-chat, Chat window or Offline form. So, it will show the Pre-Chat window if the chat is closed or if it is displaying an Invitation window.
  • Calling this message will trigger the Pre-Chat window to be displayed only if a Pre-Chat window is available to be displayed in the Chat Script.
  • This message must be called in the same bus as the Customer Information.
  • When triggering the Pre-Chat, a flag will be displayed on both Transaction Information Panel and Chat Log to identify the interaction was started by Chat API.
  • In case the Chat is configured to open as a popup in Chat Script, make sure the API is called as a result of a user's action, otherwise the Browser can block the popup window.
  • In case the Chat is configured to open as a popup in Chat Script, the Pre-Chat window will be displayed only if no popup window is already opened.

Troubleshooting

  • Triggering the Pre-Chat window is not a guarantee that a Pre-Chat will be shown. The request will be sent to the server in order to check for a Pre-Chat window in the Chat Script. So, if in that moment there isn't any Pre-Chat window available, none will be displayed.
  • If the message Missing next step from step initPreChat [preChat] is shown in the browser console when trying to trigger the Pre-chat, it means that the Pre-Chat is not available given the Chat Script conditions.

Chat window trigger

Introduction

A tenant may want to trigger the Chat window manually. For example, the tenant may have additional information from the customer and may want to trigger the Chat window after a specific customer action.
The API allows the tenant to configure the page to send a message through the bus indicating when  to trigger the Chat window.

Usage

The following message is used to trigger the Chat window:
  • chat:trigger-chat-window
Trigger the Chat window.
Example:
bus.publish("chat:trigger-chat-window");

Important Notes

  • When triggering the Chat, it will only be open if the customer is not in a Chat window. So, it will show the Chat window if the chat is closed or if it is displaying an Invitation or Pre-Chat window.
  • Calling this message will trigger the Chat window to be displayed only if a Chat window is available to be displayed in the Chat Script.
  • This message must be called in the same bus as the Customer Information.
  • When triggering the Chat, a flag will be displayed on both Transaction Information Panel and Chat Log to identify the interaction was started by Chat API.
  • In case the Chat is configured to open as a popup in Chat Script, make sure the API is called as a result of a user's action, otherwise the Browser can block the popup window.
  • In case the Chat is configured to open as a popup in Chat Script, the Chat window will be displayed only if no popup window is already opened.

Troubleshooting

  • Triggering the Chat window is not a guarantee that a Chat will be shown. The request will be sent to the server in order to check for a Chat window in the Chat Script. So, if in that moment there isn't any Chat window available, none will be displayed.
  • If the message Missing next step from step initChatWindow [chatWindow] is shown in the browser console when trying to trigger the Chat, it means that the Chat is not available given the Chat Script conditions.

System Message Localization

Introduction

A tenant may want to localize or customize some/all chat system messages. For example, s/he can customize the message that is shown when the chat session is established.

Configuration

The __8x8Chat configuration should be like this:
Note that the configuration is the same as when using the Message Manipulation, so you don’t need to configure it again if you already have an external bus handler script configured. You just need to implement the System Message Localization in the external script.
  <script type="text/javascript">
      var __8x8Chat = {
          // Other chat parameters (uuid, tenant, channel, domain...)
          
               /**
           * Property with the translation map
           *
           */
          customSystemMessages: {
            endChatButton: "End chat",
            closeChatButton: "Close",
            (...)
          } 

      };
  </script>

Available System Messages that can be Customized

  • endChatButton: “End chat”
  • closeChatButton: “Close”
  • errorServerUnavailable: “Server is unavailable. Please, try again later.”
  • chatEstablished: “Your chat session has been established.”
  • chatEstablishedName: "You are now chatting with {<agent>}."
  • chatEstablishedAgent: "You are now chatting with an agent."
  • chatEstablishedAgentNew: "You are now chatting with a new agent."
  • chatQueued: “We will be with you shortly.”
  • chatForwarded: “Your chat is being forwarded. Please wait.”
  • chatMsgTooLong: “Your last message was shortened because it exceeded maximum length.”
  • chatDisconnected: “You have been disconnected from your chat session. Please check your network connection and try again.”
  • chatEnded: “You have ended your chat session.”
  • agent: "Agent"
  • agentTyping: “Agent is typing…”
  • agentTypingName: "{<agent>} is typing..."
  • agentDisconnected: “The agent has disconnected from this chat session.”
  • errorInvalidLogin: “We have encountered an error trying to start a new chat. Please try again later.”
  • endChatNotification: “Chat session has been ended.”
  • endChatConfirmation: “Are you sure you want to end this chat session?”
  • chatLogTitle: “Chat Log”
  • chatLogDescription: “Below is a complete log of the chat session.”
  • yesButton: “Yes”
  • noButton: “No”
  • coBrowsingStartButton: "Start co-browsing session"
  • coBrowsingEndButton: "End co-browsing session"
  • saveButton: “Save”
  • clearButton: “Clear”
  • pullDownInfo: “Swipe to see more options”
  • errorGenericMessage: “Sorry, something went wrong. Please try again later.”
  • errorRequiredMessage: “Please verify the mandatory fields”
  • errorCrmFieldInvalidMessage: “Sorry, we couldn’t find your information using the value you provided.”
  • errorInvalidNumber: “The field is a numeric field.”
  • errorInvalidEmail: “The field only accept the valid e-mail format.”
  • preChatFormData: “Pre-Chat form data”
  • offChatFormData: “Offline form data”
  • skipQueueFormData: “Skip Queue form data”
  • chatTranslationOn: “Automatic chat translation has been turned on.”
  • chatTranslationOff: “Automatic chat translation has been turned off.”
  • chatTranslationServiceError: “Translation service error.”
  • coBrowsingInvitePrompt: "Allow agent to see your browser window?"
  • coBrowsingInviteAccept: "Yes, start sharing"
  • coBrowsingInviteReject: "No"
  • coBrowsingInviteAccepted: "You accepted the request."
  • coBrowsingInviteRejected: "You rejected the request."
  • coBrowsingSessionStarted: "Co-browsing session started."
  • coBrowsingSessionEnded: "Co-browsing session ended."
  • coBrowsingSessionRestored: "Co-browsing session restored."
  • sessionDisconnected: “Your chat session has ended.”
  • emptySubject: "[ Customer message ] No subject"

Implementation Example

The following code exemplifies the complete implementation of an onInit callback function body, appending “(modified)” to every system message:
   customSystemMessages: {
      endChatButton:               "(modified) End chat",
      closeChatButton:             "(modified) Close",
      errorServerUnavailable:      "(modified) Server is unavailable. Please, try again later.",
      chatEstablished:             "(modified) Your chat session has been established.",
      chatEstablishedName:         "(modified) You are now chatting with {<agent>}.",
      chatEstablishedAgent:        "(modified) You are now chatting with an agent.",

      chatEstablishedAgentNew:     "(modified) You are now chatting with a new agent.",
      chatQueued:                  "(modified) We will be with you shortly.",
      chatForwarded:               "(modified) Your chat is being forwarded. Please wait.",
      chatMsgTooLong:              "(modified) Your last message was shortened because it exceeded maximum length.",
      chatDisconnected:            "(modified) You have been disconnected from your chat session. Please check your network network connection and try again.",
      chatEnded:                   "(modified) You have ended your chat session.",
      agent:                       "(modified) Agent",
      agentTyping:                 "(modified) Agent is typing...",
      agentTypingName:             "(modified) {<agent>} is typing...",
      agentDisconnected:           "(modified) The agent has disconnected from this chat session.",
      errorInvalidLogin:           "(modified) We have encountered an error trying to start a new chat. Please try again later.",
      endChatNotification:         "(modified) Chat session has been ended.",
      endChatConfirmation:         "(modified) Are you sure you want to end this chat session?",
      chatLogTitle:                "(modified) Chat Log",
      chatLogDescription:          "(modified) Below is a complete log of the chat session.",
      yesButton:                   "(modified) Yes",
      noButton:                    "(modified) No",

      coBrowsingStartButton:       "(modified) Start co-browsing session",
      coBrowsingEndButton:         "(modified) End co-browsing session",
      saveButton:                  "(modified) Save",
      clearButton:                 "(modified) Clear",
      pullDownInfo:                "(modified) Swipe to see more options",
      errorGenericMessage:         "(modified) Sorry, something went wrong. Please try again later.",
      errorRequiredMessage:        "(modified) Please verify the mandatory fields",
      errorCrmFieldInvalidMessage: "(modified) Sorry, we couldn't find your information using the value you provided.",
      errorInvalidNumber:          "(modified) The field is a numeric field.",
      errorInvalidEmail:           "(modified) The field only accept the valid e-mail format.",
      preChatFormData:             "(modified) Pre-Chat form data",
      offChatFormData:             "(modified) Offline form data",
      skipQueueFormData:           "(modified) Skip Queue form data"

      chatTranslationOn:           "(modified) Automatic chat translation has been turned on.",
      chatTranslationOff:          "(modified) Automatic chat translation has been turned off.",
      chatTranslationServiceError: "(modified) Translation service error.",
      coBrowsingInvitePrompt:      "(modified) Allow agent to see your browser window?",
      coBrowsingInviteAccept:      "(modified) Yes, start sharing",
      coBrowsingInviteReject:      "(modified) No",
      coBrowsingInviteAccepted:    "(modified) You accepted the request.",
      coBrowsingInviteRejected:    "(modified) You rejected the request.",
      coBrowsingSessionStarted:    "(modified) Co-browsing session started.",
      coBrowsingSessionEnded:      "(modified) Co-browsing session ended.",
      coBrowsingSessionRestored:   "(modified) Co-browsing session restored.",
      sessionDisconnected:         "(modified) Your chat session has ended.",
      emptySubject:                "(modified) [ Customer message ] No subject"
   };
 

Important Notes

Some messages (e.g. chatEstablishedName) contain placeholders that are replaced by real values when applied. These placeholders are wrapped in double curly braces {{}} and, if present, will be replaced on customized messages as well.

Custom Stylesheet

Introduction

A tenant may want to customize embedded chat elements that are currently not available in the Chat Design page. For this reason it is possible to set a custom CSS file to be loaded before the chat is started, letting the tenant change the chat look and feel to a more fitting style.

Configuration

The __8x8Chat configuration should be like this:
  <script type="text/javascript">
      var __8x8Chat = {
          // Other chat parameters (uuid, tenant, channel, domain...)
          
          stylesheetURL: "https://path.to/external-stylesheet.css"
      };
  </script>
Notice the stylesheetURL configuration parameter. This should indicate the path to the CSS file that should be loaded by the chat window to apply the desired custom styles. Embedded chat using a custom stylesheet:
 

An example style sheet

You can use this text to help getting started authoring a new chat theme. The results of this stylesheet can be seen above.
{\rtf1\ansi\ansicpg1252\cocoartf1344\cocoasubrtf720
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\margl1440\margr1440\vieww10800\viewh8400\viewkind0
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural
\f0\fs24 \cf0 /*****************************************************************************\
 * General\
 *****************************************************************************/\
body, input[type="text"], textarea, button, select \{\
    font-family: "Segoe UI", "Myriad Pro", Frutiger, "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", Arial, sans-serif;\
\}\
\
/*****************************************************************************\
 * Container\
 *****************************************************************************/\
.container, .inner-container, button \{\
    border-radius: 0;\
\}\
\
.inner-container \{\
    -ms-filter: "none";\
    background: none;\
    padding: 0;\
\}\
\
/*****************************************************************************\
 * Controls\
 *****************************************************************************/\
.control \{\
    background: none !important;\
    border: 0 !important;\
    line-height: 1.1;\
    text-decoration: none !important;\
    opacity: 0.8 !important;\
\}\
\
.control:hover \{\
    opacity: 1 !important;\
\}\
\
.control.close:before, .control.end:before \{\
    color: #fff;\
    content: "\\00D7";\
\}\
\
/*****************************************************************************\
 * Header\
 *****************************************************************************/\
.header .logo \{\
    display: none !important;\
\}\
\
.header .title \{\
    background: rgba(0, 0, 0, 0.6);\
    font-size: 14px;\
    color: #fff;\
    padding: 5px 8px;\
\}\
\
/*****************************************************************************\
 * Form\
 *****************************************************************************/\
input[type="text"], textarea, .message-history, select \{\
    box-shadow: none;\
\}\
\
button, button:active \{\
    -ms-filter: "none";\
    background-image: none;\
    box-shadow: none;\
\}\
\
/*****************************************************************************\
 * Introduction\
 *****************************************************************************/\
.intro \{\
    padding: 0 20px;\
\}\
\
/*****************************************************************************\
 * Window\
 *****************************************************************************/\
.translation-header \{\
    border-left: 0;\
    border-right: 0;\
\}\
\
/*****************************************************************************\
 * Message\
 *****************************************************************************/\
#message-field \{\
    border: 0 !important;\
\}\
\
.message-history \{\
    border-left: 0;\
    border-right: 0;\
\}\
\
.message-actions \{\
    z-index: 1;\
\}\
\
.message-wrapper \{\
    padding: 15px;\
\}\
\
.message-content \{\
    display: inline-block;\
    width: 100%;\
\}\
\
.chat-outgoing-msg, .chat-incoming-msg \{\
    background: #fafafa;\
    border: 1px solid #ddd;\
    color: #333;\
    position: relative;\
\}\
\
.chat-outgoing-msg:before, .chat-incoming-msg:before,\
.chat-outgoing-msg:after, .chat-incoming-msg:after \{\
    content: "";\
    position:absolute;\
    border-style: solid;\
    display: block;\
    width: 0;\
\}\
\
.chat-outgoing-msg:before, .chat-incoming-msg:before \{\
    top: auto;\
    bottom: 8px;\
    right: -6px;\
    border-width: 6px 0 6px 6px;\
    border-color: transparent #ddd;\
\}\
\
.chat-outgoing-msg:after, .chat-incoming-msg:after \{\
    top: auto;\
    bottom: 10px;\
    right: -4px;\
    border-width: 4px 0 4px 4px;\
    border-color: transparent #fff;\
    clear: both;\
\}\
\
.chat-incoming-msg:before \{\
    top: 8px;\
    bottom: auto;\
    left: -6px;\
    border-width: 6px 6px 6px 0;\
\}\
\
.chat-incoming-msg:after \{\
    top: 10px;\
    bottom: auto;\
    left: -4px;\
    border-width: 4px 4px 4px 0;\
\}\
\
.chat-outgoing-msg \{\
    margin-left: 20%;\
    text-align: left;\
\}\
\
.chat-incoming-msg \{\
    margin-right: 20%;\
\}\
\
.chat-log-msg, .chat-info-msg, .chat-error-msg, .chat-link-msg \{\
    text-align: center;\
\}\
\
/*****************************************************************************\
 * Acknowledge/Close messages\
 *****************************************************************************/\
.acknowledge-text, .confirm-close \{\
    padding: 0;\
\}}
The stylesheetURL parameter MUST be a CSS file served over SSL (HTTPS protocol).

Important Notes

  • A functional stylesheet should be written by inspecting the current chat window HTML structure. This can be done using a web inspector, a tool shipped with most web browsers today.
  • As the chat window HTML structure may change between versions, the tenant should test their customizations when upgrading to make sure they are working as expected.

Overview

The 8x8 Contact Center Click-To-Dial API is a HTTP API that allows logged-in agent to perform outbound call by launching an external URL. The typical usage of Click-To-Dial is to create clickable hyperlink on CRM record to dial out on corresponding customer phone number.
This document describes the supported parameters for running Click-To-Dial. Example use cases are provided for references.
The API request is authenticated using client cookie. Only agent with valid 8x8 Agent Workspace session will be able to run Click-To-Dial API. Click-To-Dial API can only successfully run on the browse window that sharing the AGUI session.
For security reasons, the Click-To-Dial API only accepts request using HTTPS, so that request headers and response data are encrypted.

Testing Using A Browser

The Cick-To-Dial API makes it easy to submit a query, for experimentation, testing or debugging purposes. From a web browser, simply enter the URL. You will be promted to close the window. In the meantime, the correspoding agent phone will be ringed. Once agent answer the phone, destination phone will ring. For example,
https://vcc-na4.8x8.com/AGUI/make_call.php?prefix=1&phone=6502928880
will call the destination number 16502928880.
Revise your query URL based on the login URL of your Tenant. (Refer to the 8x8 Contact Center Platform URL Guide to retrieve your login URL)

Query Parameters

GET Parameters
The following parameters are allowed GET parameters passing along with the click-to-dial URL. All the GET parameter data should be URL encoded.
Parameter Name Description Accepted value
prefix Calling Phone Number Prefix Digit only.
phone Calling Phone Number Any phone number (formatted or non-formatted).
callerId Caller id to make the outbound call. Any existing phone channel number. Digit only.
dialplan_id Dial Plan Id that should be applied to the Phone Number. Digit only. A valid dial plan id. Id can be found from the Dial Plan listing table on Configuration Manager. If not specified, tenant default dial plan is used. It is an optional field.
queue_id Outbound queue id to make the call along with. Agent will become busy when the call established with the queue. Corresponding TCL will be applied along with the queue. Digit only. A valid queue id. Id can be found from the Queues listing table on Configuration Manager. It is optional field.

GET/POST Parameters

The following parameters are allowed parameters that can be passing along with the click-to-dial URL using GET or POST method.
Parameter Name Description Accepted value
ctl_userdata A set of name/value pair data to trigger desired action. Refer to Section 'ctl_userdata' below.
extTransactionData A set of name/value pair data to associate CRM record with auto log. Refer to Section 'extTransactionData' below.

extTransactionData

The exTransactionData allows tenant to pass in associated record ID and record and record type the click-to-dial call is triggered from. The extRecordId and extRecordType are usual to link the call log generated by the ctl_action automatically. Please refer to section 'Create Action' below for an example. However, the association can only applied for tenant using Enhanced SFDC integration.
The format of the value of extTransactionData looks like the following:
 extTransactionData=[extRecordId|value1][extRecordType|value2]

ctl_userdata

The ctl_userdata allow tenant to pass in any user data or system data to trigger supported click-to-dial related action. The design of ctl_userdata is to allow any combination of name/value data. Each name/value data shall be in the format of [name|value]. There is no limit on how many number of name/value data can be used to compose the ctl_userdata.
The value of ctl_userdata typically looks like the following:
ctl_userdata=[name1|value1][name2|value2][name3|value3]…
The category of name/value data is mainly divided into two groups: system data and user data.

System Data

System data are data recognized by Contact Center. All the name of the data that starts with 'ctl_' are treated as system data. The following table shows the list of supported system data with description.
Data Name Description Supported value Default Value Remarks
ctl_action Action command create No system default value. If not specified, no action is taken in Virtual Contact Center system.
ctl_intType Integration Type sfdc No system default value. If not specified, action will be ignored.
ctl_launchopt Launch Screenpop URL after action true|false false Launch Screenpop URL configured
ctl_launchext Launch Screenpop Option edit No system default value. If not specified, the record launched with the URL will be readonly. Value will be ignored if ctl_launchopt is not true.
ctl_parentid Launch Screenpop option with the parented as return URL valid ID No system default value. If not specified, no return URL for launching screenpop URL.
ctl_newRecordId Record ID used by do the launch URL. valid ID This is appended to the ctl_userdata after create action is finished by the Virtual Contact Center system. Tenant should not specify this.
ctl_callbackUrl The URL to do the callback. All the userdata with system generated result and data will be passing to the URL using POST method. Any valid URL. No system default value. If not specified, no callback will be done.
ctl_recordname The name of the record to launch the window/tab on screenpop window. No restriction.   This is used together with launchopt = true. If not specified, system will generate name for the new window/tab for launching screenpop.
User Data The user data are the data that for performing 'ctl_action' specified. The name of the user data should never start with 'ctl_' or it will be treated as system data. Contact Center only process the user data only with known 'ctl_action' and 'ctl_intType'. Refer to Examples below to find out what user data would look like. User data is mostly for recording information of the related activity (in this case, click-to-dial). Therefore, Contact Center provides a list tokens that can be used in user data. Tokens will be replaced by the actual data before it's used in the action or posting to the launch URL. The following is the list of supported tokens with description.
Token name Description
$caller_id$ The caller ID used to do the outbound call.
$transaction_id$ Transaction ID associated with the outbound call.
$call_answered_time$ UTC Call answered time in seconds. If call is not established, a number of 0 is used.
$call_hangup_time$ UTC Call hang up time in seconds. If call is not established, a number of 0 is used.
$callAnsweredTenantTT$ Call Answered Timestamp in tenant timezone in the format of YYYY/MM/DD HH:mm:ss Z.
$callHangupTenantTT$ Call Hangup Timestamp in tenant timezone in the format of YYYY/MM/DD HH:mm:ss Z.
$callDuration$ Call Duration in the format of HH:MM:SS
$equal$ The token will be replaced actual '='.
$interaction_guid$ Interaction GUID of the interaction associated with the outbound call.
$year$ The current year in the format of YYYY.
$month$ The current month in the format of MM.
$date$ The current date in the format of DD.
$hours$ The current hour in the format of HH.
$minutes$ The current minute in the format of MM.
$seconds$ The current second in the format of SS.
$transaction_codes$ Selected transaction codes. The format is <transaction list name>:<transaction shortcode> separated by commas if more than one is selected. The corresponding text can be found by using the mapping downloaded from Virtual Contact Center stat API.
$notes$ The small notes along with Transaction Code selected entered by agent.
$lastTclListName$ The transaction code list name of the last selected transaction code.
$lastTclCodeDesc$ The transaction code description of the last selected transaction code.
$lastTclCodeShort$ The short code of the last selected transaction code.

Create Action

Create action triggers creation of new record in CRM with integration type specified. The current version of Contact Center application only support create record on SFDC.

Launch Option

Launch option 'ctl_launchopt' is for launching Screen pop URL with the following name/values screenpop data post. Launch Option is allowing value either 'true' or 'false'. It is only taking effect if Screenpop is enabled on the Configuration Manager. This option is independent of the ctl_action specified.
Data Name Description
CtlUserData The original ctl_userdata with all tokens filled with actual data.
AgentID Agent login ID
Username Agent External Username entered to AGUI
extLogin Agent External Username entered to AGUI
Password Agent External password entered to AGUI
extPwd Agent External password entered to AGUI
Account Account ID configured in Screenpop section of the Configuration Manager
Role Screen pop target type configured in Configuration Manager.
Command Screen pop command. For this case, 'launch' is the value.
cmd Screen pop command. For this case, 'launch' is the value.

Callback URL

Callback URL 'ctl_callbackUrl' triggers callback action when click-to-dial transaction completes. The callback action is independent with other action specified in the user data. The following table shows the data that will be post to the callback URL specified. 
It is only taking effect if Screen pop and Auto Logs for Phone Media is enabled in Configuration Manager, Integration, Screen Pop.
Data Name Description
ctl_userdata The original ctl_userdata passing in to the Contact Center Application with the click-to-dial URL with all the tokens replaced by actual data. Ctl_newRecordId will be appended to the ctl_userdata if the ctl_action is used and new record is created successfully.
resultCode The result of the ctl_action. The possible values are: 'SUCCESS', 'FAIL' or 'IGNORE'.
errorString The error message for the failure action.

Examples

Example 1

The following URL shows the custom link that can be used to trigger creation of 'Task' record on SFDC for the 'account' record that the click-to-dial running on.
https://vcc-na4.8x8.com/AGUI/make_call.php?prefix=&phone={!Account.Phone}&callerId=5251990&ctl_userdata= [ctl_action|create][subject|outbound%20call%20log%20($transaction_id$)][Transactionid__c|$interaction_guid$]
 [ObjectType|Task][WhatId|{!Account.Id}][status|completed][Description|My%20Own%20Description%0Acall%20
 answered%20at$equal$%20$call_answered_time$%0Acall%20hangup%20at:%20$call_hangup_time$%0ATransaction%20
 Codes%20$equal$%20$transaction_codes$][ctl_parentid|{!Account.Id}][ctl_launchopt|true][ctl_launchext|edit][ctl_intType|sfdc][ActivityDate|$year$-$month$-$date$]
The result of the URL will make an outbound call to the phone number specified in the phone field of the corresponding 'Account' record. After the outbound call is completed, all the tokens will be replaced by actual data. Then, a task record with subject, description, status, transactionid__c, whatid and activitydate is created. After creation operation is done, screenpop window will be launched with the newly created task record in edit mode. Agent can modify and save the record or simply cancel the change to go back to the parent record.
account-link
vcc-image007-500x353.jpg
dialing
talking
end-pop
save-ah

Example 2

The following URL shows the click-to-dial link that can be used to trigger screenpop to post click-to-dial configured data to screenpop URL.
https://vcc-na4.8x8.com/AGUI/make_call.php? prefix=1&phone=6502022222&ctl_userdata=[foreign_key|12345678]
  [Transactionid|$interaction_guid$][start_time|$call_answered_time][end_time|$call_hangup_time$]
  [transaction_codes|$transaction_codes$][ctl_launchopt|true][customer_id|123456567]
vcc-image019-500x347.jpg
vcc-image020-500x347.jpg
vcc-image022-500x347.jpg

Example 3

The following URL shows the click-to-dial link that can be used to perform outbound call and trigger callback to the URL specified.
https://vcc-na4.8x8.com/AGUI/make_call.php? prefix=&phone=5355566234&ctl_userdata=[foreign_key|12345678]
  [Transactionid|$interaction_guid$][start_time|$call_answered_time][end_time|$call_hangup_time$]
  [transaction_codes|$transaction_codes$][ctl_callbackUrl|http://www.mycompany.com/clicktodial/callback?
  transaction=$transaction_id$]

Overview

Web callback is a function that allows tenants to embed a button on their websites that would allow visitors to request a call back from the application. There are numerous advantages of this feature: customer does not need to wait in the queue – this would lead to better customer satisfaction and lower telephony costs (to the contact center). The 8x8 Contact Center web callback API is a HTTP API.
The web call back feature supports the following callback options:
  1. Call me now – application would call the customer and launch the appropriate IVR script.
  2. Call me after a certain delay (the delay is configurable). After the delay the behavior is same as call me now.
  3. Call me when agent is available.
This document describes the supported parameters for using the web callback API. Example use cases are provided for references.
All API requests are authenticated using a token that is issued to a valid Contact Center tenant.
For security reasons, the web callback API only accepts request using HTTPS, so that request headers and response data are encrypted.
Important: All callback requests submitted will be lost when the platform is re-started. Prior to a platform upgrade, make sure the pending callback requests are handled on your application side.

Testing Using a Browser

The web callback API makes it easy to submit a query, for experimentation, testing or debugging purposes. From a web browser, simply enter the URL. For example,
https://vcc-na4.8x8.com/SC/webcallback.php?tenant=Acme&token=fb65d0515b9631c6db72e7e66fe6df49&phone=
16505551212&callback_type=1&channel_number=18006661212
will initiate a call to the number 16505551212 and load the IVR script associated with the channel 18006661212.
Revise your query URL based on the login URL of your Tenant. (Refer to the 8x8 Contact Center Platform URL Guide to retrieve your login URL)

Authentication

In order to make an API request, you must first obtain an authentication token that has been issued for your tenant. This token combines username and password into a single long string. To get your token, log into the Configuration Manager, select "Integration", and click the "API Token" tab. The "Action Request Token" needs to be used in all API requests. Next, click New Token. This generates a new private token for your tenant. You will use this token in all requests to the web callback API. You may generate a new token at any time.
WebCallbackAPI-Authentication-600x278.png

Queue Id

For web callback type – "call me when agent is available" a queue id needs to be provided. The interaction would be placed in this queue until an appropriate agent becomes available. The queue id can be retrieved by going to the queues tab in the configuration manager. Only outbound phone queues can be used in the web callback request.
WebCallbackAPI-QueueID-600x296.png

Query Parameters

The whole query parameter must be URL Encoded.

GET/POST Parameters

The following parameters are allowed parameters that can be passing along with the web callback URL using GET or POST method.
Parameter Name Description Accepted value Mandatory
tenant Tenant name  
Yes
token Authentication token  
Yes
phone The phone number of the customer requesting a callback. Digit only.In order to correctly route calls, it is recommended that the phone number is formatted in E.164 format.
Yes
callback_type
  • A value of 1 indicates a request to be called back right now (with an optional delay).
  • A value of 2 indicates that customer wants to be called back when agent is available.
1 or 2
Yes
channel_number This is the channel whose IVR script would be loaded and executed once the customer answers the call.  This is a required attribute if callback_type is set to 1. A valid channel number for the tenant.
Yes if callback_type is set to 1.
queue_id This attribute is used to identify the id of the queue that this interaction should be placed in. This is a required field for "call me when an agent is available option" (callback_type of 2). A valid queue id for the tenant.
Yes if callback_type is set to 2.
callback_delay If callback_type is set to 1 an optional delay could be provided. If a value greater than 0 is provided, the application would wait for the specified number of seconds before attempting to call the customer. Any value greater than 0.
No
expiration If callback_type is set to 2 an optional expiration could be provided. If a value greater than 0 is provided, the application would delete the request if an agent does not become available within the specified time. Any value greater than 0.
No
extTransactionData This attribute can be used to pass name value pairs that will be used for populating the transaction panel when an agent is offered the interaction. Each name value pair is enclosed by [ ] and the name/value are separated by "|". There is a limit of 500 characters.
No
caller_id This attribute is used to specify the caller id to be used on the outbound call. This is an optional field. The value provided must be one of the channels configured for the tenant. If no value is provided or if the value provided does not match one of the channels configured for the agent, the default caller id provisioned for the tenant would be used.  Anonymous (Anonymous caller id)-1 (use agent default caller id)Any valid channel number
 
Tenant default caller id.
No
back This attribute would be used to launch a page after the request has been processed.  
No
ctl_userdata This attribute can be used to pass name value pairs that will be used for triggering build-in callback function. Please refer to section 'ctl_userdata' below. No
dialplan_id Dial Plan Id that should be applied to the Phone Number Digit only. A valid dial plan id. Id can be found from the Dial Plan listing table on Configuration Manager. If not specified, tenant default dial plan is used. No
previewTimeout Preview Timeout This overrides the offer timeout configured for the agent. Accepted value is between 15 to 10800 seconds. This parameter only used along with callback_type equals to 2 (call me when agent is available). No
extTransactionId External Transaction Id This attribute allows tenant to mark a web callback with any identifier.

This attribute can be used to delete the webcallback interaction after its creation using the web callback interaction delete API.
No

ctl_userdata

The ctl_userdata allows tenant to pass in any user data or system data to trigger callback function. The value of ctl_userdata is any combination of name/value data in the format shown below.
ctl_userdata=[name1|value1][name2|value2][name3|value3]…
The category of name/value data is mainly divided into two groups: system data and user data.

System Data

System data are data that recognized by Virtual Contact Center system. All the name of the data that starts with 'ctl_' are treated as system data. The following table shows the list of supported system data with description.
Data Name Description Supported value Default Value Remarks
ctl_callbackUrl The URL to do the callback. All the user data with system generated result and data will be passing to the URL using POST method. Any valid URL. No system default value. If not specified, no callback will be done.

User Data

The user data are the data that will be sent along with the callback. The name of the user data should never start with 'ctl_' or it will be treated as system data. Refer to Examples below to find out what user data would look like. User data is mostly for recording information of the related activity (in this case, web callback). Therefore, Virtual Contact Center provides a list tokens that can be used in user data. Tokens will be replaced by the actual data before it's used in the action or posting to the launch URL.  The following is the list of supported tokens with description.
Token name Description
$caller_id$ The caller ID used to do the outbound call.
$transaction_id$ Transaction ID associated with the outbound call.
$call_answered_time$ UTC Call answered time in seconds. If call is not established, a number of 0 is used.
$call_hangup_time$ UTC Call hang up time in seconds. If call is not established, a number of 0 is used.
$callAnsweredTenantTT$ Call Answered Timestamp in tenant timezone in the format of YYYY/MM/DD HH:mm:ss Z.
$callHangupTenantTT$ Call Hangup Timestamp in tenant timezone in the format of YYYY/MM/DD HH:mm:ss Z.
$callDuration$ Call Duration in the format of HH:MM:SS
$equal$ The token will be replaced actual '='.
$interaction_guid$ Interaction GUID of the interaction associated with the outbound call.
$year$ The current year in the format of YYYY.
$month$ The current month in the format of MM.
$date$ The current date in the format of DD.
$hours$ The current hour in the format of HH.
$minutes$ The current minute in the format of MM.
$seconds$ The current second in the format of SS.
$transaction_codes$ Selected transaction codes. The format is <transaction list name >:<transaction shortcode> separated by commas if more than one is selected. The corresponding text can be found by using the mapping downloaded from Virtual Contact Center stat API.
$notes$ The small notes along with Transaction Code selected entered by agent.
$lastTclListName$ The transaction code list name of the last selected transaction code.
$lastTclCodeDesc$ The transaction code description of the last selected transaction code.
$lastTclCodeShort$ The short code of the last selected transaction code.

Error Codes

In case of error a parameter named "ctl_error" will be returned as part of the query string sent along with the back URL.
The various error codes are:
Error Code Description
1 Tenant not enabled.
2 Web callback not enabled.
3 Invalid authentication token.
7 Queue id provided is invalid.
8 Queue is disabled.
9 Queue direction is not 'Outbound'
10 Missing Callback type.
11 Callback delay is not numeric
12 Missing channel information for callback type 1.
13 Invalid channel number provided.
14 Unknown callback type specified.
15 Service unavailable.
16 External data maximum length exceeded(500 character limit)
17 Phone number not provided.
19 Internal Error.
20 ctl_userdata exceeded max length (1800 character limit)
21 Invalid preview timeout value.
22 External transaction ID maximum length exceeded (64 character limit)

Examples

Example 1:

If the customer would like to be called back right away, the web callback request would look like the following:
https://vcc-na4.8x8.com/SC/webcallback.php?tenant=Acme&token=fb65d0515b9631c6db72e7e66fe6df49&phone=
16505551212&callback_type=1&channel_number=18006661212&back=http://www.acmejet.com/ctdresult.php&
caller_id=18006664444
The application would initiate a call to 16505551212, the customer would see the caller id as 18006664444 and after the request is processed, the following URL http://www.acmejet.com/ctdresult.php would be launched. Once the customer answers the phone, the IVR script associated with the channel 18006661212 would be executed.
vcc-webcallback-image005.jpg

Example 2:

If the customer would like to be called back after a fixed amount of delay (5 minutes in this example), the web callback request would look like the following:
https://vcc-na4.8x8.com/SC/webcallback.php?tenant=Acme&token=fb65d0515b9631c6db72e7e66fe6df49&phone=
16505551212&callback_type=1&channel_number=18006661212&back=http://www.acmejet.com/ctdresult.php&
caller_id=18006664444&callback_delay=300&ctl_userdata=[ctl_callbackUrl|https://mywebporter.com/
callback.php][Transactionid__c|$interaction_guid$][CallAnswerTime|$call_answered_time$]
[foreign_key|1234456677]
The application would initiate a call to 16505551212 after a delay of 5 minutes, the customer would see the caller id as 18006664444 and after the request is processed, the following URL http://www.acmejet.com/ctdresult.php would be launched. This example also shows how to trigger callback by using ctl_userdata. The callback function passes all the data in the value of ctl_userdata back to the callback URL.
vcc-webcallback-image009.jpg

Example 3:

If the customer would like to be called back when an agent is available, the request would look like the following:
https://vcc-na4.8x8.com/SC/webcallback.php?tenant=Acme&token=fb65d0515b9631c6db72e7e66fe6df49&phone=
16505551212&callback_type=2&back=http://www.acmejet.com/ctdresult.php&caller_id=18006664444&queue_id=103
An interaction would be created and placed in the queue (id 103 in this example). When an agent becomes available, the application would offer the interaction to the agent. If the agent accepts the interaction, the application would initiate a call to the agent and then bridge the call to the customer.
vcc-webcallback-image015.jpg

Example 4:

If the customer would like to be called back when an agent is available with the following exception – if agent is not available within the next hour, he would like the request to be terminated.
The request would look like the following:
https://vcc-na4.8x8.com/SC/webcallback.php?tenant=Acme&token=fb65d0515b9631c6db72e7e66fe6df49&phone=
16505551212&callback_type=2&back=http://www.acmejet.com/ctdresult.php&caller_id=18006664444&
queue_id=103&expiration=3600
An interaction would be created and placed in the queue (id 103 in this example). When an agent becomes available, the application would offer the interaction to the agent. If the agent accepts the interaction, the application would initiate a call to the agent and then bridge the call to the customer. If an agent is not available within an hour, the interaction would be deleted (treated as an abandoned transaction in the reports).

Delete Web Callback

If agents place phone calls and interact with customers whose web callback requests are still pending in the queue, agents may prefer to cancel the pending requests from the Web Callback API. Interactions created by the web callback API can be easily removed by requesting the delete web callback API. This request removes all web callback interactions which were created using extTransactionId parameter. If customers requesting a call back via web to interact with the agents before the call is processed by the agents, the agents can now mark this call complete and delete the pending request.
The delete web callback API allows web callbacks to be deleted only if the interactions are not assigned to any agent yet.
The delete API uses basic authentication method to authenticate API access. The authentication user name will be your tenant name, and the password will be the API action request token you obtain from Configuration Manager.
DELETE https://vcc-naX.8x8.com/api/interactions/webcallback/externaltransaction/{ext-transaction-id}
The HTTP request method is DELETE and {ext-transaction-id} should be the external transaction id assigned to the web callbacks aimed to be deleted. The request returns an xml as default response type and it also supports JSON by using .json at the end of the path

Deleting a web callback

To delete a web callback, first, the web callback must have been created using the extTransactionId parameter. In the following example the web callback was created with extTransactionId=transac_0 and the delete request sends the same value in the path, {ext-transaction-id}:
DELETE https://vcc-naX.8x8.com/api/interactions/webcallback/externaltransaction/transac_0.json
Response:
HTTP 200 OK

  { 
  "data":{ 
  "extTransactionId":"transac_0",
  "interactions":{ 
  "deleteStatus":"ok",
  "interactionGuid":"int-154820172-byfXC2WPsSnYzX-...",
  "phone":12345678918,
  "transactionID":42
  }
  }
}
If the interaction is already created and assigned to an agent, the response data attribute "deleteStatus" inside the interactions is shown as "nok" and the HTTP response code is 207 Multi-Status. The "reason" attributes indicates the cause of the failure and the only value currently available is "statuserror", which means that the interaction was not allowed to be deleted due its status.
Response:
HTTP 207 Multi-Status

  { 
  "data":{ 
  "extTransactionId":"transac_0",
  "interactions":{ 
  "deleteStatus":"nok",
  "interactionGuid":"int-154820172-byfXC2WPsSnYzX-...",
  "phone":12345678918,
  "transactionID":42,
  "reason":"statuserror"
  }
  }
  }
 
In case there is more than one web callback created with same external transaction id, the request is going to delete all the interactions. In the response, the "interactions" attribute is set as an array containing all the results of each individual interaction. See the following response example:
Response:
HTTP 207 Multi-Status

  { 
  "data":{ 
  "extTransactionId":"transac_0",
  "interactions":[ 
  { 
  "deleteStatus":"ok",
  "interactionGuid":"int-154820172-byfXC2WPsSnYzX-...",
  "phone":12345678918,
  "transactionID":42
  },
  { 
  "deleteStatus":"nok",
  "interactionGuid":"int-154820152-dsfXC2BQeSnZcA-...",
  "phone":12345678919,
  "transactionID":43,
  "reason":"statuserror"
  }
  ]
  }
}
Note: If in this request, all interactions were successfully deleted ("deleteStatus":"ok"), the response code will be 200 OK instead of 207 Multi-Status.

Error responses

The external transaction id passed {ext-transaction-id} may not exist by the time the delete request is executed, in cases like this, the API returns the following response and the HTTP response code is 404 Not Found::
Response:
HTTP 404 Not Found
 { 
  "error":{ 
  "message":"transaction not found"
  }
  }
If any other application error occurs during the request, the result API returns 500 Internal Server Error like the example below:
Response:
HTTP 500 Internal Server Error
 { 
  "error":{ 
  "message":"internal error"
  }
  }
  

Response Codes

Response Code Description
200 OK : All web callback interactions associated to the {ext-transaction-id} were successfully deleted.
207 Multi-Status : Some of the requested web callback interactions associated to the {ext-transaction-id} were not deleted.
404 Not Found : No web callback interactions associated to the {ext-transaction-id} were found.
401 Unauthorized : Invalid or missing username and authentication token.
500 Internal Server Error : Some internal error has occurred.

Overview

Interaction data augmentation is a mechanism to enrich the data associated with a particular interaction. The source of data could be from collecting information from users - through web forms/IVR etc, from data dips (eg Salesforce , Netsuite, DB …), speech analytics (sentiment of the caller), etc. The data associated with the interaction can serve multiple purposes:
  • Used for routing decisions in the script
  • For displaying to the agent when offering the interaction.
  • For routing the interaction to the best-matched agent.
  • For analytics, auto logs, etc.
The 8x8 Interaction Data Augmentation API is an HTTP API that allows tenants to set and retrieve variables(meta data) associated with an interaction. This document describes the supported parameters for calling the Interaction Data Augmentation API. Example use cases are provided for reference.
For security reasons, the Interaction Data Augmentation API only accepts requests using HTTPS, so that request headers and response data are encrypted.

Base URL

All URLs referenced in the documentation have the following base:
https://vcc-sb1.8x8.com/api/v1/interaction/data/
Revise your query URL based on the login URL of your Tenant. Refer to the 8x8 Contact Center Platform URL Guide to retrieve your login URL.

Authentication

The API is authenticated with HTTP Basic Authentication, which needs tenantId as the username and action token of the tenant as the password.

Examples

Example 1: The following example shows how to set variables for an interaction. The interaction is identified by the SIP call Id of the eIVR leg:
{
    "variables": [{
        "name": "_queueId",
        "value": "201",
        "ivr": "true"
    }, {
           "name": "_SSN",
            "value": "111-22-3333",
            "ivr": "true",
            "privacy": "true"
    }, {
            "name": "_amount",
            "value": "110.55",
            "display": "true",
            "displayName": "Amount Due"
    }, {
            "name": "_dueDate",
            "value": "04 July 2019",
            "ivr": "true",
            "display": "true",
            "displayName": "Due Date",
            "dataType": "date"
    }]
}
Example 2: The following example shows how to set variables for an interaction. The interaction is identified by the interaction guid of the call:
{
    "variables": [{
        "name": "_queueId",
        "value": "201",
        "ivr": "true"
    }, {
        "name": "_SSN",
        "value": "111-22-3333",
        "ivr": "true",
        "privacy": "true"
    }, {
        "name": "_amount",
        "value": "110.55",
        "display": "true",
        "displayName": "Amount Due"
    }, {
        "name": "_dueDate",
        "value": "04 July 2019",
        "ivr": "true",
        "display": "true",
        "displayName": "Due Date",
        "dataType": "date"
    }]
}
Example 3: The following example shows how to get all the context associated with an interaction. The interaction context will be returned as a json object (the format is described below). The interaction is identified by the interaction guid of the call:
curl -H "Content-Type: application/json" -X GET -u acme:00a5c5dd78ba119df8e361288b709e4c2d19ef440c0f2af96d48ead1faa78c9b 'https://vcc-sb1.8x8.com/api/v1/interaction/data/guid/int-1628bb9dbf7-YUTGAUsGrJDvPC9DqMgJr01iy-phone-01-acme'
 NOTE: Using curl on Windows you will need to replace the single quotes (') in the example above to standard quotation marks (").

Query Parameters

The following parameters are allowed as POST/GET parameters to be passed along with the Interaction Data Augmentation URL. All the parameter data should be URL encoded.
Parameter Name Description Required Accepted Value
callId st N Interactions are identified by either the SIP call id or the interaction guid
guid Interaction guid N  

Input JSON description

The API allows the client application to set any number of variables bypassing the data in JSON format. There is no limit on how many number of name/value data can be used to compose the json string. The API supports setting certain metadata about a variable, that allows the caller to control how the variable is used within the application. A description of the meta data is provided in the table below. The following json is used as an example for describing the json format:
{
    "variables": [{
            "name": "_queueId",
            "value": "201",
            "ivr": "true"
        },
        {
            "name": "_SSN",
            "value": "111-22-3333",
            "ivr": "true",
            "privacy": "true"
        },
        {
            "name": "_amount",
            "value": "110.55",
            "display": "true",
            "displayName": "Amount Due"
        },
        {
            "name": "_dueDate",
            "value": "04 July 2019",
            "ivr": "true",
            "display": "true",
            "displayName": "Due Date",
            "dataType": "date"
        }
    ]
}
Attribute Name Possible Values Description
name string Names must begin with _, alphanumeric, less than 25 characters and contain no space.
ivr true/false If set to true, this variable can be used for routing in the IVR. The name of the variable should match the name set in the IVR script - else the variable is ignored.
display true/false This value determines if the variable should be included in the list of name-value pairs displayed to the agent when offering an interaction.
displayName Any string less than 30 characters This string is used as the name of the variable when displaying to the agent.
dataType text/number/phone number/date/time/currency Used as a hint to the TTS engine.
privacy true/value If set to true, the application will use the value only for routing purposes. Data is obfuscated /masked before displaying/storing in DB.

Output json description

The API allows a client application to retrieve all context data associated with an interaction. The description of the content of the json object is described in the table below.
Variable Name Always available Description
InteractionId Y Interaction id of the interaction
Channel N The number dialed by the caller(for inbound calls)
CreateTime Y Time interaction was created
ANI N The caller id of the caller
CallerName N The name of the caller
QueueId N The queue id of the interaction (if the call was queued).
QueueTime N The time the call was queued
Priority N Priority of the interaction
AgentId N Id of the agent associated with the interaction - either through setAgent or by dialing extension number.
UserInput N array of name/value pairs of data collected from the caller in the IVR.

Response Codes

Code Number
Code Label
Description
200 (Status: success)
OK
The request was successful. 
400
Bad request
The action type is not supported.
401
Unauthorized
The request was not allowed, usually due to incorrect authentication.
404
Not found
The interaction was not found in the target Tenant.
500
Server Error
Internal server error preventing the request to be completed.

Overview

The 8x8 Streaming API (SAPI) features a set of functionalities to allow 8x8 Contact Center tenants to receive information related to Agent status updates, Agent provisioning updates, and Interaction updates. These updates are referred to as events. Any Async HTTP client can be used to receive SAPI events.
The primary purpose of this SAPI is to provide data on real time events. Data is published to all clients through a server push mechanism. To learn more about this mechanism, see this article on Server push.

Subscribing to Events

The best way to understand and test the features of the 8x8 SAPI is to use a web client. The web client is easy to use. In a browser on the same network as your tenant, enter the link provided below.
https://vcc-{cluster}.8x8.com/api/streaming/v1/clientconnect/subscribe/TenantUpdates-{tenantName}-{subscriptionId}?desiredOutputType=NEWLINE_JSON&tenantId={tenantName}&subsId={subscriptionId}&X-Atmosphere-Transport=streaming
Note: Remember to replace the cluster with your platform URL. This link will open a page with some input fields.

Purpose of the Fields

  1. Subscription ID  is the unique ID for identifying the SAPI connection from the tenant. Each tenant should manage its own subscription ID. Since the SAPI stores messages for a certain period of time even if the client is disconnected, using same subscription ID is important in order to receive stored messages.
  2. Tenant ID is the tenant ID provided by 8x8.
  3. Desired Output type. This can be either XML or JSON.
  4. Subscribe will initiate a subscription to events over the next 60 minutes.
  5. Unsubscribe will disconnect the client from the SAPI server and start storing messages for reconnection.

Agent Status Updates

This configuration returns information from agents about real time agent status changes.
<?xml version='1.0'  encoding='UTF-8' ?>
<AgentStatusChange>
    <agentId>marcus</agentId>
    <newState>2</newState>
    <statusEventTS>1381563857</statusEventTS>
</AgentStatusChange>

Agent Provisioning Updates

This configuration returns information from agents about real time provisioning changes.
<?xml version='1.0'  encoding='UTF-8' ?>
<AgentProvChange>
    <agentId>122</agentId>
    <numberofChangesThisTime>1</numberofChangesThisTime>
    <provisioningItems>
      <provisioningItem>
        <provisioningItemKey>phoneUri</provisioningItemKey>
        <provisioningItemNewValue>+17034443909</provisioningItemOldValue>
        <provisioningItemOldValue>17034443910</provisioningItemOldValue>
     </provisioningItem>
    </provisioningItems>
      ... 
    </provisioningItem>
</AgentProvChange>

Interaction Updates

This configuration returns information from agents about real time interactions.
<?xml version='1.0'  encoding='UTF-8' ?>
<Interaction>
    <direction>in</direction>
    <eventTS>1381573170</eventTS>
    <inboundChannelid>4070001</inboundChannelid>
    <interactionGUID>int-dev6ctl-09c05006-0f19-44cf-9410-c55fe515d76c-phone-00iQ1DcskDJEumYROhxeq3gvYeY
</interactionGUID>
    <mediaType>phone</mediaType>
    <outboundCampaignid>0</outboundCampaignid>
    <queueId>dev6ctl~~queue~~phone~~102</queueId>
    <queueTime>1381573170</queueTime>
    <transactionNum>1</transactionNum>
    <attachedData>
      <attachedDatum>
        <attachedDataKey>tenantSkillName</attachedDataKey>
        <attachedDataValue>Sales</attachedDataValue>
     </attachedDatum>
    </attachedDatum>
      ... 
    </attachedDatum>
</Interaction>

Authentication

In order to make a SAPI request, you must first obtain the authentication token that has been issued for your tenant. This token combines username and password into a single string. You will use this token in all requests to the SAPI. You may generate a new token at any time.

To generate the Authentication Token

  1. Log into the SAPI Configuration Manager.
  2. Select Integration.
  3. Click API Token.
  4. Click New Token next to Data Request Token. This generates a new private token for your tenant. The image below shows the authentication window.

Important Notes

Some things to keep in mind when using the 8x8 SAPI:
  1. Only three clients per tenant are allowed to listen at a given time.
  2. The subscription ID should be unique for every connection.
  3. A subscription session is valid for only sixty minutes. That is, if the connection times out, you will need to reconnect. However, no data is lost if reconnection occurs within two hours, since messages are stored and sent when the connection is restored.
  4. A two-hour history of events is provided, if the client connects with the previously used subscription ID.
  5. Desired output can be either XML or JSON.
  6. If a subscription has been disconnected for more than two hours, it will be automatically unsubscribed. No more messages will be stored after unsubscribing.
To download the 8x8 SAPI client, click here.

Overview

The 8x8 Case and Contact Management API are composed of a set of URIs to allow the tenants to download the information related to CRM objects. The tenant can attach files into various CRM objects like Cases, Followups, and Faqs at agent UI. The tenant has a choice of adding multiple files at the agent user interface. This style of API makes it very easy to compose and send a query. which is always done using an HTTP GET request.
The Case and Contact Management Reporting database contains data, related to various CRM objects like Cases, Followups, and Faqs
All API requests are authenticated using a token that is issued to a valid 8x8 tenant. Responses are sent in either file or ZIP format. If more than one file is attached to the CRM object. API will reply to all the files in a single ZIP file.
For security reasons, the Case and Contact Management API only accepts requests using HTTPS, so that request headers and response data are encrypted.
For compatibility reasons, the Case and Contact Management API encodes all special chars of an attachment file name.

Testing Using A Browser

The Case and Contact Management API makes it easy to submit a query, for experimentation, testing, or debugging purposes. From a web browser, simply enter the URL. You will be prompted to enter a username and password. Enter your Tenant name as the username, and your Data Request Token as the password. Then, the query result will be displayed in your browser. For example,
https://vcc-instance.8x8.com/api/ccm/attachments/case/{case-id}
will return attached file(s) from Case type CRM object with id matching {case-id}, provided in request.

Some other examples for downloading attachments

https://vcc-instance.8x8.com/api/ccm/attachments/followup/{followup-id}
will return attached file(s) from Followup type CRM object with id matching {followup-id}, provided in the request. The format of followup id is the one shown on AGUI. Format of the id is case-id and followup-id separated by a dot (.): {case-id}.{followup-id} e.g. 38.1
https://vcc-instance.8x8.com/api/ccm/attachments/faq/{faq-id}
will return attached file(s) from Faq type CRM object with id matching {faq-id}, provided in request.

Testing Using curl

In a Linux environment, the curl utility will submit an HTTP request, and allow you to view the result.
curl -u acme:ac12343934687a839cf https://vcc-instance.8x8.com/api/ccm/attachments/case/1  -o {filename}
will return the attached file(s) from case 1. The -u argument identifies the username and password; use your Tenant name as the username, and your Data Request Token as the password.
The -o argument will take the file name as input from the user. This will be the name of the file where content will be saved. A point to remember is that in case of more than one file in response, the response content will be of ZIP type.

Response Codes 

Code Number
Code Label
Description
200 (Status: success)
OK
The request was successful. 
400
Bad request
The syntax of the request was wrong.
401
Unauthorized
The request was not allowed, usually due to incorrect authentication.
404
Not found
The requested resource was not found.
500
Server Error
The server encountered an unexpected condition that prevented it from fulfilling the request.
503
Server Busy
The server is currently unable to handle the request due to temporary overloading. This is to prevent denial of service. Another reason for this error is to allow only a single request per customer at a time. The same error is also given if more than 10 customers hitting the CCM API at the same time.