Go to your bot.ts file and create and if/else statement.
Now let me explain what is happening now
First you need to import ActivityTypes class
The ActivityTypes class contain a list of possible events or actions that an input can be so under the activity type class one of the main and most used actions is Message which is basically most of the inputs a user will send to the bot.
You can read on ActivityTypes here on the Microsoft Docs
Now compile your code when that is done open your emulator and choose your bot, the response should be as shown below
Now we have successfully built the echo-bot all other information after here just explains what happened in the code..
Let me take your through what just happened in your code
When the app started
A request was sent to localhost:3078/api/messages which then detected which the detected the request as an event which then called the myBot.onTurn(context) which is the one that is found in bot.ts, that function in bot.ts classified context which is a fancy term for what you send to the bot be in a request or an event. Context is an object which contains everything you send along with other data such as its type and other meta data
When we get to more advanced cases we will be able to use the text part to call APIs or even start a series of dialog that the bot will have with the user
Well congratulations to everyone who suffered through this chapter in our bot series, in the next article we are going to learn able how to model chats with a nifty library called ChatDown. What ChatDown does is that it enables you make a prototype of what your bot will look like, which is basically one of the most important aspects of building a bot.
You can find the GitHub to this project here…
I hope the echo-bot annoys you enough to do more……..
🤣 Until the next time