Make a Zap Work Between Mon - Sat, from 8am to 6pm (Otherwise Delay)

  • 12 April 2020
  • 5 replies
  • 2650 views

Userlevel 3
Badge

Hi everyone! 

Leo here from Zapier Support, hope you're doing well today!

Occassionally, we get a question whether it’s possible to make a Zap work between certain hours and certain days, otherwise delay.

There are a couple of options available, but when it gets complex, it will often involve using Paths by Zapier. Now, we know that not everyone needs a Pro plan (or higher), so we set out for a fun challenge to create a Zap that can do the following, without using Paths, in the leanest way possible:

1/ Allow the Zap to continue, if the Zap is triggered between Monday and Saturday, 8 AM and 6 PM
2/ Before 8 AM on Mondays to Saturdays > delay until 8 AM today
3/ After 6 PM on Mondays to Fridays > Delay until 8 AM the next day
4/ After 6 PM on Saturday, or the entire Sunday > Delay until next Monday

The Solution:

Trigger: use the trigger of your liking

Action: Formatter > Date / Time > Format.
Use input: {{zap_meta_human_now}}
Output: custom value: ddd HH

Action: Lookup Row in Google Sheets
Search column A by output of step 2

Action: Delay by Zapier > Delay Until
Use custom value > output step 3

Action: use the action of your liking

The Google Sheet you’ll want to make a copy of and add to your Google Drive is found here: http://zpr.io/t5HZv


The spreadsheet has 169 rows (7 days x 24 hours + 1 row header) to see if a certain timestamp can run immediately, the next morning or next Monday. I have tried creating a sheet which is easier to modify (different hours) . For instance, if you want to run this Zap on Mondays to Fridays, same hours, you can change cells J5, K3, K4 and K5 to “Next Monday at 8 AM”.

Additionally, if you start earlier or later, you can change the 8 AM in all the colored cells to update column B automatically.

The only thing that can’t be automagically updated is the ending time. If you want to run this Zap between 8 AM and 4 PM, you’ll then need to update a couple or rows in Column B manually.

To make it a little easier, here’s a link to a Shared Zap to get this working: https://zapier.com/shared/ff3e50176e7e7a931465c202ac67e1ef761ff160

 

How to get this working:

  1. You’ll first want to make a copy of the Google Sheet in your Google Drive. Sheet: http://zpr.io/t5HZv (click here for instructions on how to do that)
  2. Use the Shared link from above to make a copy of this template in your Zapier account
  3. Change the trigger to your liking
  4. Use the below extra details if you like
  5. Change the action step and add additional ones if needed


Some steps explained:

A/ Date formatting

As you can see in this screenshot, we’re changing the date time to ddd HH, so we can use that to look up how much the Zap will need to be delayed (if any).

B/ Lookup row

In this screenshot, you can see that we look up a row with the output from the date formatting step. This will allow us to retrieve the value to delay until for.

C/ Delay Until

With the result of the lookup-row step, we’ll be able to dynamically input the value for a delay until as a custom value, you can see that here.

You might wonder, what if my Zap runs on Monday 2 PM. According to the table, it will run at 8 AM, which is in the past. What will happen? Because of this setting, we can handle “past” events, up to 24 hours ago, which is well in our range.

 

Afterthoughts:

  • It’s definitely possible to use a Formatter > Utilities > Lookup table instead of the Google Sheets step, but the data entry can take… a while
  • Perhaps the date formatting and the lookup can be combined in one step by using Code by Zapier, but I’ll leave that challenge to you ;) 

I hope this will make it a little easier to get this working.

Cheers,


5 replies

 

Screenshot: https://www.screencast.com/t/XYaU7Ar1

I am stuck at step3. Find how much to "Delay Until" for

Please guide me what to select here

Userlevel 3
Badge

Hi @mahesh,

You should be able to find the configuration for the lookup row step here (I took this screenshot from the instructions just above):

 

 

If we have a Pro plan do you recommend Paths by Zapier. and if so can you share steps to make this happen? Or is it best to use the steps above?

Userlevel 3
Badge

Hi @DanB, it is possible to do this with Paths by Zapier, but it can become a little complicated in setting this up. You will also need to convert the current date and time to ddd HH and then use conditions like:

If ddd HH contains Mon, Tue, etc AND HH number is greater than and HH number is lesser than, you can make this work with Paths by Zapier.

Personally, I like the above version much better as it uses less tasks each time the Zap runs and you can customize it quite easily should business hours change and/or if you have different operating days.

Cheers 🙂

Userlevel 1

@Lionel_Selie  LEO! You ROCK!! 

Reply