Configure A Chatbot In PowerApps

To configure a chatbot in PowerApps, you can follow these steps:

  1. Create a new app in PowerApps and select the Canvas App option.

  2. 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.

  3. Add a button control to your app screen, which will be used to submit the user's input to the chatbot.

  4. 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.

  5. Add a Data Table control to your app screen and set its Items property to the "Messages" collection that you just created.

  6. 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.

  7. 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])})
  8. 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.

  9. 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.

HCL Tech
HCL Tech