Reputation: 11
How would one go about posting an activity as a reply in Slack instead of a new message in the channel?
I have tried setting the replyToId
field and construct it like shown below, but the resulting message was still not posted as a reply.
// Create the reply
const replyActivity = MessageFactory.text(replyText, replyText);
// Post the reply as a reply to parent message
replyActivity.replyToId = context.activity.conversation.id
+ ':'
+ context.activity.channelData.SlackMessage.event.ts;
Tried appending the ID of the parent message to the conversation object and setting as the replyToId property but it didn't help.
Upvotes: 1
Views: 237
Reputation: 11
Of course, after posting I realize to try the following and it works. Sharing here for everyone's benefit.
// Copy the conversation object from original message
replyActivity.conversation = context.activity.conversation;
// Append the ID of the parent message to post our message as reply
replyActivity.conversation.id += ":" + context.activity.channelData.SlackMessage.event.ts;
Upvotes: 0