ChatGPT With Microsoft Teams
ChatGPT is an artificial intelligence chatbot powered by natural language processing (NLP) technology. It is designed to provide an interactive and engaging experience for users by understanding their questions and providing relevant answers. ChatGPT is capable of understanding and responding to a wide range of topics, from general knowledge to specific topics. It can also provide personalized recommendations based on user preferences.
“It’s crucial to understand that the API relates to GPT-3, not ChatGPT, which leverages OpenAI’s GPT-3.5. For those who frequently use ChatGPT through the web interface, it’s worth noting that the API may have some limitations to be mindful of. However, as heavy users of Teams, it’s convenient to be able to quickly ask simple questions through ChatGPT.”
Credit To – Adam deMont for this solution.
How to Add ChatGPT to Microsoft Teams
Requirements:
- Create an OpenAI account.
- Power automate premium license ( if you don’t have a license you can use it with the Trial version)
create an account in openAI.
after you sign in go to > view API keys and create a new secret key.
click on – “Create new secret key” and keep your private key recommended for backup. if you don’t remember just create a new secret.
go to > PowerAutomate > Create > Automated cloud flow
Choose flow name – Example – ‘TeamsChatGPT’.
for the ‘Flow trigger‘ choose “when keywords are mentioned” and click create.
- Message type: Channel
- Keywords to search for: ChatGPT
- Select the Team and Channel you want users to be able to submit questions into to get responses from ChatGPT
click on + ‘Add an action‘ choose ‘apply to each‘
select ‘value‘ and click on ‘add an action’
choose “Get message details”
- Message: Message ID
- Message type: Channel
- Select your Team and Channel
- Parent message ID: “Reply to message ID”
select action ‘HTTP’
- Method: POST
- URI: https://api.openai.com/v1/completions
- Headers: Accept: application/xml
- Headers: Content-Type: application/json
- Headers: Authorization: Bearer <API_key_goes_here>
Example – Bearer vvkoh5lqOPAGT2452342343BlbkFJPjHIFHXyRVdqLBCZABrl522526w2
- Body:
Note–
when you copy the JSON maybe it will change the quotes to curly quotes.
they should be straight.
{
"model": "text-davinci-003",
"prompt": "@{outputs('Get_message_details')?['body/body/content']}",
"max_tokens": 2000,
"temperature": 0
}
after you finish add the last action.
- For the final action, choose ‘Reply with a message in a channel’
- Post as: Choose Flow bot or User
- Post in: Channel
- Message ID: @{items(‘Apply_to_each’)?[‘replyToMessageId’]}
- Select the same Team and Channel as the trigger
- Message: Use the expression body(‘HTTP’)?[‘choices’][0]?[‘text’]
when you are done implementing the flow save the flow and try to run it from the channel.
At the beginning of this flow, we create “keywords to search for” for example, I use – ‘ChatGPT’
Test
“Hey ChatGPT, what the capital of Israel is?”
“Hi ChatGPT, please write me a script in PowerShell to enable phone numbers for multiple users.”
