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

Step 23: Send an SMS

During an automated voice conversation, there are times in the flow when you might need to send an SMS message to the consumer. In this step, after you receive the consumer’s prescription number (which means the pharmacy can get started on the refill), you send an SMS with the pharmacy hours to the consumer.

  1. Return to Conversation Builder, and open the bot.
  2. Open the Refill Prescription dialog.
  3. Go to the end of the positive flow, and insert a Send SMS integration interaction. Name it “Send SMS.”

    To insert an interaction in between two others, select the interaction before which you want to add one, and then click the desired tool in the interaction tool palette. This inserts the desired interaction directly beneath the selected interaction.

    For the number to which to send the message, enter “ + “ plus your personal phone number in e.164 format, for example, “ +18605551212 “. Ordinarily, as a best practice, you’ll specify a botContext variable here because you’ve saved the consumer’s number to the bot’s context. But for this tutorial, simply entering your own mobile number will work just fine. You want to send the message to your own phone.

    Also enter the following message:

    Thanks for your prescription order! We appreciate your business. Just a friendly reminder that we're open from Monday to Friday, 9 AM to 7 PM. On Saturdays, our hours are from 10 AM to 5 PM. We're closed on Sundays. Please don't reply to this message, as this will not work.

    Change the success and failure rules so that, in both cases, the flow moves to the “Ask if anything else” question in the Anything Else dialog.

    Adjust the Next Action in the “thanks” speech statement to go to “Next Interaction,” which is the SMS interaction.

    Things should look like this:

    The fully configured Send SMS interaction in the dialog flow

  4. Call the number again, and test the Send SMS experience.

Step 24: Prevent consumer interruptions

The consumer is free to interrupt statements and questions, but you can prevent this. You can enable or disable the ability using the Allow consumer interruptions setting. In this step, you disable the ability to interrupt one particular statement that you want the consumer to hear in full. (Learn more about consumer interruptions.)

  1. Open the Welcome dialog, and locate the first statement interaction.
  2. Adjust the text by adding, “Calls might be recorded for training purposes.”

    The Speech statement with the expanded message

  3. Click the settings icon to open the interaction’s settings, and select the Advanced tab.
  4. Turn off Allow consumer interruptions. Click Save.
  5. Test the experience in Preview and by phone.

Step 25: Handle consumer silence

When the Voice bot asks the consumer a question, but the consumer doesn’t respond, the Voice bot should appropriately handle the silence. This is a best practice to get the consumer back on track. In this step, you take care of this. (Learn more about consumer silence.)

  1. Still in the Welcome dialog, move down to the speech question.
  2. Open its interaction settings, and select the Advanced tab.
  3. For Handle consumer silence with, verify "Prompt to consumer" is selected.
  4. Click + Follow-up prompts.
  5. Add the following follow-up prompts:

    • Sorry, I didn't catch that. To refill a prescription, press or say 1. To schedule a vaccine, press or say 2.
    • Let's try again. To refill a prescription, press or say 1. To schedule a vaccine, press or say 2.

    Two example follow-up prompts

  6. Click Save.
  7. Test the experience in Preview and by phone.

    Testing the follow-up prompts in the Preview tool

Step 26: Apply SSML

SSML (Speech Synthesis Markup Language) provides a standardized way to control and enhance the speech output in a bot that uses TTS (text-to-speech). You can use it to control the speech (modify the pronunciation, intonation, emphasis, etc.), control the text formatting (break text into paragraphs or sentences, control the interpretation of numbers, dates, etc.), and more.

In this step, you apply SSML to an interaction to make it sound more cheerful.

  1. Return to the Refill Prescription dialog.
  2. Move to the speech statement interaction that’s just before the Send SMS interaction.
  3. Add the following SSML:

<speak version="1.0" xmlns="" xmlns:mstts="" xml:lang="en-US"><voice name="en-US-SaraNeural"><mstts:express-as style="general"><prosody rate="5%" pitch="0%"><s>Great! Thanks! We've got your info. We're working on prescription number {$botContext.prescriptionNumber} now. Your prescription will be ready in 2 hours.</s></prosody></mstts:express-as></voice></speak>

Take care to copy and paste the SSML as you see above. Sometimes, spaces in the structure cause the SSML to not work correctly.

What's next?

Continue on to the next tutorial in the series.