How to add a mention in Teams alongside an adaptive card using Bot Framework

后端 未结 2 532
猫巷女王i
猫巷女王i 2021-01-26 03:05

I\'m trying to send an activity with an adaptive card attachment and include a mention to the user who created the post. From reading online I found you can\'t currently include

2条回答
  •  不知归路
    2021-01-26 03:24

    Currently Adaptive Card @mention is in developer preview but you can achieve the @Mention in adaptive card with Adaptive card 1.2 version.

    You can @Mention a user in adaptive card using following JSON

    {
    
      "type": "AdaptiveCard",
    
      "body": [
    
        {
    
          "type": "TextBlock",
    
          "size": "Medium",
    
          "weight": "Bolder",
    
          "text": "Hi Mention_Name This is new feature in Adaptive Card version 1.2 Please test..."
    
        }
    
      ],
    
      "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    
      "version": "1.0",
    
      "channelId": {
    
        "entities": [
    
          {
    
            "type": "mention",
    
            "text": "Name",
    
            "mentioned": {
    
              "id": "29:124124124124",
    
              "name": "Mungo"
    
            }
    
          }
    
        ]
    
      }
    
    } 
    

    You need to specify channelID, and mentioned ID which you can fetch from the activity object itself

提交回复
热议问题