Image showing an office working talking to ChatGPT on Microsoft Teams

How to add ChatGPT to Microsoft Teams

March 11, 2023

What is ChatGPT and why would you add it to Microsoft Teams?

As remote work continues to be a part of our daily lives, collaboration and communication tools such as Microsoft Teams have become more critical than ever. One of the most useful features of Teams is the ability to add bots, which can automate routine tasks and provide quick access to information. In this article, we'll show you how to add ChatGPT to Microsoft Teams via API, so you can get quick and accurate answers to your questions.

Adding ChatGPT to Microsoft Teams can be a game-changer for organizations looking to improve their communication and collaboration capabilities. With ChatGPT, businesses can streamline their workflows, enhance their customer service, and increase productivity. The ability to access AI-powered language models directly within Teams can lead to more efficient and effective communication, as well as greater insights and analytics on messaging data.

Before we dive into the technical details, let's introduce the author of this article - iTecs.

iTecs is a technology consulting and services firm that specializes in cloud computing, cybersecurity, and digital transformation. With over 20 years of experience in the IT industry, iTecs has helped numerous organizations to modernize their IT infrastructure and improve their business processes.

Now, let's get back to the main topic. ChatGPT is a language model developed by OpenAI that can generate human-like responses to a wide range of questions. By integrating ChatGPT with Microsoft Teams, you can provide your team members with instant access to this powerful AI tool.

Here's how to add ChatGPT to Microsoft Teams via API:

Step #1

You'll need to obtain your OpenAI API secret key. To do so goto beta.openai.com and create your secret key. Make sure that when the key is created you immediately copy it to a secured location.

Step #2

Head over to the Microsoft Power Automate and follow the instructions below.

  1. CREATE an Automated Cloud Flow
Image showing the first step in adding ChatGPT to Microsoft Teams

  1. Name your new FLOW whatever you want and utilize the "When keywords are mentioned" trigger.
Image showing step2 of adding ChatGPT to MS Teams

  1. Message type choose CHANNEL.
    Keywords to search for is the trigger word that MS Teams will monitor. So you can use anything you want here.
    Under Team you will select an existing "Team" where you want the AI to reside.
    In the Channel - 1 drop down box, you will choose an existing channel that's in the "Team".
Step4 image of adding ChatGPT to Teams

  1. Next add a new step in your flow called Apply to each and copy the settings in the screenshot below.
    Note: In the last field, Parent message ID the value you choose is "Reply to message ID"

  1. Add a new step in the Apply to each flow called "HTTP" and copy the settings in the screenshot below.
    URI = https://api.openai.com/v1/completions

    Under the Authorization section you add "Bearer <followed by your secret key copied earlier>"
    Note: in the screenshot the "sk-" is part of iTecs's secret key.

    Under Body add the following:

    {
     "model": "text-davinci-003",
     "prompt": "@{outputs('Get_message_details')?['body/body/content']}",
     "max_tokens": 2000,
     "temperature": 0
    }

  1. Add the last section in this flow called Reply with a message in a Channel and use the settings shown in the screen shot below.


    Message ID value is "Reply to message ID"

    In the Message field the following code is used (copy/paste it in yours):

    body('HTTP')?['choices'][0]?['text']

Last step in the adding ChatGPT to Teams image

Step #3

  1. Don't forget to SAVE your new flow and TURN IT ON 

Turn on your new flow image

  1. Open Microsoft Teams, goto the Teams section, and click on the Channel you specified in Step #2. sub step #3.
  2. Test your flow by asking the AI to answer a question using the Trigger Keyword specified in Step #2. sub step #3.

If you're a business looking to integrate ChatGPT into your organization, it's important to work with a trusted partner like iTecs. With our expertise in IT consulting and implementation services, we can help you seamlessly incorporate ChatGPT into your existing Teams environment. From customizing ChatGPT to meet your specific needs to providing ongoing support and training, iTecs can ensure a successful rollout and adoption of this powerful tool.

Don't miss out on the benefits of ChatGPT for your organization. Contact iTecs today to learn how you can start leveraging the power of AI to transform your business communications.

Published by,

Latest Posts