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;
}
}