# Microsoft Teams Integration Microsoft Teams Integration Index 1. What is Microsoft Teams? 2. Getting Started 1. Create a new Teams app 2. Connect your Teams app with YM bot 3. Create your app manifest 3. Authentication : Active Directory & Graph APIs 4. Adaptive cards in MS Teams 5. Advanced features 1. Messaging Extensions 2. Task Module 3. Group Conversations 6. UX design guidelines 7. More References ---------- Abstract: In this document I will walk you through some MS Team features for improving conversation experience and connecting users with Microsoft O365 Applications. | Features | Page No. | | -------------------------------------------- | -------- | | Adaptive Cards | 1 - 3 | | Azure AD Auth & Graph APIs | 4 - 5 | | App Studio - Suggestions, Message Extensions | 5 - 11 | Adaptive Cards: Adaptive Cards are an open card exchange format enabling developers to exchange UI content in a common and consistent way. Designer: https://adaptivecards.io/designer/ Documentation: https://docs.microsoft.com/en-us/adaptive-cards/ Detailed functionality: https://adaptivecards.io/explorer/AdaptiveCard.html Sending Adaptive Card using yellow messenger: let CARD_PAYLOAD_FROM_DESIGNER = { "type": "AdaptiveCard", "body": [ { "type": "TextBlock", "text": "sOME TEXT" } ], "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", "version": "1.0" } let card = { "contentType": "application/vnd.microsoft.card.adaptive", "content": CARD_PAYLOAD_FROM_DESIGNER } app.sendAdaptiveCard(card).then(() => { resolve(); }) Sending Carousel Card: let card = { "contentType": "application/vnd.microsoft.card.adaptive", "content": CARD_PAYLOAD_FROM_DESIGNER } let cardCarousal = [card,card,card] //array of cards app.sendCards(cardCarousal).then(() => { resolve(); }) Receiving Form Submission data from Adaptive Card: ![](https://lh4.googleusercontent.com/f8H8NE_VxqDlEh1GllZh5HsIENtuRbYqA3RC-GsHcUmKOPzuqs15PhjEcijTZuYXvlqQMrWVZBvQ9tuDS_k_oJY0dba49zM3EILtHi9sEgoKx8vFSPoAcZS_IQPI4FEX4PcBj7ml) ![](https://lh4.googleusercontent.com/f8H8NE_VxqDlEh1GllZh5HsIENtuRbYqA3RC-GsHcUmKOPzuqs15PhjEcijTZuYXvlqQMrWVZBvQ9tuDS_k_oJY0dba49zM3EILtHi9sEgoKx8vFSPoAcZS_IQPI4FEX4PcBj7ml) ```//Received app.data app.log(app.data); /* ---In Log--- { "message":"form-data", "value":{ "action":"saveName", "namearea":"Adam" } } */ ``` # Azure AD Auth & Graph APIs App Registration on Azure AD: Click here. Connecting your bot to MS Teams : Click here. How to set dynamic scopes in Login url: let consent = "&prompt=consent" let scopeMp = "People.Read User.ReadBasic.All Presence.Read" { "type": "Action.OpenUrl", "title": "Login", "url": app.azure.auth() + encodeURIComponent(scopeMp) + consent } Add / Remove permission and Grant Admin consent for App in Azure Portal > App Registration > API Permissions ![](https://lh6.googleusercontent.com/z37T-8_2hO-v88FOY15bYZs3ZhNy7HK2hX3mR_uKF6Qh1L77cnBuHBc2IPXZX_Qm-glHTF5mBPkQnWNVa2eo3t6MmkDGhQWrpg-jDZdVWr3So_JH7QKeS9milnNcDW7YWTDj1dhP) For enabling multi tenant: Enable multi tenant in the Azure AD integration in Yellow messenger and enable multi tenant on the App registration > Authentication Graph Apis: Documentation: https://docs.microsoft.com/en-US/graph/api/overview?view=graph-rest-1.0 Explorer: https://developer.microsoft.com/en-us/graph/graph-explorer Few APIs need Admin consent for their organisation via Azure Portal or at the time of Login itself. Creating a Teams app using your bot service link (App Studio) Add App Studio from App Store which allows you to create bot manifest, Command Suggestions, Message Extensions etc. ![](https://lh5.googleusercontent.com/gAC2XCk1xtteOmvCJFcz51ZvqC5ri6LTaI7ydhgb2JSsZaTpFR7iiVkuKePfb9P_nh567Bxylb6x_0FFrup2AyI9aEfGDmuUkhAoRVkZveDkapoR60NwxfitYAOIp9voHJKk-c1x) For creating a new App in App Studio click on the Create a new App and fill the basic details and click on the generate button for App ID. Configure your bot using Client ID in the Bots Section, For Testing: Install bot using Test & Distribute Section. Command Suggestions: ![](https://lh6.googleusercontent.com/Fx5GPrPTOVWuZEA81h-fOB2QY8ro3P4mSbSCFmZTTMESktQGtMNLbsUF683UyUUEHwAmEtOTAM5TIPQ0-0XgadZv-PyMQHfi05zOeLO92YmOMkj9X6VGWdqYRXTizjK_1gygmZ8q) Step 1: Goto App Studio > Select your App > Bots > Setup your bot using Client ID and click on the Add button in the Commands section to add suggestion commands. ![](https://lh6.googleusercontent.com/Rcla8_oDt5BLFaAA8dV_Q6uwNWZP12yW_6vypZ3dHNxtOHGVaGfWnhdhU6fkJ65XlRN104Tf_5K6LSiuhdoCx_LpzoGnUsI7PcUSGw8t2MVlt7eD3bxHYbddFV6_7VPpV_SJuAz-) Step 2: Fill the new command fields > Click on Save. You would find Bot suggesting you the commands after reinstalling the app. ![](https://lh3.googleusercontent.com/r3j_W2Y7J4XcGnsnKEqPIsQp3_ryIJ8lCcEC8z6O2zi_UTOAWTK2mM0UWoWWrbenTRRKg-9iS_j4wLDCdJexW2nSx-05sRE4QyqzqjsQV9alcz1lNj6lW12wbzf0FWxAzZbGw5jT) Message Extensions: Documentation: https://docs.microsoft.com/en-us/microsoftteams/platform/messaging-extensions/what-are-messaging-extensions Steps to integrate ME with Yellow Messenger: Step 1: Goto App Studio > Select your App > Messaging extensions > Set up ![](https://lh4.googleusercontent.com/gQFKtWaYejsyGaE5wqDwmxs188vsZsud4TJBRUob7v9najqluRBTQMlEjCvFlbH6wOfDC9BXcLj74AcmcDPeiFU6jXeM62YPfrOBbVIeKB4eC3UtPjpodNGkK1p0uGAVjTjJIv0R) Step 2: Configure your bot and change messaging endpoint to: https://app.yellowmessenger.com/integrations/sync/microsoft/extensions/<botID> ![](https://lh4.googleusercontent.com/nsD_snWZRoTvoYJwLvQJom89AM3AS4dsqFNm9vI3HsTXEPu9Qs7nIvH9PqXF5dLGK_ie6SJWcW4AoS79rToiTGk7FmXSaKnxi9e-X5dVC2mOyTUTjvQDHgML0Dv5aX69XHiGxfIV) Step 3: Click on Add Button and choose method according to the requirement then fill out the details and parameters for your message extensions. Action Type: Allows you to open a pop up and take multiple field values. (e.g: Add Task) Query Type: Allows you to run a query in the search field itself.(e.g: Wikipedia Search) ![](https://lh3.googleusercontent.com/_KsG4Vgw53hdWjE9Hf1y82w6A2THRZA8G4PlXHajX8i5NWQsW1q2un8PDYGpwUNy3ytJoeY4OiNoDZavHjToxNRXmnPmUw-PeobGKTexMlxCjssqhslvnPUadGhpHC0eyzjOUNrM) Receiving responses in yellow messenger: Query Type: app.log(app.data) //In logs---------- { "commandType": "composeExtension/query", "value": { "commandID" : "findwikipedia", "parameters" : [ { "name": "searchquery", "value":"Bumblebee" } ] } } //For initial run / empty query app.data.value.parameters[0].name = "initialRun" Action Type Submission: app.log(app.data) //In logs---------- { "commandType": "composeExtension/submitAction", "value": { "commandID" : "addtask", "data" : { "taskname": "Some Task", "taskduedate":"2020-09-10" } } } Responding to the Message Extensions: let messageExt = { "composeExtension": { "type": "result", "attachmentLayout": "list", "attachments": [ { "contentType": "application/vnd.microsoft.card.adaptive", "content": { "type": "AdaptiveCard", "body": [ { "type": "Container", "items": [ { "type": "TextBlock", "text": "Some Details", } ] } ], "version": "1.0" }, "preview": { "contentType": "application/vnd.microsoft.card.thumbnail", "content": { "title": "Preview Title", "text": "Preview Text" } } } ] } } //Send reply directly to message extensions app.sendAdaptiveCard(messageExt); For multiple responses use Attachments as an Array. ![](https://lh3.googleusercontent.com/GOOgO5k1l8g4PoA0fzCqKf5YcldUOhNT0WK9rgS1EuO9ESN_bWqN_LeipnOGuvTAbq7seaiWbf6duMmRKa2PIPIEjJ18fFLD7Hld2Se6rJJZsODu0m1FaZR_Vv35ksM7NCVJePUO) After clicking on the preview user can view the Adaptive Card attached with the preview. ![](https://lh4.googleusercontent.com/bePbJOD8e8ACjYJj5bdtRXBRkQgMsELw8-SyXCP3eTxL2tpbrE5e-gMuAl-8UgxPJBHU8L9JepYtZO25oN9roc1I2YIfPhFn9LCJBapQFcNqV6IFwXEjM9HJnLw8M0VfI-gaT_98) ![](https://lh6.googleusercontent.com/gImu1kA5DxyC_QsfU31wxdxDf_qX7O9NCYgMdKYob01z-LGqR9jeWK3yVOfCS2q394a5E7Q5kgbnXcOKTpbpHPmCK-vJ5UAYuy9Wj5yDhMMFbsmgyjkOk2QRTPrIKQJueViuQQpT)