Search code examples
botsmicrosoft-teamsazure-bot-servicebotframework

Microsoft Teams Bot: replyToId seems to be ignored


i am using the microsoft bot sdk in combination with an restify server (In package.json: "botbuilder": "^4.11.0"). I start a waterfall dialog that triggers a long running API. I save the the conversation reference and the id of the sent message to create an reply after the API call is completed:

replyToId = (await stepContext.context.sendActivity({ attachments: [ac]})).id; (in Dialog)

this.conversationReference = TurnContext.getConversationReference(context.activity); (in bot.ts)

After the completion of the API call, I want to create a reply to the last message of the dialog:

await this.adapter.continueConversation(this.conversationReference, async turnContext => {
    await turnContext.sendActivity(newMessage);
});

newMessage is the Activity-object that contains further information for the user about the result of the API call. The problem is that newMessage is not displayed as an reply to the existing message but as a separate message, although newMessage.replyToId is set to this.replyToId:

See screenshot

Additional information: Both messages, the last of the dialog and the "reply" are adaptive cards, but it does not make a difference if I send just simple text, same behaviour.

Would be grateful for any help :)


Solution

  • Instead of using "replyToId", put the id of the message you want to reply to, at the end of the conversation reference. As an example, if your conversationReference has a conversationId of 19:[email protected], change it to: 19:[email protected];messageid=12345678, where 12345678 is what you are currently using for "replyToId"