Skip to main content
Version: 6.4

Overview

Scope

The Integration API allows customers to extend the default functionality of b+s Connects.

b+s Connects dispatches events on CTI related changes, so that integrators can run custom code to cover customer specific requirements. The events and requests described on this page are available for different environments. Please note the following list for availability.

Supported environments:

  • Initiate requests from within a Microsoft Dynamics page to b+s Connects (no consumption of events) (referred to as Custom Requests)
  • Place custom code within b+s Connects (referred to as Custom Integration)

Prerequisites

Regardless of the environment for which you want to do an integration, you must have experience working with Microsoft Dynamics 365 (configuring, customizing and developing), as well as knowing how to write code and working with JSON.

How to pick the right integration type

There are 2 ways to integrate with b+s Connects. This chapter tries to help you pick the right type of integration by describing main usages. Each integration type differs in terms of available events and requests (note availability list for each event/request).

  • Simple instruction(s) from within the CRM to b+s Connects. No events required to react upon: Custom Requests

  • Custom user interface hosted within b+s Connects. React to events and issue requests: Custom Integration

Events

agentStateChange

Available for: Custom Integration

This event is raised when the state of an agent for a specific channel changes.

FieldDescription
eventEvent name "agentStateChange"
versionAPI version
requestIdIdentifier to match this event to a request
channelTypeChannel type (Voice, Mail, Chat, Task, Federation)
channelIdChannel identifier (voice_<peripheral_id>)
For CCX: voice_-1
For WxCC: telephony
newStateNew state (Logout, Offline, Ready, NotReady, Active, Wrapup, Unknown)
newReasonCodeNew reason code. Negative values indicate no code available.
newReasonCodeLabelNew reason name
newStateChangeTimeNew state change time
oldStatePrevious state: (Logout, Offline, Ready, NotReady, Active, Wrapup, Unknown)
oldReasonCodePreviously selected reason code. Negative values indicate no code available.
oldReasonCodeLabelPreviously selected reason name
oldStateChangeTimePrevious change state time

Sample code for custom integrations

cil.onAgentStateChange((data) => {
console.warn(`message: onAgentStateChange, data: ${JSON.stringify(data)}`);
});

beforeDial

Available for: Custom Integration

This event is raised before a call is initiated.

Subscribing to this event blocks outgoing calls that are not initiated by a custom integration. If you want the number to be dialed, you need to start a call by using dialOrConsult.

Consultation and transfer calls are not affected and do not dispatch the event.

FieldDescription
eventEvent name "beforeDial"
versionAPI version
requestIdIdentifier to match this event to a request.
dialedNumberThe number to be dialed.
callTypeCall type (Outbound)

Sample code for custom integrations

cil.onBeforeDial((data) => {
console.warn(`message: onBeforeDial, data: ${JSON.stringify(data)}`);
});
info

Loading a custom integration as hidden is recommended if the beforeDial event is used, to avoid it being unloaded.

error

Available for: Custom Integration

This event is raised when an Integration API request fails or an error is encountered in b+s Connects.

FieldDescription
eventEvent name "error"
versionAPI version
requestIdIdentifier of the request that might have caused the error, empty if the source of the error cannot be detected.
messageShort message describing the encountered error

Sample code for custom integrations

cil.onError((error) => {
console.warn(`message: onError data: ${JSON.stringify(error)}`);
});

workitemConnect

Available for: Custom Integration

This event is raised when a work item is accepted.

Please see workitem reference for available data and format.

Sample code for custom integrations

cil.onWorkitemConnect((data) => {
console.warn(`message: onWorkitemConnect, data: ${JSON.stringify(data)}`);
});

workitemCreate

Available for: Custom Integration

This event is raised when a new work item (e.g. phone call) appears in b+s Connects and is alerting. WorkitemCreate is also dispatched, when the agent logs in while a call is on the phone (call recovery).

Please see workitem reference for available data and format.

Sample code for custom integrations

cil.onWorkitemCreate((data) => {
console.warn(`message: onWorkitemCreate, data: ${JSON.stringify(data)}`);
});

workitemEnd

Available for: Custom Integration

This event is raised when a work item disappears from b+s Connects. If Wrap-Up is enabled, this event is sent when Wrap-Up for the item ends. If Wrap-Up is not enabled, the event is sent immediately after hang-up/end.

Please see workitem reference for available data and format.

Sample code for custom integrations

cil.onWorkitemEnd((data) => {
console.warn(`message: onWorkitemEnd, data: ${JSON.stringify(data)}`);
});

workitemPause

Available for: Custom Integration

