How to Use Chat GPT With Power Automate

Chat GPT is quickly becoming a must use tool for process automation and digital transformation. Not only can it help you build better process automate workflows, but you can also pass data into ChatGPT using Power Automate Desktop and Power Automate Flows.

How do you use Chat GPT in Power Automate?

There are currently 3 different ways to connect Power Automate to Chat GPT. You can use the OpenAI ChatGPT API or the Azure Cognitive Services API from Microsoft. You have to sign up for an account with either of the services, and use the HTTP request within Power Automate Desktop or Flows to send data to it. Then you can parse the response.

We won’t go into a ton of detail on this method, as both OpenAI and Microsoft Learn have some great articles setting people through the process.

Most people will also find that as of May 2023, Microsoft is making ChatGPT available as part of AI Builder. AI Builder is Microsoft’s easy to use low code AI platform. As with the Microsoft and OpenAI API’s there will likely be a price associated with the AI Builder implementation of ChatGPT but it’s an easy way to get started and to test out your process flow.

Can Chat GPT Write Power Automate Desktop Automations?

We asked Chat GPT if it could write Power Automate Desktop Automations and it gave us the following fairly generic answer. It’s a decent description of how an end user could create a simple Power Automate Desktop Flow.

Generated from Chat GPT:

Power Automate Desktop is a Windows application that allows users to automate repetitive tasks by creating “flows” that automate actions across their desktop applications and services. To create a flow in Power Automate Desktop, you will need to use the built-in flow designer and actions provided by the application.

Here’s an example of a simple flow that automates the process of opening a web page and taking a screenshot of it:

Copy code
1. Start by opening Power Automate Desktop and creating a new flow.
2. Drag the "Open URL" action into the flow designer, and configure it to open the desired web page.
3. Drag the "Take Screenshot" action into the flow designer, and configure it to take a screenshot of the active window.
4. Connect the "Open URL" action to the "Take Screenshot" action by clicking and dragging the arrow from the first action to the second.
5. Save the flow and run it to test the automation.

This is a very basic example and Power Automate Desktop have many actions that can be used to automate a variety of tasks, such as interacting with Excel, sending email, running commands in PowerShell, and many more.

It’s important to note that Power Automate Desktop is a Windows-only application, it does not run on Mac or Linux.

-OpenAI, Chat GPT

How do you get Chat GPT to Generate a Full Automation script?

It’s great that Chat GPT can describe a workflow for you, but we want it to do all of the work. The first thing to understand is how to import scripts directly into Power Automate Desktop. It’s a little bit different of an RPA tool as it does not let you copy and paste python scripts directly into it like some other RPA solutions will let you.

Next, we asked if scripts could be imported into Power Automate Desktop and received the following response.

Generated from Chat GPT:

One way to do this is by using the “Run PowerShell” action, which allows you to run PowerShell commands or scripts within a flow.

Here’s an example of how you can import a PowerShell script and use it within a flow:

  1. Start by creating a new flow in Power Automate Desktop.
  2. Drag the “Run PowerShell” action into the flow designer.
  3. In the “Run PowerShell” action, click on the “Import script” button and select the PowerShell script you want to import.
  4. Once the script is imported, you can configure the script arguments and options as needed.
  5. Connect the “Run PowerShell” action to the next action.
  6. Save the flow and run it to test the automation.

-OpenAI, Chat GPT

It’s actually a fairly interesting workaround, but also defeats the purpose of using a tool like Power Automate Desktop. Instead of using it to generate a script, it’s merely launching Power Shell, which you could do in a number of different ways and exclude the use of Power Automate Desktop altogether.

However, if you’re interested in how to scrape websites with Power Shell, the folks at Oxylabs have a great overview of the topic available here: Web scraping with PowerShell: The Ultimate Guide | Oxylabs

Can Chat GPT Generate PowerShell Scripts?

Yes, you can use ChatGPT to write Windows PowerShell scripts. Open a new instance of Notepad, prompt ChatGPT to write the script that you want and save it as a .ps1. ChatGPT can also write batch files.

If you’re using it for scripting, you will likely need to modify the script to have your exact file paths. Sometimes you can copy and paste a file path into the prompt and ask ChatGPT to use it in the code. Otherwise you will need to update it for your specific use case.

As a separate test, we asked ChatGPT to write a script to add all of the contents of a folder to a .rar file. Using GPT-4 it understood the specific syntax that WinRar has in their documentation to execute the automation and wrote the appropriate code.

We find the most difficult part is describing exactly what we want in our automation flow.

Will Chat GPT be able to Generate Power Automate Desktop Scripts in the Future?

Microsoft announced Describe it to Design it back in October 2022. Describe it to Design it is by far the fastest way to build out Power Automate Flows.

The service is Microsoft’s way of integrating ChatGPT to take text input describing a process you want to automate and converts it into a Power Automate Flow. The screenshot below is using Power Automate Flows to suggest a workflow that will allow you to automate the saving of attachments from Gmail to a OneDrive Folder.

