In the first part of the blog series on CRM automation, we wrote on how to store leads from different sources into a central Microsoft List using Microsoft 365 and Power Automate. Building on this, in the second part of the blog series on CRM automation, we explained how we use Azure Functions to transfer leads to our list. This gives us a single point of contact for more effective CRM. In order for us to conduct a follow-up action as soon as possible, we want to notify the team about new leads. We implement this as a flow with adaptive cards, deep linking and list conversations in Microsoft Teams.

Notify team about new leads - Adaptive Card in Teams with Deep Link to List Conversation

Notify the team with adaptive cards in Power Automate

To notify the team about new leads, a Power Automate flow is again a good choice. The procedure is as follows:

Trigger: A new lead is created in the Microsoft List.

  1. The first thing we do is to check if the particular lead with the same product interest already exists in our team’s task list.
  2. If the lead doesn’t already exist, we create an entry in our team’s task list.
  3. After that, we publish a message about the new lead in our team’s general channel as an adaptive card.
  4. Finally, we save the message in the list conversation thread.
Notify team about new leads - Power Automate Flow to publish an Adaptive Card in Teams

Publish an adaptive card to notify the team about new leads

Deep linking to a list item in Teams

To publish an adaptive card to a Teams channel, we use the Power Automate action Post adaptive card in a chat or channel. The handling is quite simple:

  • You can choose to publish the message as a user, flow bot, or Power Virtual Agent. Here you have to take care later that you choose the corresponding target version in the Card Designer.
  • You can choose which chat, channel and/or team you want to publish the card in.
  • There is a field for the card itself, in which you enter the card payload of the adaptive card. It’s best to use Microsoft’s Card Designer to design your card. This is the schema of our card:
{
    "type": "AdaptiveCard",
    "body": [
        {
            "type": "TextBlock",
            "weight": "Bolder",
            "size": "Large",
            "text": "Neuer Lead: @{triggerOutputs()?['body/Title']}",
            "wrap": true
        },
        {
            "type": "ColumnSet",
            "columns": [
                {
                    "type": "Column",
                    "items": [
                        {
                            "type": "ColumnSet",
                            "columns": [
                                {
                                    "type": "Column",
                                    "width": "stretch",
                                    "items": [
                                        {
                                            "type": "TextBlock",
                                            "text": "Produkt:",
                                            "wrap": true,
                                            "weight": "Bolder",
                                            "size": "Medium"
                                        }
                                    ]
                                },
                                {
                                    "type": "Column",
                                    "items": [
                                        {
                                            "type": "TextBlock",
                                            "text": "@{triggerOutputs()?['body/Interestedin/Value']}",
                                            "wrap": true
                                        }
                                    ],
                                    "width": "stretch"
                                }
                            ]
                        },
                        {
                            "type": "ColumnSet",
                            "columns": [
                                {
                                    "type": "Column",
                                    "width": "stretch",
                                    "items": [
                                        {
                                            "type": "TextBlock",
                                            "text": "E-Mail:",
                                            "wrap": true,
                                            "weight": "Bolder",
                                            "size": "Medium"
                                        }
                                    ]
                                },
                                {
                                    "type": "Column",
                                    "items": [
                                        {
                                            "type": "TextBlock",
                                            "text": "@{triggerOutputs()?['body/Email']}",
                                            "wrap": true
                                        }
                                    ],
                                    "width": "stretch"
                                }
                            ]
                        },
                        {
                            "type": "ColumnSet",
                            "columns": [
                                {
                                    "type": "Column",
                                    "width": "stretch",
                                    "items": [
                                        {
                                            "type": "TextBlock",
                                            "text": "Source:",
                                            "wrap": true,
                                            "weight": "Bolder",
                                            "size": "Medium"
                                        }
                                    ]
                                },
                                {
                                    "type": "Column",
                                    "items": [
                                        {
                                            "type": "TextBlock",
                                            "text": "@{triggerOutputs()?['body/LeadSource/Value']}",
                                            "wrap": true
                                        }
                                    ],
                                    "width": "stretch"
                                }
                            ]
                        }
                    ],
                    "width": 80
                },
                {
                    "type": "Column",
                    "items": [
                        {
                            "type": "Image",
                            "url": "https://www.smarterbusiness.at/wp-content/uploads/2021/12/Thanks.png",
                            "size": "Medium"
                        }
                    ],
                    "width": 20
                }
            ]
        },
        {
            "type": "ActionSet",
            "actions": [
                {
                    "type": "Action.OpenUrl",
                    "title": "Mehr Informationen",
                    "style": "positive",
                    "url": "https://teams.microsoft.com/l/entity/26bda823-6023-480c-a22b-6b6s6605ce8c/_djb2_msteams_prefix_3161176291?context=%7B%22subEntityId%22%3A%22<listItemId>%22%2C%22channelId%22%3A%2219%3Aa7d7f48c9854129040ac4057c5245727%40thread.skype%22%7D"
                }
            ]
        }
    ],
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.4"
}

