Skip to content

Mission 2: Configure Action and create an order.

What is Action? [Optional] Action is a task that an AI agent performs by understanding user intents and completes by connecting to external systems.

For more information visit Webex Documentation

Mission overview

Your mission is to:

Configure an action to collect order details from the customer and send them to a third-party application via APIs.


Build

Task 1. Create Service and AI Agent Flow in Webex Connect.

  1. From Control Hub, go to Contact Center and open up Webex Connect Portal. Profiles

  2. Create new Service with name _2000_Service Profiles

  3. Click on Flows and create new flow with the name Create_Ordedr_Flowers Profiles

  4. From the Integrations list select AI Agent. Profiles

  5. For now, save the flow and Make it live. We will return to configuring this flow later. Creating it now is necessary to complete configurations in the AI Studio Portal. Profiles

Task 2. Configure Action in the AI Studio.

  1. If not logged-in in AI Agent Studio, login to the AI Studio Portal. Profiles

  2. Select your AI agent with name _2000_AutoAI_Lab that we created earlier, go to Actions. You will see one Action is already created by default for the Agent Handoff. We will be creating more actions.

    Profiles

  3. Click on creat New Action. Configure it with name Create_New_Order and the Action Description Collect order details, delivery address, total and response with the orderNumber once the order is completed.. In the Action score select Slot filling and fulfillment. Profiles

  4. Scroll down and click to create New input entity. Fill up the table with the following and then click on Add.
    Entity Name: address
    Entity Typs: string
    Description: Collect the customer's delivery address
    Example: 548 Catalina Drive, Cary, NC 27515
    Required: Yes Profiles

  5. By following the same pattern, create an entity that specifies whether the customer requires delivery.
    Entity Name: delivery
    Entity Types: string
    Description: Check if the customer needs delivery or not. Event if they want to proceed with order without specifying the delivery details. If the customer wants to confirm the order but didn't specify if they need delivery or not, ask one more time if they need the delivery or not.
    Example: Yes,No
    Required: Yes

  6. By following the same pattern, create an entity to collect the customer's phone number.
    Entity Name: phoneNumber
    Entity Typs: string
    Description: Collect customer's phone number. Before the customer complete the order, ask if they would like to receive confirmation over the SMS. If so, collect the phone number.
    Example: 3477579861
    Required: Yes

  7. By following the same pattern, create an entity to collect the customer's order details.
    Entity Name: orderDetails
    Entity Typs: string
    Description: Collect the flowers and bouquets information that customer orders. Make sure to do correct math. If one rose is 20 dollars and the customer would like buy 9 roses then the price should be 180 dollars. Don't use double quotes (") in the generated responses.
    Example: Romantic Roses standard bouquet and one more bouquet with 9 roses
    Required: Yes

  8. By following the same pattern, create an entity to store the total price information of the order.
    Entity Name: orderTotal
    Entity Typs: string
    Description: After the customer inform if they need delivery or not, and confirm that they would like to proceed with completing the order, collect the Total information and assigned it to this slot.
    Example: 150 dollars, 70 dollars
    Required: Yes

  9. By following the same pattern, create an entity to store the order status information.
    Entity Name: status
    Entity Typs: string
    Description: Always create it as "new"
    Example: new
    Required: Yes

  10. At this point you should see 6 created entities. Please double check it. Profiles

  11. In the Webex Connect Builder Fulfillment select Service: _2000_Service and Flow: Create_Order_Flowers Click Add Profiles

  12. Publish the update of your AI Agent. Profiles

