Introduction

The Flow ability allows a bot designer to connect their bots by using Microsoft Flow. This version of the ability provides the designer with a custom Flow connector to improve the experience working between the two products.
Your Flow can interact with the user via the bot by posting messages, cards and asking questions.
It is possible to add multiple flows to a single bot. Just make sure the keywords and targets are unique enough for LUIS to determine which Flow to trigger.

Prerequisites

  1. Licensed to use Microsoft Flow
  2. Office 365 Account
  3. LiveTiles Bots Subscription

Getting started

This example creates a bot that gathers some information and posts a reply back to the user.

Create a bot with a Flow ability

  • Create a bot;
  • Add a Flow ability;
  • Save the changes;
  • Train the bot;
  • Go to Microsoft Flow;
  • Go to "My Flows" and create a new flow;
  • Click on "Create from Blank";
  • Search for LiveTiles Bots;
  • The connectors will include Triggers and Actions;
  • Select "On Trigger" option from triggers;
  • Select your Bot and the applicable Flow using the dropdowns;
  • Add a "Post Message" action;
  • Add a "Flow Complete" action; This will hand control of the conversation back to the bot;
  • The Flow should look something like this;
  • When you talk to your bot, it should look something like this;

Triggers

On Trigger

This trigger starts your Flow whenever your ability is sent a message. The response of the trigger is determined by the conversation and form parameters you have defined on your ability.

Actions

Post Message

This sends the user a message that can contain information gathered from the Flow.
Below is a breakdown of the fields used for this action:

  • Resumption token - Used by the connector to reference back to the conversation;
  • Message - The message to send to the user;
  • Attachments - Array of attachments. These attachments are added to the message sent to the user;
  • Content Type - MIME type of the attachment, for example "image/png" or "application/vnd.microsoft.card.adaptive";
  • Content - The content of your attachment; (adaptive card, image binary, etc.)
  • ContentURL - Alternative to 'Content', for example, https://livetiles.nyc/image.png;

Prompt Boolean

This prompt provides the user with a question, and their response is captured and provided back into the Flow. Below is a breakdown of the fields used for this action:

  • Resumption token - Used by the connector to reference back to the conversation;
  • Prompt - The prompt to send to the user;

The response that the user provides to this prompt comes back with the following field:

  • Answer - The boolean result of the prompt;

Prompt Choice

This prompt provides the user with a list of options to select from. Below is a breakdown of the fields used for this action:

  • Resumption token - Used by the connector to reference back to the conversation;
  • Prompt - The prompt to send to the user;
  • Options - A list of options to present to the user;
  • Display - The value the user will see;
  • Value - The value that will be sent back to the Flow;

The response that the user provides to this prompt comes back with the following field:

  • Answer - The value of the selected item;

Prompt File

This prompt provides the user to upload a file. Below is a breakdown of the fields used for this action:

  • Resumption token - Used by the connector to reference back to the conversation;
  • Prompt - The prompt to send to the user;
  • ContentTypes - The kind of file to ask for; This can be an asterix to allow any kind of file or MIME type, for example "image/*" or "image/png";

The response that the user provides to this prompt comes back with the following field:

  • Answer - The url of the uploaded file;

Prompt Form

This prompt asks the user for multiple fields of information at the same time, using a Form control. Below is a breakdown of the fields used for this action:

  • Resumption token - Used by the connector to reference back to the conversation;
  • Prompt - The prompt to send to the user;
  • Title - The title text at the top of the form;
  • FieldType - The kind of Field to present;
  • Name - The key of the field; This needs to be unique as it is used to extract the value from the result;
  • Label - The label to present with the input field;
  • IsRequired - Make this a mandatory field;
  • IsMultiline - Require an input that allows multiple lines of text;
  • Pattern - The regex pattern the field must match;
  • MinLength - The minimum number of characters;
  • MaxLenght - The maximum number of characters;
  • IsMultiselect - Determines whether multiple choice items can be selected if the field type is Choice;
  • Choices - List of choices to present when the field type is Choice;

The response that the user provides to this prompt comes back with the following field:

  • Answer - Dictionary of values;

Prompt Number

This prompt asks the user for a number. Below is a breakdown of the fields used for this action:

  • Resumption token - Used by the connector to reference back to the conversation;
  • Prompt - The prompt to send to the user;

The response that the user provides to this prompt comes back with the following field:

  • Answer - The number sent back by the user;

Prompt String

This prompt asks the user for some text. Below is a breakdown of the fields used for this action:

  • Resumption token - Used by the connector to reference back to the conversation;
  • Prompt - The prompt to send to the user;

The response that the user provides to this prompt comes back with the following field:

  • Answer - The text sent back by the user;

Prompt Done

In order to let the bot know that the Flow has been completed, call this action so that the bot can take back control of the conversation. Below is a breakdown of the fields used for this action:

  • Resumption token - Used by the connector to reference back to the conversation;

Troubleshooting

"I get a message saying 'Unable to complete ability action' after a period."
Double check that you have ran the Done endpoint at the end of your Flow.
There is a limit of 2 minutes to complete your Flow.

"What if Flow breaks down in the middle of the conversation?"
Check that all the actions have their required values captured.

Did this answer your question?