Screenshot of Power Automate Flow Describe it to Design it.  Creating a flow to save attachments from Gmail toa OneDrive Folder

The feature is free to use, as part of your Power Automate Subscription. After accepting the workflow suggestion, the next steps prompt you to enter in your credentials and log into each of the services. The flows that it recommends are not 100% automations. We found that a lot of them will get you to 90% but then you have to configure some of the specific settings for each of the steps.

Microsoft shared some interesting statistics on the progress of Describe it to Design it on the Power Automate blog in April of 2023. The model behind Describe it to Design it is consistently being fine tuned based on user feedback.

Users who opt into sharing their data with Microsoft will send information back into the model. In the month of March 2023, they had over 29,000 people try out the feature and help train the model.

Another interesting note was that 76% of flows created using Describe it to Design it ran at least once in the subsequent 7 days compared to 43% when a user built their own flow from scratch.

This last part is the most fascinating because not only are the Power Automate Flow suggestions improving over time, but users are actually using AI generated automations more often than when they have to build them.

Creating Power Automate Desktop Automations using Describe it to Design it will be more difficult

Microsoft likely started with introducing text to automation script in Flows because it’s a closed environment. Power Automate Flows use a pre-made API connections to pass data from one step of the workflow to another. The Microsoft API’s generally work the best when making flows because they are the best documented and most widely used.

The more that a connection is used, the better training data that an AI powered bot will have to improve the results over time. Power Automate Flows are also a closed environment, which means that there are less possible workflow failures that can occur. If you’ve ever created an RPA flow in Power Automate Desktop or another solution like Automation Anywhere, a majority of time will be spent handing exceptions. An AI powered RPA solution would also have to cope with figuring out how handle these.

The Windows platform has countless applications available that have been published over decades. Many desktop RPA use cases center around outdated software that has thin documentation available online. The lack of documentation makes us wonder if AI could be trained on the instruction sets to interaction with these pieces of software.

AutoGPT may be the next evolution of process automation

AutoGPT is a project that loops ChatGPT output back into an input. There are a handful of similar tools being launched recently. The idea behind the method is that you can give ChatGPT a goal, and then it will continuously attempt to achieve that goal. When it fails, it will use that feedback to adjust then try again.

If ChatGPT were able to interact with a robotic process automation (RPA) tool like Power Automate, you could potentially prompt it do something like, run all of the reports out of Microsoft Dynamics Report Manager 2008 and save them to a network folder. If enabled within a sandbox, the AI powered bot could guess and check its way through the correct combination of clicks and buttons until it found a working solution.

The technology for full automation is likely a ways out. A bot would need to understand error handling and have a basic idea of how a system works. However, there are systems in RPA that will record clicks and capture screenshots of people performing a process. With ChatGPT-4’s ability to interpret pictures, it could be enough of a starting point for the bot to build out an RPA automation on its own.

ChatGPT Plugins Could Make Automations Unecessary

In its current form, ChatGPT can be accessed through the web or by sending and receiving information to and from an API. ChatGPT Plugins are a game changer that will allow ChatGPT to directly interact with other systems.

Plugins are currently in limited beta, and OpenAI is being very careful about which systems ChatGPT is able to access and control. In one example, they asked ChatGPT to provide a recipe for dinner. The chatbot suggests a recipe, then connects to Wolfram Alpha (a math and analytics software) returns the estimated calories that they dish will be. Then the app launches the Instacart App, adds the ingredients to a shopping cart and orders them to be delivered to your home.

It’s a revolutionary leap beyond what can be done in Describe it to Design it, Power Automate and competitors like Zapier. We will be keeping an eye on plugins and will be excited to see when the technology is released to a wider public.

Copilot 365 will mitigate the need for RPA

As Microsoft aggressively integrates OpenAI Chat GPT technology across its Power Platform and Microsoft Office Suite the need for RPA solutions will become less necessary. Microsoft Copilot 365 will integrate ChatGPT style functionality into products that millions of businesses users interact with every day.

For example, instead of needing to have an in-depth understanding of how to create a pivot table or chart, a user can prompt Copilot to create a chart for them, create a summary table, or even ask questions about the data that the report is based on.

Start Using Chat GPT for RPA today using Python or JavaScript

While there are some incredible features coming down the pipeline that promise to make the job of automation processes easier, you can begin using ChatGPT today to write Python and JavaScript.

Any RPA solution that has the ability to run custom scripts will also allow you to utilize Chat GPT to generate code that can be ran as part of a larger process. For example, solutions such as RoboCorp or other Open Source RPA solutions could save you some money for simple tasks and avoid Microsoft Licensing.

It’s also worth noting that OpenAI, the developers of ChatGPT have been experimenting with allowing ChatGPT to write its own Python code as part of the ChatGPT plugins. It currently writes and executes code within a sandbox that is not connected to the outside world. They have not provided much detail as to how successful the project has been and are likely going very slow to ensure the solution meets their quality and safety standards.

This year and the coming years will be truly exciting to see how ChatGPT continues to progress and help people automate processes, or entirely eliminate the need to do so.

Related Posts

Scroll to Top