Introduction
Messaging extensions Link Unfurling is the process of performing an action based on the hyperlink pasted into a message. This allows the developer to design the card based on hyperlink details.
Link Unfurling
Messaging extensions Link Unfurling invokes the activity when the hyperlink from defined domain (defined or whitelist into the manifest file) is pasted into the message compose area. Link Unfurling help to respond to the full hyperlink with adaptive cards as well as additional information. It takes advantage of the Bot Framework's messaging schema and secure communication protocol to connect with Microsoft Teams Client App.
There are three types of messaging extension that can be built for Microsoft Teams, i.e.
- Search based messaging extension for Microsoft Teams
- Action-based messaging extension for Microsoft Teams
- Link Unfurl with messaging extension for Microsoft Teams.
In this article, I am going to explain the "Link Unfurling messaging extension for Microsoft Teams". In layman terms, unfurl means to unfold the link and extract more information.
Previous Article
A search-based messaging extension can be found here.
The action-based messaging extension can be found here.
How Messaging Extension Link Unfurling works:

Prerequisites
- Microsoft Teams
- Azure Bot Framework, .NetCore
- Microsoft 365 tenant
- Microsoft Azure subscription
Let's get started:
To create a Microsoft Team Messaging Extension requires two activities,
- Create a Microsoft Azure Bot.
- Create a manifest file with bot reference
- Upload the manifest file to MS Team Client App.
Step 1 - Create a Microsoft Azure Bot
- Browse the https://portal.azure.com with your work or school account.
- Click "+Create Resource"
- Select "AI + Machine Learning"
- Select "Web App Bot"

Step 2 - Complete all required information and click create to provision the bot
- Bot handle: its unique name of your bot.
- Subscription: Select a valid available subscription.
- Resource Group: Select an appropriate resource group or create a new one as per requirement.
- Location: Select your closed azure location or the preferred location.
- Pricing: Select the required pricing tier or F0 as free for POC activity.
- App Name: Leave it as-is for this demo purpose.
- Service Plan: Leave it as-is for this demo purpose.
- Bot Template: Leave it as-is for this demo purpose.
- Application insight: Select off for this demo purpose
- Microsoft App Id and Password: Leave it as-is for this demo purpose.
- Click create to provision

Step 3 - Enable Microsoft Team Channel for your Bot
In order for the bot to interact with MS Teams, you must enable the Teams Channel

To complete the process, MS Teams and Webchat should be available and should be listed in your channel lists.

Step 4 - Create a Bot Framework
In this section, we are going to create an echo bot using Visual Studio 2019
- Open the Visual Studio, Select create project and navigate to the desired directory to create a project.
- Select Echo Bot (Bot Framework v4) .Net Core

Step 5 - Update Default Bot Code
- Select EchoBot.cs and Remove all default methods implemented into the EchoBot class.
- Inherit Team Activity Handler to Echo Bot Class to implement the messaging extension-related method.
- Add the Link Query Async method to respond with the designed card.
- Add Query Async execute custom logic based on action command id

Link Query Async design the card and response to the same thread as Message Extension Response which consists of a designed hero card.




Roshan RathodPosted Jul 21, 2020, 11:47 PM
Really helpful content..keep it up