BotBuilder-MicrosoftTeams-node icon indicating copy to clipboard operation
BotBuilder-MicrosoftTeams-node copied to clipboard

Using `createReplyChain` with a `TurnContext` generated from a `ConversationReference` by `createConversation` does not make a new reply chain

Open weswigham opened this issue 5 years ago • 1 comments

Using createReplyChain with a TurnContext generated from a ConversationReference by createConversation does not make a new reply chain:

    async postStandupThread(ref: Partial<ConversationReference>) {
        this.adapter.continueConversation(ref, async context => {
            const date = moment().tz("America/Los_Angeles").format("YYYY-MM-DD");
            await this.adapter.createReplyChain(context, [{
                text: `**Standup ${date}**`
            }], /*inGeneral*/ false);
        });
    }

for example, posts in the same thread as the saved reference, rather than in a new thread: image

weswigham avatar Oct 07 '19 20:10 weswigham

Update: On inspection, the issue seems to be that createReplyChain silently fails to extract the channel from the context when the context is activity-less (as is the case when continueConversation is used). You need a version of createReplyChain that doesn't try to extract the channel from the turn context activity, and instead can pull the channel directly from the conversation reference. And then once that's in place, the channel id is actually only the first half (preceding the ;) of the ref.conversation.id (the channelId on the conversation reference is just "msteams" which ofc isn't useful).

weswigham avatar Oct 07 '19 23:10 weswigham