团队消息传递扩展是否可以返回纯文本响应而不是卡片? [英] Is it possible for a teams messaging extension to return a plaintext response instead of a card?

查看:42
本文介绍了团队消息传递扩展是否可以返回纯文本响应而不是卡片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试基于v4 bot SDK创建用于Teams的消息传递扩展,该SDK可以搜索知识库并提供可以放入聊天室中的建议响应.搜索有效,我可以选择一张卡片放入聊天中,但我想删除格式,只将一段文本返回到聊天中(即,我不希望聊天中的其他人看到该响应来自扩展).我可以在搜索结果中指定卡片列表,并尝试将heroCard搜索结果结果的cardAction属性设置为"messageBack",但这仍然会将完整的卡片放入团队聊天中.我尝试模拟一个简单的,只有静态响应的东西,看看是否可以正常工作:

I'm trying to create a messaging extension for Teams based on the v4 bot SDK that searches a knowledge base and provides suggested responses that can be placed into a chat. The search works, and I can select a card to put into the chat, but I'd like to strip out the formatting and just return a block of text to the chat (i.e. I don't want anyone else in the chat to see that the response came from an extension). I'm able to specify a list of cards in my search results, and I tried setting the cardAction property of my heroCard search result result to "messageBack", but this still puts a full card into the team chat. I tried mocking up something simple that just has a static response to see if I could get this working:

        MessagingExtensionResult composeExtensionResult = new MessagingExtensionResult
        {
            Type = "result",
            AttachmentLayout = "list",
            Attachments = new List<MessagingExtensionAttachment>(),
        };

        HeroCard h = new HeroCard()
        {                
            Title="Intro",
            Text="Hello, my name is Inigo Montoya, you killed my father, prepare to die.",                 
            Tap=new CardAction()
            {
                Type= "messageBack",
                DisplayText="send message",
                Text="111",
            },
        };
        composeExtensionResult.Attachments.Add(h.ToAttachment().ToMessagingExtensionAttachment());

是否知道是否有办法获得纯文本响应,或者机器人响应总是归因于机器人?

Any idea whether there's a way to get a plain text response, or do bot responses always come back attributed to the bot?

推荐答案

因此,上述示例似乎仍然可以工作.我试图将卡更改为这样的格式:

So it appears that the above example works after all (sort of). I tried changing the card to format like this:

        HeroCard h = new HeroCard()
        {                
            Text="Hello, my name is Inigo Montoya, you killed my father, prepare to die.",
        };

使用compose扩展名时会出现类似卡片的响应:

Which puts in a card-like response when I use the compose extension:

如果我和其他用户一样看同一篇文章,我会得到:因此,这似乎是有意的,但可能没有得到足够的记录.值得注意的是,卡中的内容仍将被发送,而不是整个撰写的扩展标题和图像.

If I look at this same post as another user though, I get this: So it appears that this is intentional, but perhaps not documented as well as it could be. It is worth noting that the contents of the card will still be sent, just not the overall compose extension title and image.

这篇关于团队消息传递扩展是否可以返回纯文本响应而不是卡片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