Search code examples
c#botframeworkslackslack-api

Microsoft Bot Framework Bot duplicate responses in Slack


I have a simple code to test bot responses in my RoodDialog.cs code:

    if (activity.Text.Trim().ToLower() == "--hi")
    {
        IMessageActivity replyMessage = context.MakeMessage();
        replyMessage.Text = $"Hello {activity.From.Name}";
        await context.PostAsync(replyMessage);
    }

Works as expected in Skype, Emulator and Facebook Messenger, however sends duplicate response messages ("Hello {Name}") in Slack.

I think its either Slack configuration or a Bot Framework issue. Anyone seen and resolved this?

Thanks


Solution

  • Thanks to some Howdy developers I found the issue.

    It happens when the bot has already been authorized to the team, and then someone else comes in and authorizes the bot again. When that happens, it seems there are two bots running that then use the same RTM connection to post to the channel twice.

    I don't know how I got 2 bots in same Slack client. but once I removed and reinstalled my bot it started working as expected.

    Same issue is causing this other symptom: Microsoft Bot Framework IDialogContext.Call() not working when using Slack