Share via

botframework nodejs sdk replyToActivity not working as expected

moonKnight 0 Reputation points
2026-02-03T10:28:59.2166667+00:00

I'm building a Microsoft Teams bot using the Bot Framework SDK (botframework-connector@4.23.3) and trying to create threaded replies in a group chat conversation.

What I'm doing:

I'm using connector.conversations.replyToActivity() with the correct conversationId and activityId, and also setting activity.replyToId on the activity object:

const activity: Partial<Activity> = {

  type: ActivityTypes.Message,

  text: "Bot's response",

  replyToId: originalActivityId,  // Set to the activity I want to reply to

};

const response = await connector.conversations.replyToActivity(

  conversationId,

  originalActivityId,  // Activity ID of the message to reply to

  activity

);

Observed behavior:

  • The message is sent successfully (I get a valid response with an activity ID)
  • The replyToId is correctly set to the original activity ID
  • However, the message appears as a new message at the bottom of the chat, NOT as a threaded reply to the original message

Expected behavior:

  • The bot's response should appear as a reply/thread under the original message (similar to how users can reply to specific messages in Teams)

Environment**:**

  • Bot Framework SDK: botframework-connector@4.23.3
  • Channel: Microsoft Teams

Question**:**

  1. Does replyToActivity support visual threading?
  2. I found this in the SDK documentation: "If the channel does not support nested replies, ReplyToActivity falls back to SendToConversation." - Does this mean Teams group chats don't support nested replies?

Any guidance would be appreciated!I'm building a Microsoft Teams bot using the Bot Framework SDK (botframework-connector@4.23.3) and trying to create threaded replies.

Azure AI Bot Service
Azure AI Bot Service

An Azure service that provides an integrated environment for bot development.


1 answer

Sort by: Most helpful
  1. SRILAKSHMI C 19,100 Reputation points Microsoft External Staff Moderator
    2026-02-18T11:09:30.47+00:00

    Hello moonKnight,

    Welcome to Microsoft Q&A and Thank you for the detailed explanation.

    This is a very common point of confusion when working with Microsoft Teams and the Bot Framework SDK. The good news is that your implementation is technically correct. The behavior you're seeing is due to Microsoft Teams channel limitations, not an issue in your code.

    You are correctly using connector.conversations.replyToActivity() with the proper conversationId and activityId, and you are also setting replyToId on the activity object. That is exactly how threaded replies should be created in channels that support nested replies. The fact that you receive a valid activity ID confirms that the message is being successfully delivered.

    However, visual threading in Microsoft Teams depends on the conversation type, not just the presence of replyToId.

    In Teams:

    • 1:1 chats do not support threads

    Group chats do not support threaded replies

    Channel conversations support threaded replies

    Since you're working in a group chat conversation, Teams does not support bot-created threaded replies in that context. When replyToActivity() is used in a conversation type that does not support nesting, the SDK falls back to SendToConversation. This matches the documentation note you found:

    "If the channel does not support nested replies, ReplyToActivity falls back to SendToConversation."

    That fallback is exactly what you are observing. The message is accepted by the platform, but Teams renders it as a new message at the bottom of the chat instead of inside a thread.

    If you want proper threaded behavior, your bot must:

    Be installed in a Team

    Operate inside a channel conversation

    Reply to the root post using replyToId (or replyToActivity())

    You can confirm the conversation type by inspecting:

    context.activity.conversation.conversationType
    

    Possible values:

    "personal" → 1:1 chat

    "groupChat" → Group chat

    "channel" → Teams channel thread

    Only "channel" supports visual threading.

    Even in channel conversations, there is one important limitation: Teams supports only single-level threading. You can reply to the root post, but you cannot create nested replies under replies.

    Your code is correct.

    replyToActivity() does not guarantee visual threading.

    Teams group chats do not support threaded replies.

    Threading works only in Teams channel conversations.

    This is expected platform behavior, not an SDK bug.

    Please refer this

    I hope this helps, do let me know if you have any further queries.

    Thank you!

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.