Question

How can I have a Zap run different actions depending on whether a message has been responded to within a certain amount of time?

  • 29 March 2023
  • 8 replies
  • 174 views

Userlevel 1
Badge +1

This post has been split from 

 

@SamB Could you please help with another scenario, where we actually want to trigger every new messages that does not go above 15 mins idle time (i.e the time between the last two messages) followed by some actions meanwhile messages coming after the idle time should be considered as the new set of trigger for the same actions. Keeping in mind we should be using least number of tasks. What would be the best way to do this? please share your thoughts.


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

8 replies

Userlevel 7
Badge +12

Hi @Jojin

This is definitely tricky as there’s not a simple way to track the time between messages. Can I ask if you want to measure the time between a message in Slack and a reply to the message (ie a threaded reply) or the time between one message in a channel and the next message in a channel? How you need to set up a Zap will depend on whether we’re looking at message threads or just the original messages. 

 

In terms of setting up different sets of actions depending on the time between messages, you can do that using Paths. Paths allow you to set up different actions in a Zap depending on conditions (eg if the time between the message and the reply is less than 15 minutes, use path A).

 

I hope that gets you pointed in the right direction. If you’d like some more help figuring out how to record and compare the time between messages, let us know!

Userlevel 1
Badge +1

Can I ask if you want to measure the time between a message in Slack and a reply to the message (ie a threaded reply) or the time between one message in a channel and the next message in a channel?

 

Here I want to get both thread and original messages ( tried paths by Zapier to happen this happen). For splitting them, tried API request action (used conservation.history/replies api) from slack. However, I couldn’t get timestamp in the case of original messages ( thread messages comes with thread-time so its fine)

Question#1 Could you help me with how to pull out the timestamp from originals messages meanwhile retrieve all new messages? or Is there any better way to do this? 


Question#2 How to compare times if we are inside paths. Rephrasing - how to transfer data output from Path A to Path B?


Question #3 Suppose we are using looping to fetch each new messages with a delay of 5 mins b/w each loop, how to pass the status of loop iteration #1 to loop iteration #2? or how to filter to only run loop iteration 2 after the loop iteration 1 and not to start at the same time like  run after loop 1 gets completed.


The trick here is that we need to look for any active messages right after the trigger “New message posted in a channel”. It’s more like an active trigger to fetch all the messages which stops it’s queue of lookup within 15 mins of idle time from the timestamp of last message sent. Hope there is a workaround 
 

Userlevel 1
Badge +1

@Danvers please go through the comment above and let me know if its possible.

Userlevel 7
Badge +11

Hi @Jojin! 👋
 

Question#1 Could you help me with how to pull out the timestamp from originals messages meanwhile retrieve all new messages? or Is there any better way to do this? 


Ah, it doesn’t look like we receive the timestamp for the previous message in a thread but if you use the API Request action you mentioned it looks like you should be able to retrieve all the messages in a particular thread and see their timestamps using the conversations.replies endpoint. See: Retrieving threads
637adaef83af4a1a55533507d7cc89ad.png

So you could potentially have a delay action then pull a list of all the replies in a thread with that API Request action, then do a comparison between the timestamps.

 

Question#2 How to compare times if we are inside paths. Rephrasing - how to transfer data output from Path A to Path B?


You can’t transfer data between paths. But if the times you want to compare against come from fields within action that come before the Paths, then the Paths would be able to compare those time values.

 

Question #3 Suppose we are using looping to fetch each new messages with a delay of 5 mins b/w each loop, how to pass the status of loop iteration #1 to loop iteration #2? or how to filter to only run loop iteration 2 after the loop iteration 1 and not to start at the same time like  run after loop 1 gets completed.


Adding a filter would not prevent the second loop from running until the first is finished. Filters are designed to either allow or halt actions from being carried out. They wouldn’t be able to hold the second loop from running, and continually keep checking to see if the first had finished running before allowing it to run. See Frequently Asked Questions > How do I stop a loop from running in subsequent action steps?

With Looping by Zapier it would perform all loop iterations all at the same time, not one after the other. So it likely wouldn’t be a good fit here.

The only other way would be to trigger for all messages and store information like the timestamps in a database/spreadsheet type of app like Airtable or Google Sheets. Then search the database for the relevant message to obtain the previous time to compare against. But even so, it won’t really reduce any tasks here as you’d be triggering for all messages. 

Hope that helps to answer your questions. Sorry to not have a more efficient solution to suggest. If you do manage to give those suggestions a try please let us know how it goes! 

Userlevel 1
Badge +1

@SamB Yes I looked into the Question#1 


My zap1 
It looks for any new message » filters by user » create a record in tables by Zapier » formats time by +15 mins » set the formatted value in storage by Zapier


My zap 2
new record » delay by 15mins » get value from storage by Zapier » filter = output delay value equals key value then continue » following the thread messages by API request.

Case#1
Here the value of timestamp of the initial message which is the 1st trigger msg for zap1 can be formatted by running pick from list and choose last option from the tables. This works however after the idle time I need to start new table by deleting all previous records which is not possible? Yes can do one by one but uses so many tasks.

Case#2 

I tried changing create a record to update a record ( overwriting the same row in the zap1) and also changing the zap2 trigger to update a record( from new record)
The problem with this was the timestamp of the initial msg will be overwritten while I don’t need to delete any records anymore.

PS: conservation.replies will show the timestamp however the filter is to fetch all new messages where we need the ts of the beginning message which is tricky to get.

Question:  Is there a way to do both at the same time? to fetch timestamp as well as without need to bother about deleting a record.

Userlevel 4
Badge +6

Hi @Jojin 

Hopping in to see if I can help!

Have you tried creating and running the Zap? If not, I suggest doing it first, and once an error occurs, we can try to troubleshoot it.

Userlevel 1
Badge +1

@SamB Could you please look into this link

Userlevel 7
Badge +9

Hey there, @Jojin

Catching up here and I agree with you, this is tricky and appears to be a beast of a zap. It looks like Sam gave some great recommendations to consider! I appreciate wanting this to be as efficient as possible though.

Full transparency, Zapier is a self-serve product. The more complex and technical a workflow, the more we lean on your expertise of apps and that of our Zapier experts. So while Zapier and the community don’t offer  implementation services at the moment, some Zapier Experts do! At this point, I’d recommend consulting with one to see how you’re able to improve your zap setup. Some of them are super active in the community so you’ll likely see some familiar faces. 🙂 

We appreciate you surfacing the conversation here and hope you’ll come back to share your wins with us!