Supercharge Outlook with ChatGPT

Communicating and managing information through emails is a time consuming aspect of a lot of jobs. In the past there have been little, to no tools to reduce the time one spends drafting up emails, or processing information. However, this might be changing with refined GPT technology. In this blogpost I will explore how you can integrate ChatGPT with Outlook, and ultimately how it can positively impact your daily workflow. This is achieved through hosting a PowerApp in outlook through an Office Add-in.

Today, Viva Sales in Outlook is already integrated with ChatGPT technology, which you can use to draft replies to emails like this:

This is great, but some users (me), may find the functionality somewhat limited. I think there are many possibilities to explore on how one can utilize AI within Outlook. Especially since you can pass information to a wide range of Microsoft (and external) apps easily, by leveraging the Power Platform. A lot of these possibilities can also be integrated and combined into the same solution. I’ll start with a quick overview of the solution and how it’s setup. Thereafter, I’ll dive into how this can be a beneficial extension of Outlook. Note, in case you find the application’s setup uninteresting, I recommend clicking this link which takes you to the final part of the blogpost, where I demonstrate its practical usage 😊

1 PowerApp:

The PowerApp is a simple design in portrait layout, to optimally fit the email client. It’s equipped with a couple of labels to display the information from the email which is selected in Outlook. This information is passed as parameters from Outlook to the app , and handled like this in the labels:

Furthermore, I’ve added a popup to display the entire email body in a separate screen within the app.

Then there’s the next section, which is the prompt building part of the app. The prompt is constructed through selecting values from two dropdown menus.
The values in these dropdown menus are specified in two Sharepoint list, both of the dropdown values shown below correspond to a different set of entries in the same row in the lists. This is done to give the user a cleaner interface, where the person only sees a short description of the action that are Selected. By passing a connected value to the selected one, it adds more granularity to the prompt that are passed onto ChatGPT, along with the email body. Illustrated in the example below:

This is easily done with sending the prompt values from the SP lists over with this snippet, which is added to the onSelect property of the ‘Generate’ button in the app.


2 Flow

Firstly, the flow is triggered through the generate button in the PowerApps, which also sends the relevant information to the flow, which are placed in to variables. I remove the lineshifts from the body, since this generates a lof of ‘\n \r’, which may impact the performance of the model.

I’ve added a switch to differentiate between a couple of options.
The first option will pass a notification by mail, when selecting the option ‘Alert me in..’ and subsequently selecting the date and time you wish to be notified through a datepicker in the PowerApp. The second option is selected when I want ChatGPT to make a task list and export it to planner. Lastly, the main option is the one who will generate the bulk of the prompts. Here I connect to the OpenAI API (Note you can also do this through AI builder, which has ChatGPT functionality in public preview at the moment), this is quite easy to setup by passing the token from your OpenAI account, and calling the API like this:

Quick explanaition, this is a JSON object that sets up parameters for the “gpt-3.5-turbo” language model to generate text in response to a prompt. The prompt is specified in the “messages” field, with a maximum length of 700 tokens and a moderate level of randomness controlled by the “temperature” field, ranging from 0-2.

3 The Outlook Addin

In technical terms, the addin is programmed to host an iframe (basically a frame you can host webpages through) in Outlook which displays the PowerApp, and passes the relevant parameters from the email client to the app. I’ve got the inspiration from this blogpost by Mats Necker, where he gives a great explanation of the topic. There’s also some example code on his GitHub, which is a good starting point for building the add-in. I won’t be going into the details of this setup in this blogpost, since it’s quite lengthy. Therefore, I urge you to check out the post linked above if you’re curious about how this is setup.

Finally, how does this application work in practice?

I noticed that I had a shortage of emails to showcase here, so I asked ChatGPT to come up with a sample mail.

The app is started by hitting the OutlookAI (Office add-in) button marked in the picture below, and it pops out on the right side:

The results from the first set of prompts where I summarize the email, are quite good:

I was also pretty impressed by ChatGPT ability to convert the tasks into a JSON array which was thereafter passed into planner. To achieve this I had to change the 2nd part of my prompt (I might have hedged myself a bit here, but atleast it works)

I also adjusted the temperature of the model to 0.1 to get better results, this is the result:

At this point I feel like I’m just showcasing standard ChatGPT functionality, but it’s pretty cool that you can build the prompts like this and get the information straight into Outlook, to jump-start a new email for example.


By adding a PowerApp to Outlook you can create an effective process for utilizing GPT-technology to generate information that matches your needs, or pass data on-to different apps within the Microsoft ecosystem. Generating prompts through multiple dropdown menus are a valid way of engineering prompts, the benefit of this setup is that it lets you craft prompts through putting together building blocks. Some of the prompts/functionality could easily just been pasted into the ChatGPT session on your browser. However, the possibility to make more complex processes, where you include different applications is something that’s a huge benefit when you can setup an app like this. Which will let you streamline the process through the PowerPlatform, reference to my example with planner.

Drawbacks and further possibilities

First of, I made this to as a MVP to showcase the possibilities of a solution like this, so I could have went into more detail on how to engineer the prompts for example. One could also put in a freetext aspect here, to tailor the prompt to the exact email/request. Like mentioned above, you can use this process to add tasks, to for example planner. However, you can’t always be sure what information you get. So another avenue to explore here, could be to pass the information back from Power Automate where you could edit the data in the PowerApp before it’s passed onto different applications. As I stated in the introduction a similar feature are available in VivaSales. Although, when utilizing this feature you pay a flat monthly rate, so it could be more affordable for some users to have a setup like this, where you pay as you go. Anyway, hope you enjoy the blogpost, and that it inspired you to find new ways to utilize ChatGPT.