This event is raised when a work item is paused (e.g a call is put on hold).

Please see workitem reference for available data and format.

Sample code for custom integrations

cil.onWorkitemPause((data) => {
console.warn(`message: onWorkitemPause, data: ${JSON.stringify(data)}`);
});

workitemResume

Available for: Custom Integration

This event is raised when a paused work item is resumed.

Please see workitem reference for available data and format.

Sample code for custom integrations

cil.onWorkitemResume((data) => {
console.warn(`message: onWorkitemResume, data: ${JSON.stringify(data)}`);
});

workItemWrapup

Available for: Custom Integration

This event is raised when a work item changes the state to Wrap-Up.

Please see workitem reference for available data and format.

Sample code for custom integrations

cil.onWorkitemWrapup((data) => {
console.warn(`message: onWorkitemWrapup, data: ${JSON.stringify(data)}`);
});

Requests

createSession

Available for: Custom Requests Custom Integration

This request creates a new session based on the given session template name and parameters.

FieldDescription
requestRequest name "createSession"
templateNameName of the Session Template
templateParametersTemplate parameters object which should be passed to the CIF createSession call (optional)

Return Value

Returns a promise which has no value.

Sample code for custom integrations

await cil.createSession(templateName, templateParameter);

For more information on Session Templates please refer to Manage session templates in Dynamics 365.

dialOrConsult

Available for: Custom Integration

This request initiates a new call. A consultation call is created when the agent already has a call.

FieldDescription
channelIdvoice for the voice channel (without having to provide the peripheral ID),
voice_<peripheral_id> for a specific voice channel,
voice_-1 for CCX voice channel,
telephony for WxCC voice channel.
Make sure the channel is uniquely identified by this id.
addressDestination address
requestIdIdentifier to map an event/error to the request (optional)

Return Value

Returns a promise which has no value.
If successful, an "onWorkitemCreate" event will be raised.
If the request fails, an “error” event will be dispatched.

Sample code for custom integrations

await cil.dialOrConsult('voice', phonenumber, requestId);

getChannel

Available for: Custom Integration

This request returns information about the specified channel.

FieldDescription
channelIdvoice for the voice channel (without having to provide the peripheral ID),
voice_<peripheral_id> for a specific voice channel,
voice_-1 for CCX voice channel,
telephony for WxCC voice channel,
Make sure the channel is uniquely identified by this id.

Return Value

Returns a promise which resolves to a getChannel object.
Please see getChannel reference for available data and format.

Sample code for custom integrations

const result = await cil.getChannel('voice');

getCustomSettings

Available for: Custom Integration

This request returns the configured integration settings.

Return Value

Returns a promise which resolves to an array containing key/value pairs.

FieldDescription
Keysetting1-5
ValueConfigured value

Sample code for custom integrations

const result = await cil.getCustomSettings();

getReasonCodeList

Available for: Custom Integration

This action can be called to retrieve a list of reason codes for a specified reasonType.

FieldDescription
channelIdvoice for the voice channel (without having to provide the peripheral ID),
voice_<peripheral_id> for a specific voice channel,
voice_-1 for CCX voice channel,
telephony for WxCC voice channel.
Make sure the channel is uniquely identified by this id.
reasonTypeLogout, NotReady or Wrapup.

Return Value

Returns a promise which resolves to an array of reason code objects.
Please see getReasonCodeList reference for a single object's format.

Sample code for custom integrations

const result = await cil.getReasonCodeList('voice', 'Logout');

isPrimaryTab

Available for: Custom Integration

This request returns whether the integration is running in the primary (i.e. first opened) browser tab or not. As an example this request can be utilized to run custom code only once even though the integration is loaded in multiple browser tabs.

Return Value

Returns a promise which resolves to true if the integration runs in the primary (i.e. first opened) browser tab and false otherwise.

Sample code for custom integrations

const result = await cil.isPrimaryTab();

setAgentState

Available for: Custom Requests Custom Integration

This request sets the state of the agent on a specific channel.

FieldDescription
requestRequest name "setAgentState"
channelIdvoice for all voice channels (multiple matching channels possible),
voice_<peripheral_id> for a specific voice channel,
voice_-1 for CCX voice channel,
telephony for WxCC voice channel.
stateRequested state (Ready, NotReady, Logout)
reasonCodeNot ready or logout reason code (empty if no reason code is required)
requestIdIdentifier to map an event/error to the request (optional)

Return Value

Returns a promise which has no value.
If successful, an "agentStateChange" event will be raised.
If the request fails, an “error” event will be dispatched.

