I have problems with using Azure Bot in Personal Chat in Microsoft Teams

56 Views Asked by At

I developed Azure Bot with Bot Framework SDK on C#. I configured and installed to Microsoft Teams. I see the Bot is working. My Bot should parse any message and should to find expression like #{0123456789} . It is working for Teams and sending message to Bot Channel. But isn't working for Personal Chat. I can write with Bot Name in Private Channel: @BotName #123455 But if I write just #123455 then It isn't working. Teams doesn't send a Request to Azure Bot without BotName in private message (( I tried any permissions for Application, but I can't find any solution.

I want to get my Azure Bot in Teams will be to parse some messages without mentioning the Botname.

I used this function

protected override async Task OnMessageActivityAsync(ITurnContext<IMessageActivity> turnContext, CancellationToken cancellationToken)
        {
         
var activity = turnContext.Activity;
          var submitActionData = turnContext.Activity.Value as JObject;
            string action = null;
            if (submitActionData != null)
            {
                action = submitActionData["action"]?.ToString();
            }
                    var text = activity.Text.Trim().ToLower();
                    Regex regex = new Regex(@"#(\d+)");
                    MatchCollection matches = regex.Matches(text);
                    if (matches.Count > 0)
                    {
                        List<string> identifiers = new List<string>();
                        foreach (Match match in matches)
                        {
                            identifiers.Add(match.Value.Replace("#", ""));
                        }
                        await FetchDataAndSendAdaptiveCardAsync(turnContext, identifiers, cancellationToken);
                    }
        }
0

There are 0 best solutions below