QimTech

Microsoft and OpenAi: How to integrate ChatGPT into Teams?

Since its launch in November 2022, the ChatGPT phenomenon has been acclaimed for its impressive natural language processing capabilities. Developed by OpenAI, a global leader in artificial intelligence, ChatGPT uses machine learning to generate quality responses from human conversations.

In parallel, Microsoft’s Redmond firm officially launched its Microsoft 365 Copilot on March 16, 2023. It is an AI assistant based on OpenAI’s GPT-4 language model and integrated with the Office applications suite, including Word, Excel, PowerPoint, Outlook, and Teams.

The collaboration between ChatGPT and Microsoft has recently made headlines. Microsoft announced plans to invest $1 billion in OpenAI to develop a new generation of AI technologies for Microsoft 365 Copilot.

But as we write this article, Microsoft has yet to announce an official release date. As you can imagine, the entire Microsoft community worldwide is eagerly awaiting the release of Microsoft 365 Copilot!

At Qim info, we decided to take a step ahead of Copilot by giving you what we think are the possibilities of integrating ChatGPT into Microsoft Teams via Power Automate.

But what is ChatGPT?

Before getting into the heart of the matter, let’s dive into the context and what ChatGPT is:

  • An AI-based chatbot developed by OpenAI that can answer any question.
  • A chatbot capable of understanding natural human language and generating highly accurate written texts.
  • This is the latest evolution in text-generating AI.
  • GPT stands for Generative Pre-Trained Transformer, a language model trained on a large database.

More information:

    • ChatGPT is not connected to the internet.
    • The current most widespread and free version is based on GPT-3, and its knowledge stops in 2021.
    • But ChatGTP-4, the latest version, was released on March 14, and this version will power Microsoft 365 Copilot.

Why is this so interesting?

ChatGPT is seen as a personal assistant that can help us in our daily tasks thanks to the following:

  • In-depth comprehension, not only of natural human language, but also of computer development languages.
  • Solving development problems: ChatGPT can understand and produce code but can also debug code.
  • Searching for information,
    g., help with implementing a solution
  • Help with writing (articles, letters, offers, and more)
    ChatGPT is available to developers and IT professionals but can also assist different professions within a company (sales, HR, Finance, etc.).

ChatGPT in Microsoft 365

ChatGPT will be integrated through Copilot into the Office applications suite—Word, Excel, PowerPoint, Outlook, and Teams. As of today, we have yet to have an exhaustive list of the features that Copilot will offer. Nevertheless, Microsoft announced that the ChatGPT assistant would be integrated into the Power Platform applications suite. We can therefore imagine applications to automate repetitive tasks, create chatbots, and move from an idea to a functional application in record time.

ChatGPT in Teams

This is the heart of our subject: How can ChatGPT work with Teams?
The answer to this question is not unique and can be answered by more or less complex solutions.

For our part, we will use Power Automate to create a flow from a Teams discussion. This stream will query the ChatGPT API, retrieve the response, and feed it into the original discussion.

As such, we can imagine that ChatGPT could be a virtual member of a team of developers who collaborate from the Teams platform. Using a trigger like “Hey, ChatGPT!” Any team member can ask questions in the Teams discussion thread at any time and instantly receive an answer and resolution to a problem related to a piece of code.

How about implementation?

First, you need to create a new Teams team or use an existing one, then create an account on Openai.com.

Step 1: Create a new team in Teams.

In this example, we will choose POC ChatGPT as the team name that we will use in the General channel. You can create a specific channel if you wish.

Step 2: Generate a new API Key on the openai.com website.

  • Open the link openai.com
  • Create an account
  • Go to Personal and then to View API Keys
  • Click on Create new secret key
  • Copy the Secret Key that will be used later in Power Automate.

Step 3: Create a new workflow in Power Automate.

  • Create an Automated cloud flow
  • Name your workflow
  • Choose Microsoft Teams as the stream trigger: When Keywords are mentioned
  • Create the flow

Step 4: Set up a workflow

  • Fill in the fields as shown in the screenshot.
  • The Keywords to search for will be the keyword that will trigger the ChatGPT request.
  • Then click on New step
  • Choose the Microsoft Teams connector
  • Choose the Get message details action
  • Add Message ID in the Message field

Previous slide
Next slide
  • Fill in the fields as shown below.
  • For the Parent message ID field, choose Reply to message ID
  • Click on Add an action
  • Configure the query:
  • Choose an HTTP action.
  • Fill in the fields with the following information:

https://api.openai.com/v1/completions

“Content-Type:
application/json”

“Authorization:
Bearer YOUR_API_KEY

{
“model”: “text-davinci-003”,
“prompt”: “BODY CONTENT“,
“temperature”: 0,
“max_tokens”: 2000
}

  • Finally, create a new Ms Teams connector.
  • Then create a new action Reply with a message in a channel
  • Fill in the fields as shown in the screenshot.
  • For the last Message field, insert the following expression:

    body(‘HTTP‘)[‘choices’][0]?[‘text’]

Step 5 : save and test.

Conclusion

Integrating ChatGPT into Teams is one of the solutions that can be implemented and made functional within any organisation, provided that the appropriate M365 licenses be available. The upcoming M365 Copilot will natively integrate ChatGPT-4 into Teams, with many features planned for virtual meetings. But it remains to be seen if, as we have just seen, Copilot will offer this virtual assistance functionality within a Teams team!

You may also be interested in these news...