Click here to Skip to main content
15,799,257 members
Please Sign up or sign in to vote.
1.31/5 (4 votes)
See more:
I can't find an example project about bot and user conversation in C#.
Something like this:

Bot: What's your name?
User: Gin
Bot: How old are your?
User: 19
--bot get the awnsers and update to the database
Bot: OK. You're Gin and you 19y old.

Can you give me any examples?

What I have tried:

P/s: I using Telegram.Bot lib, and I can make a bot with basic command.
User: /UpdateMyName Gin
Bot: ---do the stuff

But I want a conversation, not just typing command
Updated 11-Aug-21 2:33am

1 solution

your problem can be solved using Microsoft Bot Framework.
you should try at least once.

Here are the steps.

Step 1: Firstly, you have to install some prerequisite software,
Visual Studio 2015 Update 1.
Also Update your all Visual Studio extensions through tools > Extensions and Updates > Updates.
Step 2: Download the Bot Application Template from the following link:
Bot Application Template.

Step 3:

The above link will download a ZIP File, just save that ZIP file in “%USERPROFILE%\Documents\Visual Studio 2015\Templates\ProjectTemplates\Visual C#".

Step 4: Now open your Visual Studio.

Step 5: Now create a new Bot project in Visual Studio. To create a new Bot Project, here are the steps:
First of all go to File, New, then Project or press CTRL +SHIFT + N.
Now one dialog box will open. From that select Visual C# Project and you will find an option Bot Application, choose that and give the name of the project.

Open Web.Config File, and give the AppId and AppSecret keys for your project. If you are running this project locally, then you can give any AppId and AppSecret.

like that

<add Key="AppID" vaule="CshrpDemoapp" />
<add key="AppSecret" value="DemoAppSecret" />


Step 6: Now if you expand your Controllers folder you will get only one Controller File that is "MessagesController",

you can see all use full Functions in MessagesController.cs

Now to emulate your application you have to open the Bot Framework Emulator. You can download Bot Framework Emulator from the following link.

I hope this will help you
Share this answer
Asif 7969814 11-Aug-21 8:13am    
Thanks. But I want to know is using Microsoft Bot Framework can create a Telegram Bot?
Ans. yes you can. see this like

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900