Skip to main content

Hi there!

Here’s what I’m trying to do:
 

When someone sends a message in a channel (any message), I would like to trigger a response in a thread with a canned message. I know it’s possible to send a dm or to reply in the channel, but it would be ideal if it could happen in a thread on the person’s message so the channel doesn’t get too noisy. 

 

Thanks!

Ok that can be done too, but this is a little more complicated.

What needs to happen is to determine if the message is in a thread or not.

Among the data available from Slack, there are two ts fields, one is the message timestamp, and the other the thread timestamp thread_ts.

When these both have exactly the same value then it is channel message, and when they are different it is a thread message.

So now in Zapier, we need some way to determine if they are the same or not and if they are send the canned message.

Since both the values are Numbers, we can use a Formatter step with a spreadsheet-style formula to do a comparison.
 


So Now the steps look like:
 

  • Use the “New Message posted to channel” slack trigger,  
  • Compare if the TS field value is the same as the THREAD_TS field value
  • then filter out BOTS AND Thread messages
  • Then “Send Channel Message” making sure to use the Trigger thread timestamp in the Thread field.

 

I have updated my shared ZAP with this extra requirement as an example: https://zapier.com/shared/28ad5ecd691dcb034fc4367f321c29dca0020e9d


Wow thank you so much for taking the time to look into this and explain it so thoroughly! I really appreciate it :)


For some reason, @squibler your zap doesn’t work for me:

  • If I remove the “Ts Is true” condition, then the message gets sent just fine (but I have the message duplication error mentioned above
  • If I keep the “Ts Is true” condition, then the message never gets sent.

Any idea why? Note: I’m sending the message as a user, not bot.


Hi @jverb8 ,

This is certainly possible. It will require a Zapier account with multisteps, starter will do.

  • Use the “New Message posted to channel” slack trigger,  
  • then filter out BOTS, otherwise the reply will hit an infinite loop 😞
  • Then “Send Channel Message” making sure to use the Trigger thread timestamp in the Thread field.

 

I created a sample zap for you and shared it for you to copy.

https://zapier.com/shared/28ad5ecd691dcb034fc4367f321c29dca0020e9d

 

Daniel


I got it working! Thank you squibler!


I got it working so that when someone sends a message in the specified channel the bot autoreplies to them with a canned message in a thread. 

The issue I am running into now is that when I respond to the thread, the bot sends me the message as well. Do you know if it’s possible to only have the bot respond to a channel message, not a reply on a thread? 

Thank you!