|
| 1 | +# FileUpload |
| 2 | + |
| 3 | +Bot Framework v4 echo bot sample. |
| 4 | + |
| 5 | +This bot has been created using [Bot Framework](https://dev.botframework.com), it shows how to create a simple bot that accepts input from the user and echoes it back. |
| 6 | + |
| 7 | +## Prerequisites |
| 8 | +- Open Notepad (or another text editor) to save some values as you complete the setup. |
| 9 | + |
| 10 | +- Ngrok setup |
| 11 | +1. Download and install [Ngrok](https://ngrok.com/download) |
| 12 | +2. In terminal navigate to the directory where Ngrok is installed |
| 13 | +3. Run this command: ```ngrok http -host-header=rewrite 3978 ``` |
| 14 | +4. Copy the https://xxxxxxxx.ngrok.io address and put it into notepad. **NOTE** You want the https address. |
| 15 | + |
| 16 | +- Azure setup |
| 17 | +1. Login to the [Azure Portal]((https://portal.azure.com) |
| 18 | +2. (optional) create a new resource group if you don't currently have one |
| 19 | +3. Go to your resource group |
| 20 | +4. Click "Create a new resource" |
| 21 | +5. Search for "Bot Channel Registration" |
| 22 | +6. Click Create |
| 23 | +7. Enter bot name, subscription |
| 24 | +8. In the "Messaging endpoint url" enter the ngrok address from earlier. |
| 25 | +8a. Finish the url with "/api/messages. It should look like ```https://xxxxxxxxx.ngrok.io/api/messages``` |
| 26 | +9. Click the "Microsoft App Id and password" box |
| 27 | +10. Click on "Create New" |
| 28 | +11. Click on "Create App ID in the App Registration Portal" |
| 29 | +12. Click "New registration" |
| 30 | +13. Enter a name |
| 31 | +14. Under "Supported account types" select "Accounts in any organizational directory and personal Microsoft accounts" |
| 32 | +15. Click register |
| 33 | +16. Copy the application (client) ID and put it in Notepad. Label it "Microsoft App ID" |
| 34 | +17. Go to "Certificates & Secrets" |
| 35 | +18. Click "+ New client secret" |
| 36 | +19. Enter a description |
| 37 | +20. Click "Add" |
| 38 | +21. Copy the value and put it into Notepad. Label it "Password" |
| 39 | +22. (back in the channel registration view) Copy/Paste the Microsoft App ID and Password into their respective fields |
| 40 | +23. Click Create |
| 41 | +24. Go to "Resource groups" on the left |
| 42 | +25. Select the resource group that the bot channel reg was created in |
| 43 | +26. Select the bot channel registration |
| 44 | +27. Go to Channels |
| 45 | +28. Select the "Teams" icon under "Add a featured channel |
| 46 | +29. Click Save |
| 47 | + |
| 48 | +- Updating Sample Project Settings |
| 49 | +1. Open the project |
| 50 | +2. Open config.py |
| 51 | +3. Enter the app id under the ```MicrosoftAppId``` and the password under the ```MicrosoftAppPassword``` |
| 52 | +4. Save the close the file |
| 53 | +5. Under the teams_app_manifest folder open the manifest.json file |
| 54 | +6. Update the ```botId``` with the Microsoft App ID from before |
| 55 | +7. Update the ```id``` with the Microsoft App ID from before |
| 56 | +8. Save the close the file |
| 57 | + |
| 58 | +- Uploading the bot to Teams |
| 59 | +1. In file explorer navigate to the TeamsAppManifest folder in the project |
| 60 | +2. Select the 3 files and zip them |
| 61 | +3. Open Teams |
| 62 | +4. Click on "Apps" |
| 63 | +5. Select "Upload a custom app" on the left at the bottom |
| 64 | +6. Select the zip |
| 65 | +7. Select for you |
| 66 | +8. (optionally) click install if prompted |
| 67 | +9. Click open |
| 68 | + |
| 69 | +## To try this sample |
| 70 | + |
| 71 | +- Clone the repository |
| 72 | + |
| 73 | + ```bash |
| 74 | + git clone https://github.com/Microsoft/botbuilder-python.git |
| 75 | + ``` |
| 76 | + |
| 77 | +- In a terminal, navigate to `samples/python/scenarios/file-upload` |
| 78 | + |
| 79 | + - From a terminal |
| 80 | + |
| 81 | + ```bash |
| 82 | + pip install -r requirements.txt |
| 83 | + python app.py |
| 84 | + ``` |
| 85 | + |
| 86 | +- Interacting with the bot |
| 87 | +1. Send a message to your bot in Teams |
| 88 | +2. Confirm you are getting a 200 back in Ngrok |
| 89 | +3. Click Accept on the card that is shown |
| 90 | +4. Confirm you see a 2nd 200 in Ngrok |
| 91 | +5. In Teams go to Files -> OneDrive -> Applications |
| 92 | + |
| 93 | +## Testing the bot using Bot Framework Emulator |
| 94 | + |
| 95 | +[Bot Framework Emulator](https://github.com/microsoft/botframework-emulator) is a desktop application that allows bot developers to test and debug their bots on localhost or running remotely through a tunnel. |
| 96 | + |
| 97 | +- Install the Bot Framework Emulator version 4.3.0 or greater from [here](https://github.com/Microsoft/BotFramework-Emulator/releases) |
| 98 | + |
| 99 | +### Connect to the bot using Bot Framework Emulator |
| 100 | + |
| 101 | +- Launch Bot Framework Emulator |
| 102 | +- File -> Open Bot |
| 103 | +- Enter a Bot URL of `http://localhost:3978/api/messages` |
| 104 | + |
| 105 | +## Deploy the bot to Azure |
| 106 | + |
| 107 | +To learn more about deploying a bot to Azure, see [Deploy your bot to Azure](https://aka.ms/azuredeployment) for a complete list of deployment instructions. |
| 108 | + |
| 109 | +## Further reading |
| 110 | + |
| 111 | +- [Bot Framework Documentation](https://docs.botframework.com) |
| 112 | +- [Bot Basics](https://docs.microsoft.com/azure/bot-service/bot-builder-basics?view=azure-bot-service-4.0) |
| 113 | +- [Activity processing](https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-concept-activity-processing?view=azure-bot-service-4.0) |
| 114 | +- [Azure Bot Service Introduction](https://docs.microsoft.com/azure/bot-service/bot-service-overview-introduction?view=azure-bot-service-4.0) |
| 115 | +- [Azure Bot Service Documentation](https://docs.microsoft.com/azure/bot-service/?view=azure-bot-service-4.0) |
| 116 | +- [Azure CLI](https://docs.microsoft.com/cli/azure/?view=azure-cli-latest) |
| 117 | +- [Azure Portal](https://portal.azure.com) |
| 118 | +- [Language Understanding using LUIS](https://docs.microsoft.com/en-us/azure/cognitive-services/luis/) |
| 119 | +- [Channels and Bot Connector Service](https://docs.microsoft.com/en-us/azure/bot-service/bot-concepts?view=azure-bot-service-4.0) |
0 commit comments