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

how to get newly created chain info when calling createReplyChain?

Open richard1122 opened this issue 5 years ago • 3 comments

Hi, I'm using createReplyChain to send messages to a new chain (in the channel).

      const activity = {
        type: ActivityTypes.Message,
        attachments: [{
          contentType: 'application/vnd.microsoft.card.adaptive',
          content: buildFeedbackDialog(message),
        }],
      } as Activity
      const resource = (await adapter.createReplyChain(context, [activity]))[0]
      console.log(`Add record: ${resource.id}`)

After that, the only thing I got is resourceId

Screenshot from 2019-05-09 17-55-25

So after I reply to the message created by the bot and received onMessage webhook, how could I know which 'initial activity' or 'reply chain' the replied message activity belongs to?

Or knowing the relation between the bot's initial activity and the user reply message?

Thanks.

richard1122 avatar May 09 '19 10:05 richard1122

Hi @richard1122 ,

You may check out the conversation object (and its id) from the incoming activity, by context.activity.conversation.id, and the conversation id looks like:

19:[email protected];messageid=1557438940572

which means Channel id + Reply chain root message id: 19:[email protected] is channel id messageid=1557438940572 is the parent / root message id of the current reply chain.

robin-liao avatar May 09 '19 22:05 robin-liao

Hi @robin-liao ,

Thanks for your reply.

I know that I could extract message_id when receiving updates from the context.

But when creating the reply chain ( bot send the first message ), no message_id is returned.

The only response from createReplyChain is:

export interface ResourceResponse {
    /**
     * Id of the resource
     */
    id: string;
}

The id is 1:1xel-XL7Sppbet .....

Which means I'm not sure how to get the message_id when creating reply chain.

Thanks.

richard1122 avatar May 10 '19 03:05 richard1122

@richard1122 you're right!! After some investigations, I found it's indeed a design flaw. It should've return new message id. Reopen this issue and will fix bug soon. Thanks!

robin-liao avatar May 10 '19 09:05 robin-liao