建议的操作在Microsoft Teams中不可见 [英] Suggested Actions not visible in Microsoft Teams

查看:90
本文介绍了建议的操作在Microsoft Teams中不可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我会从机器人向Microsoft Teams发送一条主动消息,其中包含用户可以采取的2条建议操作.但是在Microsoft Teams中,消息显示如下:

I'll send a pro-active message from a bot to Microsoft Teams with 2 suggested actions that the user can take. But in Microsoft Teams the message is shown like this:

请注意,该消息未显示建议​​的消息!在Bot Framework仿真器中,相同的消息如下所示:

Notice that the message shows no suggested messages! At the Bot Framework Emulator, the same message looks like this:

团队或我的代码有什么问题?

What's wrong in Teams or my code?

以下是我用于验证,生成和发送消息的代码:

Below is my code to authenticate, generate and send the message:

private async Task BotCallback(ITurnContext turnContext, CancellationToken cancellationToken)
{
    string serviceUrl = turnContext.Activity.RelatesTo.ServiceUrl;

    ConnectorClient Connector = new ConnectorClient(
        new Uri(serviceUrl),
        microsoftAppId: "[MicrosoftAppId]",
        microsoftAppPassword: "[MicrosoftAppPassword]"
    );

    AppCredentials.TrustServiceUrl(serviceUrl);
    ChannelAccount from = turnContext.Activity.From;
    IMessageActivity activity = MessageFactory.SuggestedActions(
        new string[] { "First action", "Second action" },
        $"Hi {userName},\r\nYou've missed some lorem ipsum dolor sit amet:\r\n- **consectetur:** Ut porttitor\r\nChoose an action from below to add them."
    );

    await Connector.Conversations.SendToConversationAsync(
        turnContext.Activity.Conversation.Id, 
        activity as Activity, 
        cancellationToken
    );
}

推荐答案

回显其他响应,但可能更详细.如前所述,在团队(和其他客户端)中执行此操作的方法是使用"自适应卡.您可以在设计器的此处上玩更多这些游戏,并且App Studio内建了设计器"体验(您甚至可以让App Studio的漫游器向您发送"卡片,以便在真实"对话中查看其外观.

Echoing the other response, but perhaps a bit more detail. As explained, the way to do this in Teams (and other clients) is to use "Cards" - kind of like mini windows inside the chat. Teams supports a few different kinds of cards to suit different interactions, but the most prominent are called Adaptive Cards. You can play more with these at the designer here and there's even a "designer" experience built into App Studio (where you can even have App Studio's bot "send" you the card to see what it looks like in a "real" conversation.

这篇关于建议的操作在Microsoft Teams中不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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