main: true name: PizzaKing #context: Define the variables which will used throughout the dialog flow here. context: variables: iResult: "nlpresult" pizzaSize: "PizzaSize" pizzaTopping: "PizzaTopping" deliveryTime: "TIME" pizzaOrderMsg: "string" states: intent: component: "System.Intent" properties: # variable refers to the context variable that is used to store the intent that’s resolved from the user input. This variable must be of type 'nlpresult'. variable: "iResult" # optionsPrompt (optional) is the prompt shown to the user when there are multiple top intents within the confidence win margin. Defaults to 'Do you want to'. optionsPrompt: "Do you want to" transitions: actions: OrderPizza: "startOrderPizza" CancelPizza: "cancelPizza" FileComplaint: "fileComplaint" unresolvedIntent: "startUnresolved" startOrderPizza: component: "System.CommonResponse" properties: keepTurn: true processUserMessage: false metadata: responseItems: - type: "text" text: "OK, let's get that order sorted." transitions: next: "setPizzaSize" setPizzaSize: component: "System.CommonResponse" properties: processUserMessage: true variable: "pizzaSize" nlpResultVariable: "iResult" useFullEntityMatches: true metadata: responseItems: - type: "text" #text: "Please select a size" text: "${system.entityToResolve.value.prompt}" actions: - label: "${enumValue.value!enumValue.originalString}" type: "postback" iteratorVariable: "system.entityToResolve.value.enumValues" payload: variables: pizzaSize: "${enumValue.value!enumValue.originalString}" transitions: next: "setPizzaTopping" setPizzaTopping: component: "System.CommonResponse" properties: processUserMessage: true variable: "pizzaTopping" nlpResultVariable: "iResult" useFullEntityMatches: true metadata: responseItems: - type: "text" #text: "Please select a topping" text: "${system.entityToResolve.value.prompt}" actions: - label: "${enumValue.value!enumValue.originalString}" type: "postback" iteratorVariable: "system.entityToResolve.value.enumValues" payload: variables: pizzaTopping: "${enumValue.value!enumValue.originalString}" transitions: next: "setPizzaDeliveryTime" setPizzaDeliveryTime: component: "System.CommonResponse" properties: processUserMessage: true variable: "deliveryTime" maxPrompts: 3 nlpResultVariable: "iResult" useFullEntityMatches: true metadata: responseItems: - type: "text" text: "At what time can we deliver that for you (e.g. 4 pm)?" transitions: actions: cancel: "maxError" next: "setPizzaOrderMessage" setPizzaOrderMessage: component: "System.SetVariable" properties: variable: "pizzaOrderMsg" value: - "Thank you for ordering from Pizza King!" - "OK, so we are getting you the following items:" - "A ${pizzaSize.value.value} ${pizzaTopping.value.value} pizza at ${deliveryTime.value.date?long?number_to_time?string('HH:mm')}." transitions: next: "displayOrderConfirmation" displayOrderConfirmation: component: "System.CommonResponse" properties: processUserMessage: false metadata: responseItems: - type: "text" separateBubbles: false text: "${pizzaOrderMsg}" iteratorVariable: "pizzaOrderMsg" transitions: return: "done" startUnresolved: component: "System.CommonResponse" properties: metadata: responseItems: - type: "text" text: "I am sorry I could not understand. Let's connect you with someone to help." transitions: return: "done" cancelPizza: component: "System.CommonResponse" properties: processUserMessage: true metadata: responseItems: - type: "text" text: "I am sorry to hear this. Let me take your cancellation request." transitions: return: "done" fileComplaint: component: "System.CommonResponse" properties: metadata: responseItems: - type: "text" text: "I am sorry to hear this. Let me take your complaint details." transitions: return: "done" maxError: component: "System.CommonResponse" properties: metadata: responseItems: - type: "text" text: "OK let's connect you with someone to help" transitions: return: "done"