This is a tutorial series that's cumulative in nature. To start from the beginning, start here.

A dialog is a group or flow of interactions that are triggered based on consumer intent. In this lesson, you create a Voicebot and a few dialogs therein.

Step 10: Create the bot

  1. Open the menu on the left side of the page, and select Automate > Conversation Builder.

    The Conversation Builder menu option in the left navigation menu

  2. Click New Bot in the upper-right corner.
  3. In the Choose a Bot Template window, click the orange arrow that appears when you move the mouse over the Custom Bot template in the Custom category.

    Choosing the Custom Bot template

  4. Specify the following:

    • Name: Pharmacy Bot
    • Channel Type: Voice
  5. Click Create Bot.

    Creating a custom bot

    This takes you to the new bot in Conversation Builder. And it opens the Welcome dialog. A dialog is a group or flow of interactions that are triggered based upon consumer intent. Since you selected the Custom Bot template when you created the bot, by default this creates a bot with 2 dialogs:

    • Welcome: This dialog is triggered after the call is set up and ready for the conversation. Once the call is ready, the system automatically sends the pattern initialize_conversation_voice to the bot, and the bot starts the conversation. In the Voice channel, the bot always starts the conversation because it’s the consumer who called in the first place. So, the bot speaks first, saying, “Hi there! Thanks for calling!” Learn more about how Voice conversations begin.

    • Fallback: This dialog is triggered when the bot doesn’t recognize the consumer’s message.

    The default configuration of the Welcome dialog in a Voicebot

    Let’s use the Preview tool to test the conversational flow so far. Keep in mind that, while Preview is helpful as you build out the bot flow, the primary way to test your bot is by phone. You’ll do that in a later step.

  6. Click Preview in the upper-right corner.

    This starts the conversation, so it triggers the Welcome dialog.

    The Preview tool lets you preview the conversational flow when the speech is played and when it isn’t.

    Previewing the Welcome dialog

  7. Click If speech is played.

    More previewing of the Welcome dialog

    This doesn’t move the flow along because we haven’t built out the bot yet.

  8. Still in the Preview window, enter, “I want to refill my prescription.” Then click If speech is played.

    This consumer query regarding a prescription refill triggers the Fallback dialog to begin its flow because the bot can’t handle this intent. So, you see the following:

    Even more previewing of the Welcome dialog

  9. Over in the Dialogs panel on the left, select the Fallback dialog to examine the interaction therein.

    The default state of the Fallback dialog

  10. Change the fallback response, so it uses more expressive, more informal language. Replace it with, “I’m sorry! I don’t understand.” Click Save in the interaction.

    Changing the message to play in the fallback statement

  11. In the Preview window, click Reset & start, so a new session is started, which ensures your changes are picked up.

  12. Enter the following again: “I want to refill my prescription.”

    You should see the updated fallback response:

    Testing the update of the fallback response

  13. Back in the Welcome dialog, change the bot’s welcome response: In the speech statement interaction, enter, “Hi there! I'm Anna, your automated voice assistant. Thanks for calling! How can I help you today?” (Remember to save the changes.)

    Being transparent about the use of an “automated assistant” is a Conversational Design best practice.

  14. Return to the Preview tool and test the changes. (Remember to click Reset & start to pick up your changes.)

    Testing the update of the welcome response

(Learn about the different parts of the workspace in Conversation Builder.)