Sample code for custom integrations

await cil.setAgentState(channelId, newState, reasonCode, requestId);

showError

Available for: Custom Integration

This request can be used to show an error message in b+s Connects.

info

Alerts are displayed in the same order as they are received by b+s Connects. When b+s Connects is reloaded, all queued alerts are deleted and will not be displayed.

FieldDescription
descriptionThe description of the error message and a suggestion of how to deal with it.
titleThe title of the error message (optional).
confirmActionAn object containing a label and a callback for a button that confirms the suggested action (optional).
dismissActionAn object containing a label and a callback for a button that dismisses the suggested action (optional).
Note: It is possible to pass a dismissAction without a callback.

Return Value

Returns a promise which has no value.

Sample code for custom integrations

await cil.showError(
'Looks like an error has occurred. Do you want to reload?',
'Oh no...',
{label: 'Reload', callback: () => location.reload()},
{label: 'Cancel', callback: undefined }
)

showInfo

Available for: Custom Integration

This request can be used to show an info message on b+s Connects.

info

Note that info messages will disappear automatically after six seconds.

FieldDescription
descriptionThe content of the info message. Cannot be longer than 60 characters.

Return Value

Returns a promise which has no value.

Sample code for custom integrations

await cil.showInfo('Example info message');

writeLog

Available for: Custom Requests Custom Integration

This request writes a log message into the b+s Connects log.

info

You can find your log entries by searching for COR_API_WRITE_LOG in the log viewer.

FieldDescription
requestRequest name "writeLog"
logMessageA string containing the message to be written into the b+s Connects log.
logLevelA log level.
Debug for log messages that are for debugging purposes only.
Error for log messages that contain information about errors.

Return Value

Returns a promise which has no value.

Sample code for custom integrations

await cil.writeLog('Example debug message', 'Debug');

Data reference

Workitem

Work item events have a field called data, which contains a JSON structure with the following information available:

FieldDescription
eventName of the event
versionAPI version
requestIdIdentifier to match this event to a request (for future use)
activityObject containing the phone call record details. See Activity record reference.
agentIdAgent id (Cisco Common Identity user id)
aniWhen there is only one participant and the direction is outgoing, toAddress is picked otherwise fromAddress is chosen.
associatedParticipantThe assigned record of the participant lookup. See CRM record reference
associationsList of all records that are assigned to the workitem (currently this list only contains the phone call record). See CRM record reference
capabilitiesList of actions that can be carried out
channelIdChannel identifier (telephony).
channelTypeChannel type (Voice).
classificationWork item class (Customer, Consultation, Conference, Transfer, Internal, Unknown).
connectedAtDate and time in UTC when the call was established (e.g 2020-07-28T09:51:17.696Z)
ctiDataPlease see the ctiData reference for available data and format.
directionIncoming or Outgoing
idCall id or Task id for the current work item
participantsList of participants with their address
participantLookupResultList of the found participant lookup entries. See CRM record reference
stateCurrent State (Unknown, Initiated, Offered, Active, Paused, Wrapup, Ended, EndedAbandoned, EndedTransferred, EndedUnknown)

ctiData

PropertyDescription
<callVariable>For available call variables please contact your WxCC administrator.

Activity record

The activity field contains information about the created phonecall record.

info

It is possible that the activity is undefined for the workitemCreate event.

FieldTypeDescription
idStringUnique identifier of the phonecall record
recordTypeStringType of the activity record, which is phonecall

CRM record

info

It is possible that the field associatedParticipant is undefined.

CRM records consist of the following fields.

FieldTypeDescription
idStringUnique identifier of the CRM record
nameStringThe name / subject of the record
recordTypeStringCRM table name of the record (e.g. contact)

getChannel

PropertyDescription
activeDeviceIdCurrently not used for WxCC
channelPlease see the channel reference for available data and format.
extensionThe extension the agent is working with
firstNameFirst name of the agent
agentIdAgent identifier (Cisco Common Identity user id)
lastNameLast name of the agent
loginNameLogin name of the agent
teamIdThe identifier of the team the user belongs to

Channel

PropertyDescription
idUnique Identifier for the channel (telephony)
typeChannel type (Voice)
stateChannel/agent state (Logout, Offline, Ready, NotReady, Active, Wrapup, Unknown)
reasonCodeSelected reason code; negative values indicate no code available
reasonCodeLabelThe descriptive reason name
stateChangeTimePrevious change state time
workitemsList of workitems; please see workitem reference

getReasonCodeList

PropertyDescription
labelThe descriptive reason name
idUnique Identifier for the reason