How to run an action at a random times, like creating social media posts (for example)

  • 15 October 2020
  • 1 reply
  • 137 views
How to run an action at a random times, like creating social media posts (for example)
Userlevel 7
Badge +9

Hey hey! Welcome to another Wednesday, and another workflow. This one consists of multiple ways to accomplish the same thing. Let’s say you want to run an action at random times, whether that’s throughout the whole day or even within a range of hours.

Why would you want to do this? I can think of a few reasons:

  • You want to create social media posts and make it look more natural and random
  • You’re reposting from one platform to another and you don’t want the other accounts to repost right away
  • You want to send someone messages (maybe love notes) throughout the day but not always at the same time.
  • You want to receive a random cat GIF everyday, again at unexpected times
  • You want the actions to take place during certain hours (maybe 9 to 5) even though the trigger could be earlier

NOTE: these techniques can be used regardless of whether you’re using a Schedule by Zapier trigger or triggering your Zap from another app.

Method 1: Use a Spreadsheet-Style Formula to Generate a Random Number

Our Formatter app has a function that lets you use spreadsheet-style formulas. Don’t worry — this one is SUPER easy. It’s RANDBETWEEN. You choose a minimum number and a maximum number and it will output a random number within that range.

Then you use that number in a Delay For step, using that output for minutes or hours. I prefer to use minutes because it allows for a lot more variability. So maybe you want to perform the action 1 to 4 hours after the Zap is triggered. You could do something like this:

Formatter → Numbers → Spreadsheet-Style Formula

Delay by Zapier → Delay For

Then you add whichever action(s) you’d like to perform.

Method 2: Use Pick From List Populated with Random Times

This won’t necessarily provide as much variability, but maybe you’d like to have a bit more control over the possible times at which your action(s) will be performed. 

If so, you can use our Formatter app’s Pick from List function, with the random option chosen:

In this case I only want my actions to be performed between the hours of midnight and 3 am, so I chose some random times within that range.

Then I would use a Delay step:

Method 3: Use a Code Step to Choose a Random Number in a Range

As with most things we do with Formatter steps, it can also be done using a Code step. I’m personally no expert, but after consulting one of my colleagues I can pass along that this will generate a number between the two that you specify:

import random

int = random.randint(60, 240)

output = [{"random_int": int}]

Then just like above you could map the output of this step into your Delay For step. 

Smarter people than me could likely generate a random time between two times that you’d provide. But that’s beyond my current skillset!

Hope this helps some of you to run your actions at random times :) If you’ve got other methods I’d love to hear about it!


Reply