Step 11: Add the Refill Prescription dialog

  1. Click Add Dialog in the lower-left corner.
  2. Specify the following:

    • Dialog Name: Refill prescription
    • Dialog Type: Dialog (This is the default value.)
  3. Click Save.

    The dialog is created and includes an empty Dialog Starter interaction. As you might surmise by the name, a dialog starter is the way that a dialog is started. That is, if the consumer’s response matches an intent or pattern that’s set in the dialog starter, that dialog’s flow begins.

    Let’s set that up now.

    An empty dialog starter interaction

  4. In the dialog starter, click + Intent.

    This opens the Assist tool.

  5. In Assist, select the “Pharmacy” domain.

    Selecting the Pharmacy domain

  6. Select the “Refill prescription” intent.

    Selecting the Refill Prescription intent

    This associates the intent with the dialog starter.

    The dialog starter with the Refill Prescription intent associated to it

    Now, whenever the consumer says something that matches the “Refill prescription” intent, the Refill Prescription dialog is triggered. And its flow begins.

    Let’s flesh out the dialog flow.

  7. Beneath the dialog starter, click New Interaction, and select the Speech statement interaction.

    The Speech statement interaction menu option on the menu

  8. Name the interaction, “Acknowledge refill” in the upper-left corner. And enter the statement: “Got it. I can help with that.”

    The configured Speech statement that acknowledges a Refill Prescription intent

  9. Beneath the statement, click New Interaction again, and select the Speech question interaction.

    The Speech question interaction menu option on the menu

  10. In the upper-left corner of the question, name the question “Get prescription number.”
  11. For the question enter: “What’s your seven digit prescription number?”

    The Speech question that asks the consumer for their prescription number

    The bot will always listen for a spoken response from the consumer, but you can turn on Accept touch-tone input if you also want to allow the consumer to respond using the keypad on their phone. If you enable this setting, the bot will listen for touch tones (DTMF input) in addition to speech.

  12. Click Accept touch-tone input. Then click Settings beside it.
  13. In the settings, specify the following:

    • Minimum Digits: 1
    • Maximum Digits: 7
    • Inter-digit Timeout: 2500

    Learn about configuring touch-tone settings.

    The touch tone settings in the interaction, configured

  14. Still in the settings, click the Advanced tab.
  15. For Elapsed time before prompt, enter “7000”.

    The advanced settings in the interaction, configured

    This should give the caller sufficient time to answer before being prompted again.

  16. Click Save.

    Now let’s add a custom rule that 1) verifies that the number entered by the consumer is seven digits, and 2) saves the consumer’s prescription number to a variable if it is seven digits, so we can use the number later.

  17. In the speech question, under Next Action, click Go To: Next Interaction, and then click + Custom Rule.

    The Add Custom Rule button

  18. In the pop-up window, name the rule “7 digits.”
  19. Click + Add Condition, and specify the following:

    • When the user matches any of the following conditions: Select “Regular Expression” and enter ^\d{7}$ as the RegEx value.
    • Then perform the following: Click + Add Variable. Enter “prescriptionNumber” for the variable name. Enter {$userMessage} for the variable’s value. Keep the duration as “Session.”
    • And go to: Leave this as “Go To: Next Interaction”

    Adding the rule

  20. Click Save.
  21. Add the interaction to play when the consumer enters a valid 7-digit prescription number: Click New Interaction, and select the Speech statement.
  22. In the interaction, enter, “Great! Thanks! We’ve got your info. We’re working on prescription number {$botContext.prescriptionNumber} now. Your prescription will be ready in 2 hours.”

    Ordinarily, before playing this message, you’d use an Integration interaction to tie into your pharmacy’s prescription fulfillment system and process the refill. But for the purpose of this tutorial, we’ll just assume this happened, and display the confirmation message straight away.

  23. Set the interaction’s next action to “End Interaction.”

    The configured success statement

    “End Interaction” stops the flow within the dialog.

  24. Save the interaction.

    Let’s preview the flow so far using the Preview tool.

  25. Open Preview if needed. Or, click Reset & start if it’s already opened.

    Previewing the flow

  26. Enter, “I want to refill my prescription.”
  27. Enter any 7-digit number.

    Previewing the flow

    Now let’s build out the flow for when the consumer enters an invalid prescription number.

  28. At the bottom of the dialog, click New Interaction, and add a Speech statement.

  29. In the interaction:

    • Name the interaction “Not seven digits”
    • For the statement, enter: “I’m sorry. That’s not a seven digit number. Please try again.”
    • For the next action, select the “Get prescription number” interaction in the same dialog.

    Statement saying the number provided isn't seven digits

    You need to add another rule that directs the conversation flow to this new interaction when the consumer doesn’t enter a 7-digit number.

  30. Return to the “Get prescription number” question, and click + Custom Rule.
  31. In the pop-up window, name the rule “Anything else.”
  32. Click + Add Condition, and specify the following:

    • When user matches any of the following conditions: Select “No Match”
    • And go to: Select the “Not seven digits” statement in the same dialog
  33. Click Save.

    The fully configured question for getting the consumer's prescription number, with two rules configured

  34. Use the Preview tool to test out the new flow.

    Previewing the flow

    In this lesson, you worked with Speech statements and Speech questions because the bot only uses TTS. But keep in mind that Voicebots also support Audio statements and Audio questions; these are for pre-recorded audio. While a text-to-speech (TTS) solution can be easier to build and maintain in the long run, use of pre-recorded audio is sometimes useful.

