MS Teams - 不在 activity 提要中显示特定消息的通知

MS Teams - Don't show notification of specific message in the activity feed

问题

我有一个简单的 Bot for MS Teams developed in C# with the Bot Builder SDK 3.15.0.0 目标 .NET Framework 4.7.1。

当提到时,它会检索消息中的 Jira 工单 ID 和 returns 带有卡片列表的单个回复,每个卡片都显示 Jira 问题的摘要。

我想知道在发送带有卡片附件的回复时是否可以不填充 activity 提要,因为我的用例不需要它。

例子

这就是我通常构建对用户消息的回复的方式

var reply = activity.CreateReply();

reply.AttachmentLayout = AttachmentLayoutTypes.List;
reply.Attachments = thumbnailCards;

await context.PostAsync(reply);

这是我在 https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/activity-feed#rest-api-sample

阅读文档后尝试的
var reply = activity.CreateReply();

reply.AttachmentLayout = AttachmentLayoutTypes.List;
reply.Attachments = thumbnailCards;
reply.ChannelData = JsonConvert.SerializeObject(new
{
    notification = new
    {
        alert = false
    }
});
await context.PostAsync(reply);

我希望将 ChannelData 设置为 notification.alert = false 只会禁用通知,但它实际上不会显示任何消息。

您是否尝试过使用 Teams nuget 包:https://www.nuget.org/packages/Microsoft.Bot.Connector.Teams

var reply = activity.CreateReply();
reply.ChannelData = JObject.FromObject(new TeamsChannelData()
                               {
                                    Notification = new NotificationInfo(false)
                               });

可在此处找到此包的源代码:https://github.com/OfficeDev/BotBuilder-MicrosoftTeams/

您在 activity 提要中收到的警报只是 "someone replied to your message" 警报,并不是来自机器人的特殊警报。 activity 供稿中的此通知目前无法禁用。其他团队成员不会在 activity 供稿中收到此提醒,除非他们关注同一频道。

Sending notification using Rest API 专为 1:1 聊天而设计。