Add Chat GPT to any Microsoft Teams Channel (in less than 10 minutes)

Mark Jones
August 10, 2023

ChatGPT by OpenAI has become an incredibly popular AI chatbot that can hold natural conversations and generate human-like responses on demand. So, I got to thinking the other day, and thought:

Wouldn't it be cool to turn a Microsoft Teams channel into a ChatGPT-like Chatbot so that anyone in the team could ask a question and everyone can see the answer?

If you want to understand what you're about to learn how to do, have a look at the image below. When you follow the steps below, anyone in the team can now go into the Channel and "talk" to Open AI (ChatGPT):

open ai answering in teams

open ai answering in teams

Before we get started, we have an entire host of Teams Training to propel your business into the future. Take a look at our training resources!

Why would you want to use Open AI (not the ChatGPT Web Client) in Teams anyway?

This is a great question and I am glad you asked! Here are a few reasons that come to mind:

  • Convenience of ChatGPT directly in Teams channels where work happens already.
  • Enables your entire team to share the ChatGPT's experience so you can comment and discuss the outputs you get.
  • You might want to implement a corporate policy that only allows "AI" to be used from one central point (i.e your Teams Channel). Having your company use Open AI from 1 Channel means you could log every prompt that gets sent and even add filters or business logic to sanitise the prompts.
  • Customise responses by wrapping the prompt with your own requirements. e.g You could add your own stipulations around the prompt sent to suit your organisation. e.g "Act as a company [insert role], us and complete the task below [insert prompt]"
  • Build automations and enhance functionality with Make.com. Make.com is really powerful and it's easy to extend this Workflow to add all manner of business logic, such as logging, using a vector database, filtering message, or sending the output to different endpoints such as "Email". The World is your Oyster.
  • Centralised control and security of your Open AI API keys vs giving individual accounts your API Keys.
  • No more copy/pasting content from ChatGPT into Teams. 
  • The Open AI API doesn't retain/learn from conversation data by default. (see their policy).
  • You can select specific Teams channels to use Open AI on, rather than having staff use the web client or every channel.
  • Overall, you get more control and privacy protection vs web access.

Let's use Make.com to build our Teams ChatBot.

With Make.com's easy no-code platform, you can build a workflow to connect Teams channels to the ChatGPT API. This allows anyone in your Teams channel to get AI-generated responses from ChatGPT right within your conversations!

In this step-by-step tutorial, we'll walk through:

  • Setting up a Make.com account and scenario
  • Connecting to a Microsoft Teams channel
  • Integrating the OpenAI API
  • Building the workflow to pass messages to ChatGPT and return the responses
  • Deploying the bot to start chatting!

Prerequisites

To follow along with this tutorial, you'll need:

  • A Microsoft Teams account with access to a team channel you want to connect.
  • A Make.com account. Sign up for free at make.com. You get 1000 operations a month on the free plan and then it's still really cheap.
  • An OpenAI API key. Register for one at openai.com. Again, this is pretty cheap when compared to Co-Pilot. 
  • Basic understanding of Microsoft Teams and Make.com.

Join 11,000+ in the Collab365 Academy

Master Microsoft 365, Power Apps, Power Automate, Power BI, SharePoint with Exclusive Access to 450+ Hours of Expert Training and a Wealth of Resources!

Step 1 - Create a New Scenario in Make.com

First, we need to set up a Make.com scenario for our ChatGPT bot. This is where we'll build and connect all the components.

  1. Create a free account and login to your Make.com account and click "+ New Scenario"
  2. Give your scenario a name like "Teams ChatGPT Bot".
  3. Click "Create Scenario" to initialise the workspace.

Step 2 - Add a Microsoft Teams Module 

Make.com has a built-in Microsoft Teams module that makes it easy to connect to channels in your Teams account.

watch for new channel messages

watch for new channel messages

  1. In the new scenario, click "+ Add a Module" and select "Microsoft Teams".
  2. Authorize Make.com to access your Microsoft Teams account when prompted.
  3. As a starting trigger add a new "Microsoft Teams" module and select "Watch Channel Message". 
  4. Select the specific Team and Channel you want to connect to for the bot. To test this you probably want to create a new Channel in Teams. 
  5. Set the "limit" to "1".
  6. Click "Add Module" to save your Teams integration.

Step 3 - Add the OpenAI Module 

Now we need to add Make.com's OpenAI module to get access to the ChatGPT API.

openai settings with content from teams message

