Hi, thanks for stopping by my github and checking out Teams OpenAI Converation Bot in C#! This project was inspired by the following three projects.
- SidU's Bot Framework GPT-3 demo
- leeford's Teams OpenAI Conversation Bot
- garrytrinder's DALL-E 2 Image Generator Bot for Microsoft Teams
I started this project because I wanted a similar bot in C#. This bot is using Betalgo.OpenAI.GPT3, the OpenAI .Net library developed by Betalgo.
This bot treats a message as a prompt. You can write your own, or simply try out a few from Awesome ChatGPT Prompts
- OpenAI account and API Key
- If you do not have your own Microsoft Tenant and Teams..
- Have a testing tenant (you can get one by signing up for the M365 Developer Program for free!)
- Run ngrok for the port 3978 (you can change the port number in launchSettings.json)
- Register your app that has the bot capability using Azure Portal & Developer Portal
- Register your app (in my case a simple bot) on AAD by following the instruction here: Register a new application
- Register your app to Microsoft Teams using Developer Portal.
- Get Application ID (Client ID) from the Azure Portal.
- Register your bot on Developer Portal.
- The bot end point is: [your ngrok url]/api/messages
- Save bot id & bot password somewhere as we will need them.
- Download the app's manifest as we will need it to sideload the bot.
- Visual Studio 2022
- Open the solution file in Visual Studio 2022.
- Update MicrosoftAppId & MicrosoftAppPassword in appSettings.json to be your bot id & password.
- Update openAiService.ApiKey to be yours in EchoBot.cs.
- Now hit F5 and run the bot.
- Go to your Teams and sideload your bot to any type of chat.
- Enjoy interacting with your bot!
To learn more about deploying a bot to Azure, see Deploy your bot to Azure for a complete list of deployment instructions.