Execute API from WxCC flow.
Objective
In these labs, you'll learn how to execute APIs from a WxCC flow using the native connector and debug the results. The use case involves updating a Global Variable with a default value of 'Open' or 'Closed.' This Global Variable can then be used in other flows, allowing you to implement logic that routes calls to either open or closed-hours greetings.
There are many other use cases that you can implement by using native WxCC API in the flow, such as:
Admin Flows (CCX Delta)
Dynamic Reskilling
Preferred Agent Routing
Dynamic call routing in flow
Journey Data based call routing
Last Agent Routing
CSAT / Rating based Routin
Least Handle Time Agent based Routing
Least Queue Time Queue based Routing
Least Handle Time Queue based Routing
Dynamic Menu Options (Menu from Call Reasons for previous calls from caller)
Personalized Greetings (ANI based personalization using historical information)
Post Call metadata to external system after call gets done (Event Flow)
Task 1. Create a Native connector to execute WxCC APIs from the flow.
Step 1. Login to Control Hub (admin.webex.com). Go to Contact Center and under Integrations find Webex Contact Center connector. Click on Add more.
Step 2. Fill up the required information and click on Add connector.
Step 3. You should receive the notification that the connector was created, click to Close the notification.
Task 2. Create Global Variable.
Step 1. Go to Webex Contact Center Management Portal.
Step 2. In the Provisioning module search for Global Variables.
Step 3. Click on Create New Global Variable.
Step 4. Name the variable "Office_Open_Closed". The variable type set as String. Click on Save.
Step 5. Copy the Global Variable ID. You will need it in the further tasks.
Task 3. Create WxCC flow.
Step 1. Go to Control Hub and create a new flow.
Step 2. Click on Start Fresh.
Step 3. Provide a name for your flow and click on Create Flow.
Task 4. Configure flow to executive WxCC API.
Step 1. Add Global Variable to the flow. See the screenshot below with the steps.
Step 2. Add flow Variable with name Flow_Variable_Open_Closed.
Step 3. Add Menu node. Configure it with options 1 and 2. Add Google or Native TTS and provide the greeting: "Press 1 to open or 2 to close the office.".
Step 4. Connect SetVariable node to option 1 of the Menu node and configure it to assign the value "Open" to the flow variable Flow_Variable_Open_Closed.
Step 5. Add another SetVarialbe node and connect it to option 2 of the Menu node. Configure it to assign value as "Closed" to the flow variable Flow_Variable_Open_Closed.
Step 6. Add HTTPRequest block and select the connector that you have created in Task 1.
Step 7. To collect further API requests details, login to the Dev Portal (https://developer.webex-cx.com/) click on Documentation, and on the left side select Global Variables.
Step 8. On the following window select PUT request.
Step 9. Click on Try Out and you will see the instructions with the required fields.
Step 10. Go back to WxCC flow and configure Method PUT and URL with OrgID and Global Variable ID parameters (that you created earlier). For example, if for my test tenant, the OrgID is 80d3ab4e-895c-4a38-9815-4c585100d0b4 and the Globl Variable ID is 23629b1d-802f-4d99-bfc2-811d2fdafd81, then the request URL will be /organization/80d3ab4e-895c-4a38-9815-4c585100d0b4/cad-variable/23629b1d-802f-4d99-bfc2-811d2fdafd81
Step 11. While on HTTPRequest block scroll down and select the Content Type: Application/JSON.
Then add the body:
{ "active": true, "agentEditable": false, "agentViewable": false, "createdTime": 0, "defaultValue": "{{Flow_Variable_Open_Closed}}", "description": "", "desktopLabel": "", "id": "23629b1d-802f-4d99-bfc2-811d2fdafd81", "lastUpdatedTime": 0, "name": "Office_Open_Closed", "organizationId": "80d3ab4e-895c-4a38-9815-4c585100d0b", "reportable": false, "variableType": "String", "version": 0 }
Please ensure you replace the id, name and organizationId with the one you have for your tenant.
Step 12. Add DisconnectContact node. Add the flow to your test Channel. Place calls to the number related to your Channel and select 1. The Default Value of the Global variable should change to "Open".
Place one more call and press option 2, the value should change to "Closed".
Task 5. Configure flow to see the API call response status code, body and headers.
The HTTPRequest block has 3 Activity Output Variables.
However, if you run Debugger the values of the variables will be hidden. To see the results of the API call request we need to assign the HttPRequst Activity Output Variables to some flow variables.
Step 1. Create three String-type flow variables with names HTTP_Status_Code, HTTP_Headers, and HTTP_Body.
Step 2. Delete the DosconnectContact block and add 3 SetVariable blocks. Connect them one after another and close the flow by adding DisconnectContact node.
Step 3. Using the SetVariable nodes assign the Activity Output Variables from HTTPRequest node to the Flow Variables that you created in the Step 1.
You can do it by copy the Activity Output Variable name from the HTTPRequest node and use Set Value option in SetVariable node.
Or you can select the HTTP Activity Output Varialbe from the list using Set To Variable option in SetVariable node.
Step 4. Publish the flow. Place the test call and check the result in the Debugger.
Congratulations, you have completed the lab.