SOLVED

Re: Running Flows based on Time of Day

Go to solution
Robert_Stanley
Level 3

Running Flows based on Time of Day

Does anyone know of a way to only have Smart Campaign Flows run during certain times of the day? We are looking to have an automated message sent out to individuals who fill out "Contact Me" forms on off hours, 5pm to 9am.  If a form is filled out between 9am and 5pm then it should skip the step. Same with only having Flows run on weekends as well. 

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Running Flows based on Time of Day

Could you give an example of what this looks like?

Well, every webhook/scripting engine is going to look different. Generally speaking you'll be sending {{system.datetime}} in the webhook payload, then getting back a true/false for on-hours/off-hours.

The schedules could be expressed in several different ways, like cron-style*:

* 8-16 * * MON-FRI

* 9-17 * * MON-FRI

Or more JavaScript-y:

8to4 : { startHHmm : "08:00", endHHmm :  "16:00" },

9to5 : { startHHmm : "09:00", endHHmm :  "17:00" },

SchedulesByOffice: {

  "New York" : 9to5,

  "Los Angeles" : 8to4,

  "Columbus" : 9to5

}

I should have been clear that you either need to be using a scripting plug-in for Marketo, or hire a developer to build a special-purpose one.

*The cron and JS object examples here aren't complete or exactly equivalent, but you get the idea.

View solution in original post

5 REPLIES 5
SanfordWhiteman
Level 10 - Community Moderator

Re: Running Flows based on Time of Day

We do this using a webhook to call out for business hours/holidays (also depending on region) and only call the alert campaign if allowed.

Robert_Stanley
Level 3

Re: Running Flows based on Time of Day

Thanks for the reply Sanford! Could you give an example of what this looks like?

SanfordWhiteman
Level 10 - Community Moderator

Re: Running Flows based on Time of Day

Could you give an example of what this looks like?

Well, every webhook/scripting engine is going to look different. Generally speaking you'll be sending {{system.datetime}} in the webhook payload, then getting back a true/false for on-hours/off-hours.

The schedules could be expressed in several different ways, like cron-style*:

* 8-16 * * MON-FRI

* 9-17 * * MON-FRI

Or more JavaScript-y:

8to4 : { startHHmm : "08:00", endHHmm :  "16:00" },

9to5 : { startHHmm : "09:00", endHHmm :  "17:00" },

SchedulesByOffice: {

  "New York" : 9to5,

  "Los Angeles" : 8to4,

  "Columbus" : 9to5

}

I should have been clear that you either need to be using a scripting plug-in for Marketo, or hire a developer to build a special-purpose one.

*The cron and JS object examples here aren't complete or exactly equivalent, but you get the idea.

Robert_Stanley
Level 3

Re: Running Flows based on Time of Day

Sanford, just want to thank you again.  We had a web developer create a webhook that was able to accomplish this.  Thanks!

www.ourwebsite.com?checktime=true&checkschedule={%22starttime%22:%2209:00%22,%22endtime%22:%2218:00%22,%22dayofweek%22:%22MON-FRI%22}&current_time=2017-11-07%2017:36:13

SanfordWhiteman
Level 10 - Community Moderator

Re: Running Flows based on Time of Day

Cool!