Step 12: Add the Schedule Vaccine dialog

  1. Click Add Dialog in the lower-left corner, and create a new dialog named “Schedule flu vaccine” of type “Dialog.”
  2. Link the dialog starter to the “Pharmacy” domain, and then to the “Schedule flu vaccine” intent.

    The dialog starter tied to the Schedule Flu Vaccine intent

  3. Add a statement interaction that simply says, “To schedule a flu vaccine, visit our website at www.acmemedical.com/vaccines.” Name the interaction “Acknowledge flu vaccine” in the upper-left corner.

    The statement acknowledging the intent to schedule a flu vaccine

  4. Save the interaction, and test it in the Preview tool.

    Previewing the flow

Step 13: Add an IVR menu

  1. Return to the Welcome dialog: Select it in the dialogs panel to open it in the dialog editor.
  2. In the speech statement, remove the question at the end, which is, “How can I help you today?” Then save the changes.

    Revising the welcome response

  3. Beneath the speech statement, add a speech question.
  4. In the question, enter the question: “To refill a prescription, press or say 1. To schedule a vaccine, press or say 2.”
  5. Turn on Accept touch-tone input.

    Adding an IVR question

  6. Go into the Advanced tab in the interaction settings, and set the Elapsed time before prompt to “7000”.

    Next, we add a custom rule that checks whether the consumer pressed 1 or said “one” to refill a prescription. So we can direct the conversation flow accordingly.

  7. Still in the question, add a custom rule named “Refill prescription.” In the rule, add two conditions that check for exact values of “1” and “1.” (with a period). If either condition is true, the flow should go to “Acknowledge refill” interaction in the Refill Prescription dialog.

    Adding a rule that checks for a Refill Prescription choice

    You must add both conditions because, if the question supports touch-tone input, and the consumer enters “1”, the bot receives “1”. And if the consumer says “one”, the bot might receive either “1” or “1.” You must account for both possibilities.

  8. Add a second rule named “Schedule flu vaccine.” In the rule, add two conditions that check for exact values of “2” and “2.” (with a period). If the conditions are true, the flow should go to “Acknowledge flu vaccine” interaction in the Schedule vaccine dialog.

    Adding a rule that checks for a Schedule Flue Vaccine choice

  9. Test the flow of the IVR menu using the Preview tool.

    Previewing the flow

    Previewing the flow

Step 14: Add the Anything Else dialog

In this step, you create a dialog named “Anything else” to support the flow when the bot asks, “Is there anything else I can help you with today?”

  1. Create a regular dialog named “Anything else.”
  2. Delete its Dialog Starter interaction.

    Deleting the dialog starter

  3. Add a speech question:

    • Name it “Ask if anything else.”
    • Enter the following question: “Is there anything else I can help you with today?”
    • Go into the Advanced tab in the interaction settings, and set the Elapsed time before prompt to “7000”.
  4. Follow the speech question with another question to play if the consumer says Yes, and a statement to play if the consumer says No, as shown below. The No statement should specify “Close Conversation” as its Next Action.

    The dialog flow

  5. Scroll up to the top of the dialog.
  6. In the dialog-level context menu, select Dialog Settings.

    The Dialog Settings option in the dialog-level context menu

  7. For Domain, select the “LP_Cross-vertical” domain that you extended to include intents for yes and no responses. Click Save.

    Associating the domain to the dialog makes available the intents in the domain, so you can take advantage of them in the dialog.

  8. Move to the first interaction in the dialog, which is a question. In the interaction, create a rule named “Yes” that directs the flow to the next interaction (“What’s your question or query?) if the consumer’s response matches the “Yes response” intent.

    Adding the Yes rule

  9. Create another rule named “No” that directs the flow to the “goodbye” statement if the consumer’s response matches the “No response” intent.

    Adding the No rule

    The configured question that asks the consumer if there's anything else that they need help with

    The consumer might just ask their next query straight away, instead of simply answering “yes” or “no.” But this will trigger one of the other core business dialogs. And if it doesn’t, it will trigger the fallback dialog.

  10. Return to the Refill Prescription dialog, and locate the interaction that thanks the consumer. Change its next action to redirect the flow to the first question in the “Anything else” dialog.

    Redirecting the refill prescription flow to the Anything Else dialog

  11. Do likewise at the end of the flow in the Schedule Vaccine dialog.

    Redirecting the schedule vaccine flow to the Anything Else dialog

  12. Test the experience in the Preview tool, for example:

    Previewing the flow

What's next?

Continue on to the next tutorial in the series.