Hello Friends

The first thing you need to know about telegram bot and C# in this blog, that receives and sends data between the two, is Json. The first step is to create bot in Telgram. So in Telegram Address Bar type @FatherBot,

And Create your Bot

Now, Open Visual Studio=>Create c# Project

And Install Telegram.Bot API Class Library From Nuget.Org

Use This Method

  1. public async void MyRobat()
  2. {
  3. TelegramBotClient bot = new TelegramBotClient("Your Bot Token");
  4. var rkm = new ReplyKeyboardMarkup();
  5. rkm.Keyboard =
  6. new KeyboardButton[][]
  7. {
  8. new KeyboardButton[]
  9. {
  10. new KeyboardButton("item"),
  11. new KeyboardButton("item")
  12. },
  13. new KeyboardButton[]
  14. {
  15. new KeyboardButton("item")
  16. }
  17. };
  18. await bot.SendTextMessageAsync(lastIp.Message.Chat.Id, "Text", false, false, 0, rkm);
  19. }