Task 3. Deliver collected order information to Webex Connect for fulfillment.

  1. Login to the Webex Connect, go to the Service _2000_Service and click on Manage the flow that you have created earlier. Profiles

  2. Click on Edit the flow on the right top. Then double click on the AI Agent event. In the Provide Sample JSON, replace the standard JSON body with the following:

    {
      "orderDetails": "ID",
      "orderTotal": "Type",
      "delivery": "Type",
      "address": "Type",
      "status": "Type",
      "phoneNumber": "Type"
    }
    

  3. Then click on Parse and Save the change. Profiles

  4. Drag and drop HTTP Request node from the left side of the Webex Connect Flow Builder. Connect AI Agent block to the HTTP Request block. Profiles

  5. Open up HTTP Request node and configure it with the following HTTP Request:

    Method: POST
    Endpoint URL: https://67e9aa0bbdcaa2b7f5b9ed62.mockapi.io/customerOrder
    Header: Content-Type: application/json
    Body:

    {
     "orderDetails": "$(n2.aiAgent.orderDetails)",
     "orderTotal": "$(n2.aiAgent.orderTotal)",
     "delivery": "$(n2.aiAgent.delivery)",
     "address": "$(n2.aiAgent.address)",
     "status": "$(n2.aiAgent.status)",
     "phoneNumber": "$(n2.aiAgent.phoneNumber)"
    }
    

    Output Variable Type: JSON
    Click on +Add Variable
    Output Variable Name: orderNumber
    Response Entity: Body
    Response Path $.id

    Profiles

  6. Compare your settings with the screenshot below to make sure you configured the HTTP Request correctly. Make sure you Save the changies. Profiles

  7. Save changies and click on Make Live. Profiles

Task 4. Deliver data from Webex Connect to AI studio for the response to the customer.

  1. [Read Only] Once the HTTP request is completed a new object will be created on the third-party application. You can see all objects by using the this link https://67e9aa0bbdcaa2b7f5b9ed62.mockapi.io/customerOrder. Below you can see the screenshot with all orders information. Currently there are only 2 orders, but by the time of this lab there could be more. Profiles Each order/object will contain all the information that we sent from AI Studio but one - id. This key is created automatically once we create the object. The goal of this Task is to send the value of the id back to the AI Agent so AI Agent can provide it to the customer while they are still in live contact, like you can see on the picture below.
    Profiles

  2. [Read Only] When you were configuring HTTP Request in your previous Task, on the bottom of the request you were configuring the Output Variable. This variable will be used to parse the unique order id and pass the value to the Output Variable with name orderNumber. See the screenshot below. In the next step we will be configuring this orderNumber variable to be sent to Webex AI studio.
    Profiles

  3. While on your Webex Connect flow, click on Edit the flow then click on the Settings and on the top select Flow Outcomes and expand Last Execution Status. In the Define key-value pairs to be sent to the AI Agent select Enter JSON. Profiles

  4. We need to add the key-value pair to the existing JSON body. Add the comma after the last pair and insert "orderNumber": "$(n3.orderNumber)". Make sure there is no comma after the pair that you inserted. Then click on Save. Profiles

    Also see this change in action below. Profiles

  5. Click on Make Live to publish the flow. Profiles

Task 5. Configure SMS confirmation.

  1. If it is not open, navigate to Webex Connect portal. Find your Service _2000_Service, navigate to the flow and click on Manage the flow. Profiles

  2. On the right top click on Edit. Then from the available Utilities on the left side find the SMS and drag and drop the block to the flow. Connect HTTP Request node to the SMS node. Profiles

  3. Double click on the SMS block and configure the following:

    Destination: $(n2.aiAgent.phoneNumber)
    From Number: 12066478712
    Message Type: Text

    Message as below:

    Here is your order details:
    orderNumber: "$(n3.orderNumber)"
    orderDetails: "$(n2.aiAgent.orderDetails)"
    orderTotal: "$(n2.aiAgent.orderTotal)"
    delivery: "$(n2.aiAgent.delivery)"
    address: "$(n2.aiAgent.address)"
    status: "$(n2.aiAgent.status)"
    phoneNumber: "$(n2.aiAgent.phoneNumber)"

    Profiles

  4. Save and Click on Make Live. Profiles

Task 6. Test the order creating and details delivery over SMS.

  1. In the Webex AI Agent Studio, click on preview and order flowers for you friend. Profiles

  2. Check if the confirmation SMS was received on your phone.
    Profiles

Congratulations, you have officially completed this mission! 🎉🎉