如何更改张贴卡片的 Teams 机器人的通知文本?
How to change the notification text for a Teams bot posting a card?
我正在使用机器人 post 使用以下代码将带有单个附件(自适应卡片)的消息发送到团队频道。这工作正常。但是,在移动设备和 Teams activity 提要上,当卡片 posted 时,通知中不会显示一些有用的文本,通知文本只是 "Card"(见下图).
我试过在卡片上设置 fallbackText
参数,它不会调整通知中的文本。我还尝试在 Activity
实例上设置 text
参数,但这会导致错误,说明它导致了多个 Skype 活动。我怎样才能使通知中显示的上下文不同于 "Card"?
card = CardFactory.adaptive_card({
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.2",
"fallbackText": "This is some notification text",
"body": [ ... ]})
connector.conversations.create_conversation(ConversationParameters(
is_group=True,
channel_data={ "channel": { "id": "..." } },
activity=Activity(
type=ActivityTypes.message,
attachments=[card])))
@ajshort,您需要为其添加摘要。以下代码应该为您提供修改后的文本,而不仅仅是卡片。
var reply = MessageFactory.Text(string.Empty);
reply.Attachments.Add(callAdaptiveCardhere());
reply.Summary="Your message will go here!"
await turnContext.SendActivityAsync(reply);
我正在使用机器人 post 使用以下代码将带有单个附件(自适应卡片)的消息发送到团队频道。这工作正常。但是,在移动设备和 Teams activity 提要上,当卡片 posted 时,通知中不会显示一些有用的文本,通知文本只是 "Card"(见下图).
我试过在卡片上设置 fallbackText
参数,它不会调整通知中的文本。我还尝试在 Activity
实例上设置 text
参数,但这会导致错误,说明它导致了多个 Skype 活动。我怎样才能使通知中显示的上下文不同于 "Card"?
card = CardFactory.adaptive_card({
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.2",
"fallbackText": "This is some notification text",
"body": [ ... ]})
connector.conversations.create_conversation(ConversationParameters(
is_group=True,
channel_data={ "channel": { "id": "..." } },
activity=Activity(
type=ActivityTypes.message,
attachments=[card])))
@ajshort,您需要为其添加摘要。以下代码应该为您提供修改后的文本,而不仅仅是卡片。
var reply = MessageFactory.Text(string.Empty);
reply.Attachments.Add(callAdaptiveCardhere());
reply.Summary="Your message will go here!"
await turnContext.SendActivityAsync(reply);