2

Steps to replicate:

  1. Create a knowledge base in QnA Maker
  2. Save and Publish
  3. Create an Azure Web app bot from the QnA Maker portal
  4. Add Slack Channel by following https://learn.microsoft.com/en-us/azure/bot-service/bot-service-channel-connect-slack?view=azure-bot-service-4.0&tabs=abs
  5. Add the bot user in any channel in the Slack Workspace
  6. Post a message in the channel
  7. Bot responds by posting a new message instead of replying in a thread
  8. DM to the bot works as expected so as when already in a thread

There is no custom code. It is a Node.js bot.

Please advice on how to have the bot reply in a thread.

Thanks / Saurabh

  • 1
    You have to use parent message timestamp (`ts`) in [`chat.postMessage`](https://api.slack.com/methods/chat.postMessage#arg_thread_ts) API to post a message in the thread. – HenonoaH Mar 29 '20 at 16:50
  • Is the bot responding as expected on other channels? Also, do you get any error on the Slack channel's health tab? – ranusharao Mar 31 '20 at 23:09

1 Answers1

0

In D:\home\site\wwwroot\bots\qnaBot.js, add below code in this.onMessage handler.

if (context._activity.conversation.id.split(":").length == 3){

context._activity.conversation.id = context._activity.conversation.id + ":" + context._activity.channelData.SlackMessage.event.ts

}