microsoft/teams.net
Publicmirrored from https://github.com/microsoft/teams.netAvailable
core/samples/MessageExtensionBot/README.md
55lines · modecode
| 1 | # MessageExtensionBot Testing Guide |
| 2 | |
| 3 | A sample bot demonstrating Teams message extension handlers. |
| 4 | |
| 5 | ## Setup |
| 6 | |
| 7 | 1. Configure bot credentials in `appsettings.json` or environment variables |
| 8 | 2. Run the bot: `dotnet run` |
| 9 | 3. Upload `manifest.json` to Teams |
| 10 | |
| 11 | ## Testing Handlers |
| 12 | |
| 13 | ### OnQuery (Search) |
| 14 | **Manifest:** `composeExtensions.commands` with `type: "query"` |
| 15 | |
| 16 | 1. Open message compose box |
| 17 | 2. Select the message extension |
| 18 | 3. Type a search term |
| 19 | 4. Verify results display in list format |
| 20 | 5. Type "help" to test message response |
| 21 | |
| 22 | ### OnSelectItem |
| 23 | **Manifest:** No specific requirement (works with OnQuery results) |
| 24 | |
| 25 | 1. After running a search (OnQuery) |
| 26 | 2. Click on any search result |
| 27 | 3. Verify adaptive card preview appears |
| 28 | |
| 29 | ### OnFetchTask (Action - Task Module) |
| 30 | **Manifest:** `composeExtensions.commands` with `type: "action"` and `fetchTask: true` |
| 31 | |
| 32 | 1. Click the message extension action button (createAction) |
| 33 | 2. Verify task module opens with input form |
| 34 | |
| 35 | ### OnSubmitAction (Action Submit) |
| 36 | **Manifest:** No specific requirement (works with OnFetchTask) |
| 37 | |
| 38 | 1. Fill form in task module |
| 39 | 2. Click submit |
| 40 | 3. Verify preview card appears with Edit/Send buttons |
| 41 | 4. Click Edit - verify form reopens with values |
| 42 | 5. Click Send - verify final card posts to conversation -- Currently this only works when we start from commandbox. |
| 43 | |
| 44 | ### OnQueryLink (Link Unfurling) |
| 45 | **Manifest:** `composeExtensions.messageHandlers` with `type: "link"` and `domains` |
| 46 | |
| 47 | 1. Paste a URL in compose box that matches the unfurl domain in manifest (*.example.com) |
| 48 | 2. Verify card unfurls automatically |
| 49 | |
| 50 | ### OnQuerySettingUrl (Settings) |
| 51 | **Manifest:** `composeExtensions.canUpdateConfiguration: true` |
| 52 | |
| 53 | 1. Right-click message extension icon |
| 54 | 2. Select Settings |
| 55 | 3. Verify settings URL opens (microsoft.com) |
| 56 | |