Bot未连接到MS Teams频道

时间:2017-01-09 06:47:01

标签: botframework microsoft-teams

MS BOT Framework机器人无法使用Microsoft团队频道。它在配置的每个其他通道上都能正常工作。

应用ID:b3e237eb-7a3b-4b15-b8e1-4c30d1c94c77

使用的代码:

[BotAuthentication]
public class MessagesController : ApiController
{
    /// <summary>
    /// POST: api/Messages
    /// Receive a message from a user and reply to it
    /// </summary>
    public async Task<HttpResponseMessage> Post([FromBody]Activity activity)
    {
        if (activity.Type == ActivityTypes.Message)
        {
            ConnectorClient connector = new ConnectorClient(new Uri(activity.ServiceUrl));


            if(activity.Text.ToUpper().Contains("EMAILS") || activity.Text.ToUpper().Contains("EMAIL") ||
                activity.Text.ToUpper().Contains("MAILBOX") || activity.Text.ToUpper().Contains("OUTLOOK") )
            {
                    // return our reply to the user
                    Activity reply = activity.CreateReply($"blah .. blah ..");
                    await connector.Conversations.ReplyToActivityAsync(reply);

                    reply = activity.CreateReply($"blah .. blah ..");
                    await connector.Conversations.ReplyToActivityAsync(reply);

                    reply = activity.CreateReply($"blah .. blah ..");
                    await connector.Conversations.ReplyToActivityAsync(reply);                    }               

            }
        }
        else
        {
            HandleSystemMessage(activity);
        }
        var response = Request.CreateResponse(HttpStatusCode.OK);
        return response;
    }
}

2 个答案:

答案 0 :(得分:1)

在Microsoft团队的Office 365租户管理中启用机器人后,我的问题得以解决。 enter image description here 显然机器人直到最近才工作正常,没有设置此权限。因此,当MS开始执行它时,现有机器人或新机器人将不再在团队中工作。

答案 1 :(得分:0)

您好:我能够将您的机器人添加并测试到我的团队客户端。根据您的样本,我输入了“Mail”并得到了回复。你还有问题吗?