Bot Framework v4 echo bot sample.
This bot has been created using Bot Framework, it shows how to create a simple bot that accepts input from the user and echoes it back.
-
Open Notepad (or another text editor) to save some values as you complete the setup.
-
Ngrok setup
- Download and install Ngrok
- In terminal navigate to the directory where Ngrok is installed
- Run this command:
ngrok http -host-header=rewrite 3978 - Copy the https://xxxxxxxx.ngrok.io address and put it into notepad. NOTE You want the https address.
- Azure setup
- Login to the [Azure Portal]((https://portal.azure.com)
- (optional) create a new resource group if you don't currently have one
- Go to your resource group
- Click "Create a new resource"
- Search for "Bot Channel Registration"
- Click Create
- Enter bot name, subscription
- In the "Messaging endpoint url" enter the ngrok address from earlier.
8a. Finish the url with "/api/messages. It should look like
https://xxxxxxxxx.ngrok.io/api/messages - Click the "Microsoft App Id and password" box
- Click on "Create New"
- Click on "Create App ID in the App Registration Portal"
- Click "New registration"
- Enter a name
- Under "Supported account types" select "Accounts in any organizational directory and personal Microsoft accounts"
- Click register
- Copy the application (client) ID and put it in Notepad. Label it "Microsoft App ID"
- Go to "Certificates & Secrets"
- Click "+ New client secret"
- Enter a description
- Click "Add"
- Copy the value and put it into Notepad. Label it "Password"
- (back in the channel registration view) Copy/Paste the Microsoft App ID and Password into their respective fields
- Click Create
- Go to "Resource groups" on the left
- Select the resource group that the bot channel reg was created in
- Select the bot channel registration
- Go to Channels
- Select the "Teams" icon under "Add a featured channel
- Click Save
- Updating Sample Project Settings
- Open the project
- Open config.py
- Enter the app id under the
MicrosoftAppIdand the password under theMicrosoftAppPassword - Save the close the file
- Under the teams_app_manifest folder open the manifest.json file
- Update the
botIdwith the Microsoft App ID from before - Update the
idwith the Microsoft App ID from before - Save the close the file
- Uploading the bot to Teams
- In file explorer navigate to the TeamsAppManifest folder in the project
- Select the 3 files and zip them
- Open Teams
- Click on "Apps"
- Select "Upload a custom app" on the left at the bottom
- Select the zip
- Select for you
- (optionally) click install if prompted
- Click open
-
Clone the repository
git clone https://github.com/Microsoft/botbuilder-python.git
-
In a terminal, navigate to
samples/python/scenarios/file-upload- From a terminal
pip install -r requirements.txt python app.py
-
Interacting with the bot
- Send a message to your bot in Teams
- Confirm you are getting a 200 back in Ngrok
- Click Accept on the card that is shown
- Confirm you see a 2nd 200 in Ngrok
- In Teams go to Files -> OneDrive -> Applications
Bot Framework Emulator is a desktop application that allows bot developers to test and debug their bots on localhost or running remotely through a tunnel.
- Install the Bot Framework Emulator version 4.3.0 or greater from here
- Launch Bot Framework Emulator
- File -> Open Bot
- Enter a Bot URL of
http://localhost:3978/api/messages
To learn more about deploying a bot to Azure, see Deploy your bot to Azure for a complete list of deployment instructions.