WxCC Configuration and script to create Voice Call records
To get the full value of Salesforce Service Cloud Voice, the call flow in Webex Contact Center must be modified to create the Voice Call record in Service Cloud Voice as soon as the call arrives in the Contact Center.
An optional Omni-Flow can be executed, for routing decisions and automation in Salesforce.
For details about the used APIs, see Service Cloud Voice API Wrapper
Pre-requisites
In order to use the Service Cloud Voice API Wrapper, a Salesforce Connected App for IVR integration must be configured.
Configure the Salesforce Connector in Webex Control Hub
Set Up the Salesforce Integration Connectors for Webex Contact Center as described in the article at https://help.webex.com/en-us/article/7fuy63/Set-Up-Integration-Connectors-for-Webex-Contact-Center#id_133211
- Log in to your customer organization at https://admin.webex.com and navigate to Services > Contact Center > Connectors.
- On the Salesforce card, click Set Up or Add More.
- Client ID: Connected App Consumer Key
- Salesforce Email ID: Salesforce username of a user which has permission to access the REST API. Required Salesforce permissions:
- Access to the Salesforce Connected App created before
- Permission: API Enabled
- Permission Set: b+s CNX SCV Agent
- URL: https://login.salesforce.com or https://test.salesforce.com
- Private Key: content of file
server.key
Webex Contact Center Main Flow
Local Variables
Local variable for Voice Call record ID
The record ID of the created Voice Call record and the Vendor Call Key are used in the agent connector to open the Voice Call when the call is answered by the agent. The variable name must be configured in the Contact Center definition in Salesforce.
The variable must contain the Voice Call record Id and Vendor Call Key, separated by a semicolon (;).
Format: <Voice Call record id>;<Vendor Call Key>
Example: 0LQ06000002KMNS;fc4ec7d8-4c91-49aa-b764-081fbba344a8
- Name:
L_Call_ID
- Type: String
- Make Agent Viewable: Enabled
Local variable for the call start Time
Used to create the Voice Call record and when updating the voice call
- Name:
L_Call_Start_Time
- Type: String
- Make Agent Viewable: no
Local variable for Queue name/id:
Returned by Execute Omni Flow, used for call routing.
This variable is only required when using Execute Omni Flow
- Name:
L_OmniFlow_Queue
- Type: String
- Make Agent Viewable: no
Local variable for Agent name/id:
Returned by Execute Omni Flow, used for call routing.
This variable is only required when using Execute Omni Flow
- Name:
L_OmniFlow_Agent
- Type: String
- Make Agent Viewable: no
Main Flow overview
- Set Call Start Time
- HTTP Request: Create Voice Call record
- Evaluate HTTP Response for Create Voice Call record
- Error handling for Create Voice Call record
- HTTP Request: Execute Omni Flow
- Save Voice Call record Id and Vendor Call Key in variable
L_Call_ID
- Evaluate HTTP Response for Execute Omni Flow
- Error handling for Execute Omni Flow
- Continue with call routing
1. Set Call Start Time
UTC timestamp of the call start time. This timestamp is used to create the Voice Call record and to update the Voice Call record if the caller hangs up before being routed to the agent.
- Label: SetCallStartTime
- Variable: L_Call_Start_Time
- Variable Value - Set Value:
{{now() | replace({'[UTC]': ''})}}
2. HTTP Request: Create Voice Call record
This step is required for every call. After the Voice Call record is created, the Voice Call record ID must be passed with the call to the agent in a variable (L_Call_ID). Configure the used variable in the Contact Center configuration in Service Cloud Voice.
HTTP Request Settings
- Label: CreateVoiceCall
- Use Authenticated Endpoint: Enabled
- Connector: <Salesforce Connector created in the previous step>
- Request Path:
/services/apexrest/cnxscv/voice/v1/createVoiceCall
- Method: POST
- Request Content Type: Application/JSON
Request Body
When creating the Voice Call record, you can also update custom fields on the Voice Call record with call data. Below are two examples of the request body, one with all the required fields but without updating custom fields, and one with custom fields.
Without updating custom fields on Voice Call record:
{
"callCenterDevName": "<Contact Center API name>",
"certDevName": "<cert dev name>",
"vendorCallKey": "{{NewPhoneContact.interactionId}}",
"to": "{{NewPhoneContact.DNIS}}",
"from": "{{NewPhoneContact.ANI}}",
"initiationMethod": "Inbound",
"startTime": "{{L_Call_Start_Time}}",
"participants": [
{
"participantKey": "{{NewPhoneContact.ANI}}",
"type" : "END_USER"
}
]
}
Example with updating custom fields on the Voice Call record:
{
"callCenterDevName": "<Contact Center API name>",
"certDevName": "<cert dev name>",
"vendorCallKey": "{{NewPhoneContact.interactionId}}",
"to": "{{NewPhoneContact.DNIS}}",
"from": "{{NewPhoneContact.ANI}}",
"initiationMethod": "Inbound",
"startTime": "{{L_Call_Start_Time}}",
"participants": [
{
"participantKey": "{{NewPhoneContact.ANI}}",
"type" : "END_USER"
}
],
"callAttributes": "{\"custfield1__c\": \"<value1>\",\"custfield2__c\": \"<value2>\",\"custfield3__c\": \"<value3>\"}"
}
Parameters
Property name | Value |
---|---|
callCenterDevName | Contact Center Developer Name |
certDevName | API Name of Certificate (as configured in Contact Center) |
vendorCallKey | Unique call id: {{NewPhoneContact.interactionId}} |
to | CalledNumber/DNIS: {{NewPhoneContact.DNIS}} |
from | CallingNumber/ANI: {{NewPhoneContact.ANI}} |
startTime | UTC timestamp {{L_Call_Start_Time}} (to be set right after the call is accepted in the script) |
callAttributes | Represents additional standard and custom fields in the voice call record, where each key-value pair corresponds to a standard or custom field and its values. Example: custfield1__c , custfield2__c , custfield3__c : API name of custom field on Voice Call object value1 , value2 , value3 : Value for the custom field |
Parse Settings
- Content Type: JSON
- Output Variable: L_Call_ID
- Path Expression:
$.data.voiceCallId
Voice Call record id, to be passed to the agent.
3. Evaluate HTTP Response for Create Voice Call record
Check the HTTP Status of the Create Voice Call http request
- Label: statusCodeCreateVoiceCall
- Variable: CreateVoiceCall.httpStatusCode
If status code == 200 => successful else => request failed, error handling
4. Error handling for Create Voice Call record
For demo / debug only, play message depending on http status code.
If Create Voice Call was successful, continue with Execute Omni Flow. Otherwise, continue with call routing.
5. HTTP Request: Execute Omni Flow (optional step)
Use Execute Omni-Flow when you want to
- run automated tasks, for example search for or create records, and link the records with the Voice Call record
- search for records and do screen-pop
- synchronize Salesforce and Cisco queues
- let Service Cloud Voice make the routing decision
This request always returns the "queue" or "agent" to where the call must be routed.
After executing this request, make sure you send Clear Routing if the caller hangs-up before being answered by an agent. See Webex Contact Center Event Flow
HTTP Request Settings
- Label: ExecuteOmniFlow
- Use Authenticated Endpoint: Enabled
- Connector: <Salesforce Connector created in the previous step>
- Request Path:
/services/apexrest/cnxscv/voice/v1/executeOmniFlow
- Method: POST
- Request Content Type: Application/JSON
Request Body
Apart from the required fields, you can pass additional data as input variables to the Omni-Flow. Below are two examples of the request body. First without additional flow parameters, required fields only, the second with two input variables.
Example with Omni-Flow parameters:
{
"callCenterDevName": "<Contact Center API name>",
"certDevName": "<cert dev name>",
"voiceCallId": "{{L_Call_ID}}",
"dialedNumber": "{{NewPhoneContact.DNIS}}",
"flowDevName": "<flow api name>",
"fallbackQueue": "<fallback queue name>"
}
Example with updating the custom fields on Voice Call record:
{
"callCenterDevName": "<Contact Center API name>",
"certDevName": "<cert dev name>",
"voiceCallId": "{{L_Call_ID}}",
"dialedNumber": "{{NewPhoneContact.DNIS}}",
"flowDevName": "<flow api name>",
"fallbackQueue": "<fallback queue name>",
"flowInputParameters":
{
"param1": "value1",
"param2": "value2"
}
}
Parameters
Property name | Value |
---|---|
callCenterDevName | Contact Center Developer Name |
certDevName | API Name of Certificate (as configured in Contact Center) |
voiceCallId | ID of the voice call record, created in the previous step: {{L_Call_ID}} |
dialedNumber | CalledNumber/DNIS: {{NewPhoneContact.DNIS}} |
flowDevName | Developer name of the Omni-Flow to execute |
fallbackQueue | Queue ID or Queue API name of the fallback Salesforce queue |
flowInputParameters | Additional inputs to the Omni-Channel flow (key-value pair). Example: param1 , param2 : Name of the Omni-Flow input parameter value1 , value2 : Value for the parameter |
Parse Settings
Queue
- Content Type: JSON
- Output Variable: L_OmniFlow_Queue
- Path Expression:
$.data.queue
"Queue" returned from Execute Omni-Flow, can be used for routing
Agent
- Content Type: JSON
- Output Variable: L_OmniFlow_Agent
- Path Expression:
$.data.agent
"Agent" returned from Execute Omni-Flow, can be used for routing
6. Save Voice Call record Id and Vendor Call Key in Flow variable
Concatenate Voice Call record Id and Vendor Call Key and store the value in the L_Call_ID
variable.
- Label: AddVendorCallKeyToVoiceCallRecordId
- Variable: L_Call_ID
- Variable Value - Set Value:
{{L_Call_ID}};{{NewPhoneContact.interactionId}}
L_Call_ID variable is used in the Execute Omni Flow HTTP request. Make sure the L_Call_ID variable is updated after the Execute Omni Flow node.
7. Evaluate HTTP Response for Execute Omni Flow
Check the HTTP Status of the Execute Omni Flow http request
- Label: statusCodeExecuteOmniFlow
- Variable: ExecuteOmniFlow.httpStatusCode
If status code == 200 => successful else => request failed, error handling
8. Error handling for Execute Omni Flow
For demo / debug only, play message depending on http status code.
If Execute Omni Flow was successful, variables L_OmniFlow_Queue and L_OmniFlow_Agent are not set. Routing decision in call flow.
Continue with call routing.
9. Continue with call routing
Continue in call flow, route call to agent. Optional, use L_OmniFlow_Queue and L_OmniFlow_Agent to select queue and agent.
Webex Contact Center Event Flow
If the caller hangs the call up before it is answered by an agent, we must update Service Cloud Voice and terminate the call.
- If Execute Omni-Flow was used, send Clear Routing to delete the Pending Service Routing (PSR)
- Send Update Voice Call, to update the start and end times on the Voice Call record and to change the status from New to Completed
- PhoneContactEnded - This event is triggered when a live call is disconnected, and all participants are removed.
- HTTP Request: Clear Routing
- HTTP Request: Update Voice Call
HTTP Request: Clear Routing
- Label: ClearRouting
- Use Authenticated Endpoint: Enabled
- Connector: <Salesforce Connector created in the previous step>
- Request Path:
/services/apexrest/cnxscv/voice/v1/clearRouting
- Method: POST
- Request Content Type: Application/JSON
Request Body
{
"callCenterDevName": "<Contact Center API name>",
"certDevName": "<cert dev name>",
"voiceCallId": "{{ (L_Call_ID | split(';'))[0] }}"
}
Parameters
Property name | Value |
---|---|
callCenterDevName | Contact Center Developer Name |
certDevName | API Name of Certificate (as configured in Contact Center) |
voiceCallId | ID of the voice call record, created in the previous step. Note: The variable L_Call_ID contains Voice Call record Id and Vendor Call Key, separated by a semicolon. Therefore you must split the string. |
Parse Settings
none
HTTP Request: Update Voice Call
- Label: UpdateVoiceCall
- Use Authenticated Endpoint: Enabled
- Connector: <Salesforce Connector created in the previous step>
- Request Path:
/services/apexrest/cnxscv/voice/v1/updateVoiceCall
- Method: POST
- Request Content Type: Application/JSON
Request Body
{
"callCenterDevName": "<Contact Center API name>",
"certDevName": "<cert dev name>",
"voiceCallId": "{{ (L_Call_ID | split(';'))[0] }}",
"startTime": "{{L_Call_Start_Time}}",
"endTime": "{{now() | replace({'[UTC]': ''})}}"
}
Parameters
Property name | Value |
---|---|
callCenterDevName | Contact Center Developer Name |
certDevName | API Name of Certificate (as configured in Contact Center) |
voiceCallId | ID of the voice call record, created in the previous step. Note: The variable L_Call_ID contains Voice Call record Id and Vendor Call Key, separated by a semicolon. Therefore you must split the string. |
startTime | UTC timestamp of call start {{L_Call_Start_Time}} (as used to create the Voice Call record) |
endTime | Current UTC timestamp `{{now() |
Parse Settings
none
Reference
Create a Private Key and Self-Signed Digital Certificate
Configure Connected App for Webex Contact Center Salesforce Connector
Set Up Integration Connectors for Webex Contact Center - Salesforce
Cisco Webex Contact Center Setup and Administration Guide > Flow Designer