To configure a chatbot in PowerApps, you can follow these steps:
-
Create a new app in PowerApps and select the Canvas App option.
-
Add a Text Input control to your app screen and set its Mode property to Multiline. This will enable users to input multiple lines of text in the chatbot.
-
Add a button control to your app screen, which will be used to submit the user's input to the chatbot.
-
In the OnSelect property of the button, add the following formula: ClearCollect(Messages, {Text: textInput1.Text, IsFromUser: true})
. This formula creates a collection called "Messages" and adds the user's input to it as a new record.
-
Add a Data Table control to your app screen and set its Items property to the "Messages" collection that you just created.
-
Add two columns in the Data Table control: one for the user's input (Text) and one for the chatbot's response (Response). Set the Text column's Data Type property to Text and the Response column's Data Type property to Record.
-
Add a new button control to your app screen, which will be used to send the user's input to the chatbot and get the chatbot's response. In the OnSelect property of this button, add the following formula:
ClearCollect(Messages, {Text: textInput1.Text, IsFromUser: true});
Clear(textInput1);
Patch(Messages, Defaults(Messages), {Response: Office365.SendText(Messages[@Text])})
-
This formula sends the user's input to the chatbot using the Office365 connector's SendText function, clears the text input control, and adds the chatbot's response to the "Messages" collection.
- Save your app and test it out. You should be able to input text into the chatbot, send it to the chatbot, and receive responses from the chatbot in the Data Table control.