Skip to content

Mission 4: Configure Fulfillment Action to create an order

🚨 Important Lab Dependency

This mission requires configuration created in the following missions:

  1. AI Agent Track ⮕ Autonomous AI Agent: Mission 1 - Create AI Autonomous Agent
  2. AI Agent Track ⮕ Autonomous AI Agent: Mission 2 - Integrating the AI Agent with Flow for Voice Calls
  3. AI Agent Track ⮕ Autonomous AI Agent: Mission 3 - Send Custom data to Autonomous AI Agent

If these missions were not completed, some steps in current mission will not function correctly.


Good to Know: What is fulfilment Action?

Fulfilment Action is a task that an AI agent performs by understanding user intents and completes by connecting to external systems over API.

For more information, visit Webex Documentation.

Mission overview

Your mission is to:

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

Profiles


Build

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

  1. In Control Hub, go to Contact Center > Overview and open up the Webex Connect Portal. Profiles

  2. Create a new Service with name Your_Attendee_ID_2000_Service.
    Profiles

  3. Click on Flows and create new flow with the name Create_Order_Flowers_Your_Attendee_ID.
    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 Webex AI Agent Portal. Profiles

Task 2. Configure Action in the AI Studio

  1. Switch to Webex AI Agent Portal. Profiles

  2. Select your AI agent with name Your_Attendee_ID_2000_AutoAI_Lab that you created earlier and go to Actions. You will see one Action is already created by default for the Agent Handover. We will now create few more actions.
    Profiles

  3. Click on create New Action. From the drop-down option, select Fulfillment action. Profiles

  4. Configure new action as follows:

    • Action name: Create_New_Order
    • Action description: Collect order details, delivery address, total and response with the orderNumber once the order is completed.
    • Action score: select Slot filling and fulfillment from the drop-down list.

    Profiles

  5. 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 Type: string
    Description: Collect the customer's delivery address
    Add example: 548 Catalina Drive, Cary, NC 27515
    Required: Yes
    Profiles

  6. By following the same pattern, create a new entity that specifies whether the customer requires delivery.

    Entity Name: delivery
    Entity Type: 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.
    Add example: Yes
    Add example: No
    Required: Yes

  7. By following the same pattern, create a new entity to collect the customer's phone number.

    Entity Name: phoneNumber
    Entity Type: 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.
    Add example: 3477579861
    Required: Yes

  8. By following the same pattern, create a new entity to collect the customer's order details.

    Entity Name: orderDetails
    Entity Type: 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.
    Add example: Romantic Roses standard bouquet and one more bouquet with 9 roses
    Required: Yes

  9. By following the same pattern, create a new entity to store the total price information of the order.

    Entity Name: orderTotal
    Entity Type: 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.
    Add example: 150 dollars, 70 dollars
    Required: Yes

  10. By following the same pattern, create a new entity to store the order status information.

    Entity Name: status
    Entity Type: string
    Description: Always create it as "new"
    Add example: new
    Required: Yes

  11. At this point you should see 6 created entities. Please double check that your configuration matches the screenshot below. Profiles

  12. Scroll down to Webex Connect Builder Fulfillment, select Service: Your_Attendee_ID_2000_Service and Flow: Create_Order_Flowers_Your_Attendee_ID. Click on Add.
    Profiles

  13. Publish the update of your AI Agent. Provide any version name in popped up window (e.g. "1.1").
    Profiles

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

  1. Switch to Webex Connect portal, select the Service Your_Attendee_ID_2000_Service, then click on Flows tab.

  2. Next to your Create_Order_Flowers_Your_Attendee_ID flow, click on a small arrow under Actions and then Manage. Profiles

  3. 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"
    }
    

    Profiles

  4. Click on Parse and Save the change. Profiles

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

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

    Method: POST
    Endpoint URL: https://674481b1b4e2e04abea27c6e.mockapi.io/flowdesigner/Lab/flowers
    Header: Content-Type
    Value: 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)"
    }
    

  7. In the same configuration window make sure Output Variable Type set to JSON. Then click on +Add Variable

    Output Variable Name: orderNumber
    Response Entity: Body
    Response Path $.id

    Profiles

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

  9. Save changes 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://674481b1b4e2e04abea27c6e.mockapi.io/flowdesigner/Lab/flowers. 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 configured 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.

    "orderNumber": "$(n3.orderNumber)"
    

    Profiles

    Also see this change in action below.
    Profiles

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

  6. Wait until the flow become Live if you want to do any tests. This may take a few minutes.
    Profiles

Task 5. Configure SMS confirmation

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

  2. Double click on the SMS node and configure the following:

    Destination: $(n2.aiAgent.phoneNumber)
    From Number: 447507201958
    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

  3. 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 your friend. Try to order flowers with or without delivery. When asking for your number, provide your cellphone number without +. Complete the order.
    Profiles

  2. Another way to test the order creation is to dial the support number assigned to your Your_Attendee_ID_Channel channel, and create an order during the conversation with the AI agent.

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

  4. Optionally, you can check your order by accessing the database and replacing 'YOUR_PHONE_NUMBER' with the phone number you provided while ordering: ***https://674481b1b4e2e04abea27c6e.mockapi.io/flowdesigner/Lab/flowers?phoneNumber='YOUR_PHONE_NUMBER'
    Profiles

Congratulations, you have officially completed this mission! 🎉🎉