How To Integrate ChatGPT With Microsoft Outlook Using Power Automate

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] thank you hello everyone Henry from Enterprise DNA here in this video we're going to look at how to integrate Chachi VT with Outlook using power automate and here's the use case let's say you're a customer service associate and you perceived emails like this all the time and these emails are really long and hard to read They're not organized in a way that emails should generally be organized for example here the person wants to basically get us some assistance with their order so they give the order ID but that's over here the vendor is over here the order date is over here it's not organized in a night and easy fashion you even have the vendor's name here for example and there's a lot of fluff in this email that you really just don't care about now it's okay if it's a one-time use case but let's say if you receive 10 20 50 100 of these emails every single day and you have to take some action on it it's very hard to go through this email and summarize it and get the most important information however for chat GPT this is a complete Breeze so what people generally do here when they use chat GPT is they take the email they copy it then they go to their chat GPT interface and over here they type in a prompt for example I've already typed in the prompt take the following email and give me the key action items from it and extract the important information so I'll just paste the email here and then chat GPT will go ahead and do its thing and what's nice about it is that I'll give you the key action items you need to take from this email but the nice thing about it is it also gives you the most important information as well for example you know that they purchased a product from Bumblebee the order ID the date that it was ordered on and really that's the most important thing that you need to know as a customer service associate so it's very nice because you can quickly see what they're trying to do and what you need to do to basically address this email which is send an email to the vendor provide assistance and respond to Jeffrey's email in a timely manner it even gives you more information as to the fact that Jeffrey has attempted to contact bumblebee directly and that he's feeling drained and exhausted and that's great that's a perfect use case of chat GPT but you can see here that it's kind of annoying to do this copy and paste for every single email instead what we can do is we can use power automate to automate this process and make it a lot easier for you to use chat GPT and in fact you can do this in a way where you stay within Outlook I don't have to flip between different tabs so let's go ahead and do that the first thing we need to do is we need to use open ai's API and understand how it works so I've created my own API key already I'm then going to go to API reference and if you go over here to uh let's see completions because this is a completion model you can get a sense of how to actually make a completion request using the API over here what you can do is you can copy the actual example request and then let's go to postman to actually execute the request to see what it looks like so I'm going to click import when I'm in Postman and I'm going to paste the curl text in here and it's just going to basically Import in the API for me which is very nice if I go to headers there are two things I need to fill out first I need to fill out the content type which is application Json but I also need to fill out the open API or sorry the open AI API key which again I got from the previous page over here so I'm just going to go ahead and fill that in and I'll do that for myself but again every person has a different authorization key that you need to know okay so let's go over here paste that in here perfect now if we go to body there's a few things we need to kind of put down we need to put down the model we need to put down the prompt we need to put down the max number of tokens and then we need to put down the temperature okay so the prompt is simply equivalent to what you put in over here okay so just to make sure that the connection works properly what I'm going to do over here is change this prompt to say something like create a song for me about flowers in the ring okay I'll give it a Max token count of 600 tokens are basically a way to tell chat GPT how many how much currency or how many words do you want the response to be okay let's go ahead and click Send we should make the temperature one as well but that's okay and there we go we actually get text back in the form of a Json but you can see over here it actually did the completion prompt it says your flowers in the rain so beautiful and Serene sight so divides whatever what uh whatever uh the slash n is just to indicate that there's a new line but this worked exactly the way we wanted it to work so we know that the API is working and can be accessed using Postman now that we know this works we can then go to Power automate and start building the actual flow itself we are going to create a new flow and it'll be an automated Cloud flow because it'll be triggered with the receipt of an actual email itself so we'll go over here and we'll go to the Outlook connector and we'll select Office 365 Outlook it'll then do its thing and what we want to do over here is we want to do we want to say when a new email arrives okay perfect now that it's signed and we're going to go to Advanced options and we're going to go over here and we're going to only apply this rule for a subject that is very rare right we want to look for the specific string so we're going to say over here chat GPT please summarize okay so now the use case here is whenever I receive an email like this I can forward it to myself basically with this subject filter or with this subject it'll actually then start the flow for me okay perfect the next thing I'm going to do is I'm going to make an HTTP request so I'm going to go over here and select uh http and I'm basically going to copy the exact settings that I had made in Postman so the method will be post the URI over here was this API slash completions uh the headers over here we need to copy those as well so we need to copy the content type let me get out of this one over here perfect the content type which is the application Json perfect as well as the authorization which is your secret key okay perfect you then need to enter the body uh which contains the actual request that you want to make of chat GPT so I'm just going to paste that in here however the prompt is not going to be create a song for me about flowers in the rain it's instead going to be well the first thing at least it's going to be is um take the following email and give me the key action items from it so I'm just going to copy this guy here and paste it here uh and then I'm going to put a colon and then I'm actually going to go to my Dynamic content and basically provide the body I'm just going to make sure I don't need to do anything else here yeah perfect so I'm going to give it the body of the message whoops not over here it's supposed to be over here where the colon is body perfect and the max tokens here I will put in as 4000 and if I basically go to the documentation or the API reference and look at the different models uh that I have access to let me see over here true okay perfect okay uh that's it right there the next thing we need to do is we actually need to parse through the Json request that we get back okay so I'm going to go to parse Json and I need to generate the schema and I can actually generate the schema from an example so I know what the receipt of the API looks like it looks like something like this so I'm just going to copy this I'm going to paste that in here and this is just so that power automate knows what the response of this HTTP request looks like because it needs an example he needs to know what it looks like in order for you to reference those variables later on in the flow okay the content of this will be the body output of this HTTP request perfect we are almost there okay the last thing we need to do is we need to go to back to our Outlook and let's see over here export email flag email get contact at contact your reply to email the message ID that we're that we're replying to is the same message that actually triggered this flow so we can just find that in here message ID perfect the body of this email will be equal to the text Json element of the output of the HTTP request so if I go over here to parse Json I can see text I'm going to put that guy in there and the reason why it gives me multiple apply to each because technically you can have multiple text properties although we're actually not going to have that because this is a completion request not a image request but that's why you get the apply to each but you don't need to worry about it because it will only be applied once okay perfect so far so good let's go ahead and actually save the flow and now we will test it by clicking test and then selecting manually perfect so now we actually need to execute this flow and what we'll do is we will go back over here we'll get the email that we received we will then forward it to ourselves just to trigger this to occur but basically what will happen over here is let's say if we receive an email like this and we want to summarize it we're going to forward it to ourselves and we're going to take a subject and just add that one string to it okay we're then going to select sent and it should trigger the flow anytime now but again the use case here is if you ever get an email like this you don't need to go to chatgpt instead you can forward it to yourself and just add that subject line to it and perfect look at that looks like the flow succeeded because what we got instantly afterwards is we got a message from ourselves again that basically says here are the key action items uh perfect right over here is of course a refund with a vendor for a faulty product with order ID 556781 purchase blah blah blah ask for assistance and so on and so forth okay now technically what we need to do is we actually need to have a fail condition for this automate flow because it will just keep going and going and going infinitely but there we go those are the basics of how to basically use power automate with chat GPT and Outlook and you can have many different use cases here right because once you have the chat GPT API working in power automate you know that power automate can connect to all of these different connectors so whereas we just created a very simple summarization bot that someone can use you can create a whole host of other things that not only interact with Outlook but also with things like power bi power apps and all of these amazing connectors like even SQL Server YouTube Gmail Twitter everything you can imagine okay there we go awesome thanks everyone hey everyone Thanks for tuning in to Enterprise DNA TV if you enjoyed the contents covered in this particular tutorial please throw the video a like it really helps us and we really appreciate it also don't forget to subscribe to the Enterprise DNA TV channel we have a huge amount of content coming out all the time from myself and a range of content creators all dedicated to improving the way that you use power bi and the Power Platform lastly check out Enterprise DNA's website Plenty of resources and further learning that you can access very easily all the best take care [Music] [Music]
Info
Channel: Enterprise DNA
Views: 24,940
Rating: undefined out of 5
Keywords: Power BI, Power BI DAX, Enterprise DNA, Power BI Tutorial, Power BI tutorial for beginners, DAX Tutorial, DAX tutorial for beginners, power BI desktop, power query for power bi, learn power bi, learn dax, learn Power Query, M language, Power Query M code, Sam McKay
Id: ZQWfDfCkWno
Channel Id: undefined
Length: 14min 28sec (868 seconds)
Published: Fri Mar 31 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.