The Flow ability allows a designer to connect their bots to their Flows. The Flow ability can fetch information from the user and pass it off to Flow.
Your Flow can interact with the user via the bot by posting messages, cards and asking questions.
It is possible to add multiple Flow's to a single bot. Just make sure the Keywords and Targets are unique enough for LUIS to determine which Flow to trigger.
Creating a Flow that can be triggered from a Flow ability
- Create a new Flow at https://flow.microsoft.com with a HTTP trigger
- The method should be POST; using other HTTP methods is not yet supported
- The request body schema should include a root object, with the properties that will be used in your flow
- You can use the schema generator to create this for you
- Create a new Flow Action to initialize the conversationSession variable
- Click 'Add dynamic content'
- Add the following expression:
- Create a new Flow Action to initialize the API Key
- Leave the value blank for now
Add Flow ability to a bot
- Create a bot
- Add a Flow ability
- Save the ability to generate an API key.
- Open up the Flow ability again
- Flow Endpoint Field - This is the URL generated by the HTTP Trigger of your Flow. Copy it from Flow
- HTTP Method Field - Leave this as POST
- Display Success and Error Fields can be used to control how messages are displayed to a user when a Flow is trigger
- API Key Field - Copy this value into your Flow's API Key initialize variable action. This is used when sending messages back to the bot
- Targets and Keywords can be configured the same as any other ability
- Conversational Parameters - The values to fetch from the user to pass to the Flow. The Variable Names need to match the variables added to the Flow's HTTP Trigger
- To configure how the bot prompts the user for a variable, click on the parameter row and enter the prompt into the Parameter Prompt field
- Form Based Parameters - These work essentially the same way as Conversational Parameters, however they are displayed as a form, rather than prompting the user
- Like the Conversational Parameters, the Variable Names need to match the fields entered into the Flow's HTTP Trigger
Post messages from Flow
- Add a HTTP Action to your flow
- The Method must be 'POST'
- The URI field for your environment will be one of the following:
UK South - https://flowability-prod-uksouth.azurewebsites.net/api/callbacks/message
East Us - https://flowability-prod-eastus2.azurewebsites.net/api/callbacks/message
West Europe - https://flowability-prod-westeurope.azurewebsites.net/api/callbacks/message
Australia - https://flowability-prod-australiasoutheast.azurewebsites.net/api/callbacks/message
- x-conversation-session header is the conversationSession variable configured earlier
- x-api-key header is the apiKey variable configured earlier
- content-type header must be application/json
- The Body field must be a valid json object with a message field and an attachments field.
- The message field expects a string message and is the text send to the user from the bot.
- The attachments field expects an array of attachments. These attachments are added to the message sent to the user.
- An attachment can be an adaptive card, a video, a file, or an image
There are different types of callbacks that can be specified as part of the URL back from Flow to the bot:
- callbacks/message - Post message
- callbacks/choicequestion - List of buttons
- callbacks/numberquestion - Number
- callbacks/stringquestion - Text
- callbacks/filequestion - Attachment/File
- callbacks/booleanquestion - Boolean