Mission 4: Configure the fulfillment
🚨 Important Lab Dependency
This mission requires configuration created in the following missions:
- AI Agent Track ⮕ Scripted Agent: Mission 1 - Configure Scripted Agent to answer basic questions
- AI Agent Track ⮕ Scripted Agent: Mission 2 - Integrate Scripted Agent with Voice Flow
- AI Agent Track ⮕ Scripted Agent: Mission 3 - Configure flow to track an order
If these missions were not completed, some steps in current mission will not function correctly.
Mission Details
- In the previous Mission 3, you created intents, entities, and responses to enable the Scripted Agent to understand and respond to order-tracking requests. However, no logic or API calls were configured yet to retrieve the order information. In this mission, you will configure the fulfillment flow to use an API call to retrieve the order status and send it back to the caller.
Build
Task 1. Configure a Custom Event to send data from AI Studio to WxCC Voice Flow
-
Open up Webex AI Agent Studio portal, go to Scripts ⮕ Responses and open up response track_order. Go to Voice Channel.

-
Add Custom Event on the right-hand side of the prortal and configure it with the following:
Event Name: order_details
Event payload:Save the updated response.
- Save and Publish your changes. Enter publishing text in the popup comment window, then click Publish

Good to Know: Why we need to use a Custom Event for fulfillment.
The API call to retrieve the order status can be made from the Voice Flow. By using a Custom Event, we send the order_number entity that the Scripted Agent collects during the call to retrieve the status.
Task 2. Make API call from Voice Flow to retrieve the order status
-
Switch to Webex Control Hub, go to Contact Center click on Flows. Open up your flow. If you follow all lab steps, the name should be Autonomous_Scripted_Flow_2000_Your_Attendee_ID. Or if you have different name, find your flow. Click on it to open the Flow.

-
Select Edit for the flow, click anywhere on the gray area in the flow, and look for the Flow Variables on the right side.

-
Create 3 empty variables with type String and with the following names:
order_id
MetaData_Scripted_Agent
order_status -
The fulfillment will go over the Handled output. So, in your Voice flow, remove the Disconnect Contact node and add SetVariable node. Connect Handled output to the SetVariable node.

Note
In the next step, you will assign the flow variable MetaData_Scripted_Agent, which we created earlier, with the value of the MetaData from the VirtualAgentV2 node. This will allow us to decrypt and review the MetaData from the VirtualAgentV2 node, which could be useful for troubleshooting any issues with the fulfillment flow.
-
Click on the VirtualAgentV2 node, scroll down to Activity Output Variables, and copy the MetaData variable name. Then, open the SetVariable node and configure the MetaData_Scripted_Agent variable with the variable value you copied from the VirtualAgentV2 node. Make sure to enclose it in curly brackets { }.
Ex. {{VirtualAgentV2_i25_p40.MetaData}}.
-
Configure the Parse node with the following:
Input Variable: MetaData_Scripted_Agent
Content Type: JSON
Output Variable: order_id
Path Expression: $.ordernumber -
Configure the HTTP Request node with the following:
Use Authenticated Endpoint: off
Request URL: https://674481b1b4e2e04abea27c6e.mockapi.io/flowdesigner/Lab/flowers
Method: GET
Queue Parameters:
Key: id
Value: {{order_id}}
Content Type: Application/JSON
Parse Settings:
Content Type: JSON
Output Variable: order_status
Path Expression: $[0].status -
Add Disconnect Contact and connect HTTPRequest node to the Disconnect Contact node. Validate and Publish the flow.

-
Switch to Control Hub and navigate to Channels under Customer Experience Section
-
Locate your Inbound Channel (you can use the search): Your_Attendee_ID_Channel
-
Select the Routing Flow: Autonomous_Scripted_Flow_2000_Your_Attendee_ID
-
Select the Version Label: Latest
-
Click Save in the lower right corner of the screen
-
-
Test the call by dialing the number configured with the Channel and Flow. Select option 2 in the IVR and say, "I want to track my order." Provide the order number that you created earlier. The call will then be disconnected. Open the Debug mode for your flow, find the latest call, and review the logs. You should see the status of your order.

-
In the next Mission 5, you will configure the flow to return the order status details back to the caller.
Congratulations, you have officially completed this mission! 🎉🎉







