Search code examples
botframeworkmicrosoft-teams

How to send a message to a thread (reply) using a Bot Framework SDK 4.18 Teams


Scenario:-

  1. User A -> Types a message in Teams App (bot)
  2. Now Bot has to reply to the same thread that user A has started in Teams App (bot)

I am able to send a new message in the Teams App (bot) - Not expected Not Expected

The bot needs to reply to the same thread the user started - Expected Expected

Did not find any reply method in the below documentation.. continueConversation creates a new message.

https://learn.microsoft.com/en-us/javascript/api/botbuilder-core/turncontext?view=botbuilder-ts-latest#botbuilder-core-turncontext-getmentions&preserve-view=true

https://learn.microsoft.com/en-us/microsoftteams/platform/bots/how-to/conversations/conversation-basics


Solution

  • The bot cannot give the reply to the same thread that user started. This is by design behaviour.

    Bot can reply to an existing message but it looks new message not like reply, call ReplyToActivity in .NET or session.send in Node.js. The Bot Builder SDK handles all the details.

    If you choose to use the REST API, you can also call the /v3/conversations/{conversationId}/activities/{activityId} endpoint.

    Ref Doc: https://learn.microsoft.com/en-us/microsoftteams/platform/resources/bot-v3/bot-conversations/bots-co...

    If you wish you can suggest this feature on - Microsoft Teams · Community