Autoposting comment to Slack but it's not replying in thread to the message timestamp provided

I looked into this and it’s fairly simple to implement this using the HTTP node and the Slack API. Here’s a mini-howto:

Lookup the Slack API Documentation

I looked at Slack’s documentation and found the chat.postMessage documentation.

Key elements from this page:

  1. Method access: POST https://slack.com/api/chat.postMessage
  2. Required scopes: we’ll re-use our existing Slack authentication, so this has already been taken care of.
  3. Content types: application/x-www-form-urlencoded - this defines how to structure the POST request - we’ll see this in our HTTP node settings below.

Arguments:

  1. token - this is listed as required, but I found that when using the oAuth2 authentication you can skip it.
  2. channel - you may already have this as output from your previous nodes. If not, you can get it from the Slack client by right-clicking on the channel name and selecting ‘Copy Link’. This link will look something like https://domain.slack.com/archives/C12345678D - your channel ID would be C12345678D.

image

  1. thread_ts - this contains the timestamp of the message that you want to reply to in-thread. Again, you probably already have this. If not, right-click on a message’s timestamp to copy the link. This link will look like https://domain.slack.com/archives/CHANNEL_ID/p1712219522769369. The numerical part is the timestamp, and it needs to be slightly reformatted to 1712219522.769369 for it to work in the API.

image

Set up the HTTP node

Add an HTTP node and set the fields as shown in the screenshot below!

And it worked!

image

I hope you’ll find this workaround is useful - we realize this is a good feature to add and hope to be able to add this soon-ish.

Also, I’d like to plug our upcoming Community Hangout of April 12 here as this is exactly the kind of thing that we’ll be covering there :slight_smile:

3 Likes