openai settings with content from teams message

  1. Click "+ Add a Module" and select the "OpenAI" module.
  2. When prompted, paste in your OpenAI API key that you obtained earlier.
  3. Select the "Create a Completion.." Action.
  4. Select the ChatGPT model. (I chose "gpt-4", but other models are cheaper). 
  5. Set the Role to "User"
  6. In the "Message Content", I added "Please use the prompt below and format your response as HTML: "{{1.body.content}}"". (Note the "{{1.body.content}}" should be mapped from the Microsoft Teams message that just arrived. 
  7. Leave the default temperature and other settings for now.
  8. Click "Add Module".

Your Make.com scenario now has both Microsoft Teams and OpenAI integrated! Next we need to build the workflow between them.

Step 4 - Send the Open AI response back into Teams 

At the point, our scenario will receive a Microsoft Teams channel message, pass it into Open AI as a prompt and now we want to Reply back to the original Teams Message.

send message back to teams as a reply

send message back to teams as a reply

So let's do this: 

  1. Add a 3rd "Microsoft Teams" module to the scenario and select the "Reply to a Channel Message" Action.
  2. Select the Same Team, Channel as you did in Module 1.
  3. In "Message ID", map this to the "Message ID" that was returned from Module 1.
  4. And in "Reply Message" select to the output from Open AI and pick the Message.Content under choices (see image above).

That's it! Your Teams channel is now connected to ChatGPT through this automated workflow.

Step 5 - Start Testing and chatting with Your ChatGPT Bot! 

Head over to your Microsoft Teams channel and test out your new ChatGPT bot!

this is the final scenario

this is the final scenario

  1. Before you test your Bot, the default schedule that Make.com uses to "poll" for new messages is 15-minutes. You can go and change that to "Every 1-minute" (see red box above). Please note: I am looking into a more "immediate" way to trigger the flow so check back once I've worked it out 😀. You can also use "Run once" to force Make to run. 
  2. Now go and post a message in your connected Teams channel.
  3. The workflow will pass it to OpenAI, get the AI-generated response, and post the reply back automatically.
  4. Have a conversation with ChatGPT directly in your Teams channel!

To make the experience even smoother, you can change the trigger from "Manual" to "When a new message in channel" so it fires for every new message automatically.

And that's it! With just a few clicks in Make.com, you were able to add powerful ChatGPT capabilities to your Microsoft Teams collaborations.

Next Steps 

This tutorial showed the basics of integrating Teams and ChatGPT, but there's so much more you could do:

  • Persist conversation context and history across messages. This topic get's quite advanced and it requires vector databases, but i will start to look into it soon.
  • Direct message specific users when mentioning them.
  • Switch between different OpenAI models like GPT-3.5 Turbo.
  • Add sentiment analysis to detect tone and guide responses.
  • Post generated images and code snippets, not just text responses.
  • Leverage context from existing Teams messages for more natural ChatGPT conversations (I don't show this, but you could introduce more rules and triggers into the Make Scenario to achieve this).
  • And ... again, I don't show in this example, but you could pass in extra assets with the message like Word Docs. This would take some more processing in the Make.com scenario to extract the content and chunk it up, but all possible.

The possibilities are endless! With Make.com's easy no-code platform, you can customise and extend this integration to fit your unique needs.

Data Privacy Considerations

When integrating ChatGPT and passing messages via the OpenAI API, it's important to keep data privacy in mind.

OpenAI's API has robust data privacy protections and does not retain or train on your messages by default. However, since Teams conversations can include sensitive or confidential data, it's best to review OpenAI's privacy policies and consider any regulatory requirements before fully deploying such a bot.

For particularly sensitive Teams channels, you may want to avoid sending all content through ChatGPT or add additional controls like moderation. Make.com also allows setting up approval workflows and restricting which users can post bot responses.

While the OpenAI API provides strong privacy safeguards, you ultimately control what data gets passed through it. Assess your specific use case and what kinds of information get discussed in your Teams channels. Limit the bot's permissions and access as needed to protect sensitive user conversations.

With a little extra diligence, you can build this integration in privacy-conscious ways that balance utility and risk. Make.com gives you the flexibility to customise the solution to your needs.

Want to discuss this further?

I am always hanging out in the Collab365 Academy, so why not grab a free community account and leave a comment on this post?

Join 11,000+ in the Collab365 Academy

Master Microsoft 365, Power Apps, Power Automate, Power BI, SharePoint with Exclusive Access to 450+ Hours of Expert Training and a Wealth of Resources!