Clicking More Information in our adaptive card should jump to the respective entry in the task list tab in Teams. This is called deep linking. For this we need to assemble a url – a so-called deep link – which we pass to the OpenUrl action.

The format before the URL encoding for a deep link to a list item is https://teams.microsoft.com/l/entity/<appId>/<entityId>?context={“subEntityId”:”<listItemId>”, “channelId”:”<channelId>”}. The easiest way to get the most information you need is to copy the link to the tab itself:

Notify team about new leads - Link to the list in the tab

This gives a url similar to https://teams.microsoft.com/l/entity/26bda823-6023-480c-a22b-6b6s6605ce8c/_djb2_msteams_prefix_3161176291?context=%7B%22subEntityId%22%3Anull%2C%22channelId%22%3A%2219%3Aa7d7f48c9854129040ac4057c5245727%40thread.skype%22%7D&groupId=372f916c-76da-427c-887c-b1cf48ee6d4a&tenantId=9b8fa496-cfa6-4554-87a0-b6ad369872a15.

The highlighted part is the URL-encoded version of the deep link. All that’s missing now is the ID of the list item we want to link to. To do this, we first replace null in the URL with the string %22ID<>%22, where <ID> is the ID of the list item.

Publishing the message in list conversations

We can display our adaptive card with an HTTP request in the list conversation thread of the list element.

Notify team about new leads - HTTP request to post the Teams message as a list conversation

For this we need:

  • the list url and ID of the list item
  • the message ID of our adaptive card
  • the channel ID, team ID

To get the channel ID, simply click on the 3 dots on the channel and select Get link to channel. Here you will get a url, such as: https://teams.microsoft.com/l/channel/19%3ab8ad7f48c4546fb90ac4057c524ab727%40thread.skype/<list>?groupId=<groupid>&tenantId=<tenantid>. For the channel ID, replace %3a with a colon and %40 with an at sign (@) in the highlighted section. In this case, the channel ID would be 19:b8ad7f48c4546fb90ac4057c524ab727@thread.skype.

You do the same with the team link/team ID. And that’s it. Now we can notify the team about new leads as soon as a new entry has been created in our lead list.

Notify team about new leads - Adaptive Card in the List Conversation Thread

Have we sparked your interest and would you like to receive more information about CRM automation and how to notify the team about new leads? Or do you have other suggestions on how to make the management of customer relationships even more effective? Then feel free to contact us. You can also subscribe to our newsletter if you want to be the first to receive news:

Never miss any offers or innovations?

Sign up for our newsletter and be the first to learn about exciting new products and topics around Microsoft SharePoint, Teams, and Co.



You can unsubscribe at any time. Your data will only be used to send our newsletter and will not be passed on to third parties. Additional information on the protection of your data can be found in our privacy policy.