Skip to content

Mission 4: Configure the fulfillment

🚨 Important Lab Dependency

This mission requires configuration created in the following missions:

  1. AI Agent Track ⮕ Scripted Agent: Mission 1 - Configure Scripted Agent to answer basic questions
  2. AI Agent Track ⮕ Scripted Agent: Mission 2 - Integrate Scripted Agent with Voice Flow
  3. 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

  1. Open up Webex AI Agent Studio portal, go to Scripts ⮕ Responses and open up response track_order. Go to Voice Channel. Profiles

  2. Add Custom Event on the right-hand side of the prortal and configure it with the following:

    Event Name: order_details
    Event payload:

    {"ordernumber":"${entity.order_number}"}
    

    Save the updated response.

Profiles

  1. Save and Publish your changes. Enter publishing text in the popup comment window, then click Publish Profiles

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.

Profiles

Task 2. Make API call from Voice Flow to retrieve the order status

  1. 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. Profiles

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

  3. Create 3 empty variables with type String and with the following names:

    order_id
    MetaData_Scripted_Agent
    order_status

    Profiles

  4. 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. Profiles

    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.

  5. 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}}. Profiles

  6. Add Parse node and connect it to SetVariable node. Profiles

  7. Configure the Parse node with the following:

    Input Variable: MetaData_Scripted_Agent
    Content Type: JSON
    Output Variable: order_id
    Path Expression: $.ordernumber

    Profiles

    Good to Know: Understanding the Parse node configuration.

    The goal of the Parse node is to extract the order_number entity received from AI Studio and assign it to the flow variable named order_id. This variable will be used later in the API call.
    Profiles

  8. Add an HTTPRequest node and connect it to parse node. Profiles

  9. 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

    Profiles

  10. Add Disconnect Contact and connect HTTPRequest node to the Disconnect Contact node. Validate and Publish the flow. Profiles

  11. 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

  12. 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. Profiles

  13. 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! 🎉🎉