Create a ChatGPT in PowerApps

                 Create a ChatGPT in PowerApps             Create a ChatGPT in PowerApps

Before we begin, please note that the OpenAI GPT-3 API is a paid service, and you will need an API key to use it. You can sign up for the OpenAI API on their website.

Step 1. Create a Power Automate flow

First, we must create a Power Automate flow that will call the OpenAI GPT-3 API and return the response to PowerApps.

  1. In Power Automate, click "Create" in the top navigation bar and select "Instant - from blank".
  2. Give your flow a name and select "PowerApps" as the trigger.
  3. In the trigger configuration, select "PowerApps button" as the trigger.
  4. Add the "HTTP" action: In the Power Automate flow, configure a new "HTTP" action to send a POST request to your ChatGPT API endpoint. You must provide the message text from the Teams channel as a parameter in the request body.
  5. Next, add the PARSE JSON to convert the result to JSON format like below.
  6. Add the "Apply to each " - Post a message (V3)" action: Once you receive the response from the ChatGPT API, you can use the "append Variable- Post a message (V3)" action to send the response message back to the PowerApps.
  7. Save your flow.

Step 2. Create a PowerApps app

Next, we need to create a PowerApps app that will call the Power Automate flow and display the response from the OpenAI API.

  1. In PowerApps, click "Create" in the left-hand navigation menu and select "Canvas app from blank".
  2. Give your app a name and select your preferred layout.
  3. Add a "Text input" control to your app by searching for it in the left-hand panel and dragging it onto the canvas.
  4. Add a "Button" control to your app by searching for it in the left-hand panel and dragging it onto the canvas.
  5. Select the button control and go to the "OnSelect" property in the right-hand panel.
  6. Enter the following expression to call the Power Automate flow:
    Set(
        result,
        'Flow name'.Run(TextInput1.Text).Answer
    )
    

    Replace 'Flow name' with the name of the Power Automate flow that you created in step

  7. Go to the label where you want to display the result, so go to the item property and add the result.

This formula calls the "ChatGPT" flow and passes the user input as a parameter. It then extracts the response text and displays it in the label.

Create a ChatGPT in PowerApps

For more details on using the Microsoft Teams channel as a ChatGPT, please refer to the following link: https://www.c-sharpcorner.com/article/how-to-use-microsoft-teams-channel-as-a-chatgpt/