1

MS BOT Framework ボットが Microsoft Teams チャネルで動作しない。構成された他のすべてのチャネルで正常に動作します。

アプリ 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;
    }
}
4

2 に答える 2