top of page


So today we will learn how to call ChatGPT in Power Apps in a simple way. All the steps are written below, and everything is explained with the help of screenshots.

To call ChatGPT in PowerApps, you first have to login in open AI to generate an API key.

Step 1: For this, we need to click on this open AI link and Sign Up with Microsoft/Google Email address.

Note: if You have done sign up then log in with your credentials.

Step 2: To generate API key- After logging in click on ‘Personal’ and go to View API Keys.

Note: You Can create a new secret key and can delete the previous key.

Copy your API key according to the screenshot above.

So, we are done generating the OpenAI API key.

Now, have to create a flow to call ChatGPT in PowerApps

Step 1: Open power automate in Microsoft 365 and select accordingly

My flows-> New flow-> Instant Cloud Flow

After selecting ‘Instant Cloud Flow’, give the Flow name and select the ‘PowerApps’ Trigger then click on Create button.

Step 2: Click on ‘New step’ and take OpenAI (Independent Publisher) connector.

So, for this search openAI in the search area then select OpenAI(Independent Publisher).

Step 3: After that give the API key and connection name in OpenAI (Independent Publisher) connector.

Note: API key must be entered as –Bearer YOUR_API_KEY.

After giving API key and connection name click on Accept button.

Step 4: Next, give prompt value from PowerApps trigger and give max tokens.

Step 5: The next step is to take ‘Apply to each’ action and select choices of dynamic content from GPT3 Complete your prompt.

Step 6: After that click on Add an action inside Apply to each action

Step 7: Next, take Compose action inside Apply to each action and give Text Dynamic content from GPT3 completes your prompt.

Step 8: Next, we need to send compose output to PowerApps using Respond to PowerApps or flow action.

Now, we have to call this openAI_access flow to PowerApps.

Step 1: Open PowerApps from Microsoft office365. Create one canvas app.

Step 2: Next, we need to add flow in the app so, click accordingly

power automate icon -> Add flow .->select your flow.

Step 3: next, to call flow add this code (Set(Gbl_respons,(If(!(IsBlank(TextInput1.Text)),openAI_access.Run(TextInput1.Text))));

If(IsBlank(TextInput1.Text),Notify("We are requested to enter question.. Thank You"));

)in buttom onselect property.

Step 4: After that to generate response from flow add this code (Substitute(Substitute(Substitute(Substitute(Gbl_respons.ans,"[",""),"]",""),"\n","<br>"),"\","")) in htmltext property.

Step 5: This is our expected output.

This was all about calling ChatGPT in PowerApps. Hope it was helpful and you enjoyed it.

Thank you!

For further queries or demo please comment below or contact us.

For any consultant/support work on O365/ development, contact us or visit our website

70 views0 comments


bottom of page