When user sends message to my bot, he receives Welcome message. But when user respond to that, bot sends Welcome message again. How can I fix this?

I believe this could be related to a change that was rolled out a few days ago; where Direct Line will send more ConversationUpdate messages than it used to.

Check the announcement and a related issue (similar to yours, but in node.js).

The first ConversationUpdate is sent when the bot is added to the conversation.
After that, each additional ConversationUpdate is sent when a new user joins the conversation.

So, I think the solution here will be to check the members added (activity.MembersAdded)

    else if (message.Type == ActivityTypes.ConversationUpdate)
    {
        if (message.MembersAdded.Any(o => o.Id == message.Recipient.Id))
        {
            // logic
        }
    }

Leave a Comment