I am using Bot Framework SDK for Javascript. My bot is connected to the Teams channel. Right now I am saving every outgoing and incoming message from my bot to the DB.
But I want also to save reactions of user to my messages. That is why I am using TeamsActivityHandler
and onReactionsAdded
method (link). In the docs there is written that replyToId
field of turnContext
is the id of message user is reacting to.
But when I am sending message to the user via turnContext.sendActivity()
I don't know the internal id which will be given to this message on Teams side, that is why I can not pair reaction to the message stored in my db.
So my question is, How can I get the id of the message after sending it via turnContext.sendActivity()
which will be later send in replyToId
field to onReactionsAdded
handler?
In other words I want to collect feedback (via reactions) on the messages my bot is sending to the user and save them to my DB (messages and reactions).
Actually it turns out (after some tries) that
turnContext.sendActivity()
returnsResourceIdentifier
which contains one fieldid
and thatid
is the id which will be given to the message on the Teams side.EDIT: For some ResourceIdentifier is empty when message sent to Teams is for example hero card. So this does not completly work.