Skip to content

bigyunicorn/teams-openai-bot-csharp

Repository files navigation

Teams OpenAI Conversation Bot in C#.

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.

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.

Just send a message as a prompt!

This bot treats a message as a prompt. You can write your own, or simply try out a few from Awesome ChatGPT Prompts image image

How to try out this bot

Prerequisite

  • OpenAI account and API Key
  • If you do not have your own Microsoft Tenant and Teams..
  • 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

Set up

  • 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!

Deploy the bot to Azure

To learn more about deploying a bot to Azure, see Deploy your bot to Azure for a complete list of deployment instructions.

Further reading

About

This is a very simple Teams Bot in c#/.net

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published