Bot Framework在团队中提到某个渠道停止工作

时间:2020-02-20 21:24:09

标签: botframework microsoft-teams

我在Microsoft Teams中的Bot拥有下面的代码,该代码提到了主动消息背后的通道。在上周,它已停止工作。 API是否进行了任何更改以防止这种情况发生?

var bot = new ChannelAccount(team.BotId);
string replyText = $"<at>@{teamName}</at> ";
Logger.LogInformation($"ReplyText:{replyText}");
var activity = MessageFactory.Text(replyText);

var mentioned = JObject.FromObject(new
{
    id = team.TeamId,
    name = teamName
});
var mentionedEntity = new Entity("mention")
{
    Properties = JObject.FromObject(new { mentioned = mentioned, text = replyText }),
};
// activity.Entities = new[] { mentionedEntity };
activity.Text = "It's time for the daily challenge " + replyText;
var convParams = new ConversationParameters()
{
    TenantId = team.TenantId,
    Bot = bot,
    IsGroup = true,
    ChannelData = team.ChannelData,
    Activity = activity
};

1 个答案:

答案 0 :(得分:0)

您可以尝试在自适应卡json中添加用户提及,如下所示。

{
"type": "AdaptiveCard",
"body": [
    {
        "type": "TextBlock",
        "size": "Medium",
        "weight": "Bolder",
        "text": "Hi <at>Mungo</at> 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": "<at>Mungo</at>",
            "mentioned": {
                "id": "29:124124124124",
                "name": "Mungo"
            }
        }
    ]
}

}

Here is a sample card