Echo Bot is a simple chatbot that returns back everything the user entered in the chat.
If you want to check default generated readme file, check this: https://github.com/Dacili/EchoBotLatest/blob/master/README1.md
You need to install Visual Studio extension Bot Framework if not already:
Create new project in Visual studio, and select Echo Bot project.
![](https://private-user-images.githubusercontent.com/37112852/269921722-1349c0d7-8b24-4d3f-8201-5a13564f7269.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ3MzkwOTksIm5iZiI6MTcyNDczODc5OSwicGF0aCI6Ii8zNzExMjg1Mi8yNjk5MjE3MjItMTM0OWMwZDctOGIyNC00ZDNmLTgyMDEtNWExMzU2NGY3MjY5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI3VDA2MDYzOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTM1ZDE2MTg5NzBkZTM4MjJkNWRhYjNiMzg5MDc2M2RiODJmMjM0N2NkMzI5ZmQ3YWVmYWRhMDY3M2ZjZjYxZDgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.XaVjmSws2Ucd1oqnVM29N2izL6iDL67lwOpvkIN3y-g)
After you got template, you can customize it as you wish.
In order to test Bot locally you need to install Bot Framework Emulator
Testing locally:
2023-09-22_13h38_42.mp4
Services on Azure that you're gonna need are:
![](https://private-user-images.githubusercontent.com/37112852/269932388-24b85c93-8030-481b-95c5-fa7ab5c869a8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ3MzkwOTksIm5iZiI6MTcyNDczODc5OSwicGF0aCI6Ii8zNzExMjg1Mi8yNjk5MzIzODgtMjRiODVjOTMtODAzMC00ODFiLTk1YzUtZmE3YWI1Yzg2OWE4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI3VDA2MDYzOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQ2NTg3YTllMDg4OTM1ZjRlMDczODMxOGViNWJiMjNlZGY4ODAwZGNkOTAyNGQyNzYxNDQxYzBmZjY3MDg0ODEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.zDsmAotlNqOgqy1jW77ru_pyti4jetfxfm2q54DG6nI)
1. App Service - for hosting the code of your chatbot (web app type). I chose the free one.
2. Azure Bot - When setting up the pricing, choose Free tier.
- App Service plan - is linked to app service (you can create it while creating app service), it depends on location, zone, features, cost...
Note: If you need this for some real use cases, probably you will have to upgrade from free services to pay-on-demand.
I was using 2 different approaches to deploy my bot code:
1st approach: Published my app to Github, then connected app service with that repo on Github. And enabled continuous deployment.
In GitHub actions, we can check deployments:
2nd approach: Publish directly from Visual Studio. Right-click on the project, and click on Publish.
Choose Azure -> Azure app service -> log in Azure -> you will see your services, choose the app service you want -> publish.
Once you did this process you will generate Deploy.pubxml file, so next time you can just hit the Publish button.
In Bot service -> configuration, enter the url of app service, and add sufix /api/messages:
Save somewhere the Microsoft App ID.
Click on Manage password:
Create a new password, you will be able to copy the VALUE just upon the creation (if you leave the page, you will not be able anymore to copy it).
In bot code, in appsettings.json, fill that values:
but in appsettings.Development.json make them empty, because the emulator will fail with 401 errors:
Deploy your bot code one more time.
If you did everything properly, you should be able to run your bot in Test in Web Chat:
We're gonna embed it directly in web app. You should use this approach if it's for testing, development.
(If it's production, then we would have to gather a token with a secret key, and then get embedded code with that token.)
In Azure Bot service, click on Channels -> Web Chat:
Then click on Default Site:
In html page, copy this embedded code, and replace YOUR_SECRET_HERE with real secret key, and that's it!
You can even use it in teams, just click on Teams in Channels, and create one. And then open it via Teams: