Re: Restricting flow steps in Smart Campaign to M-S between 7am-6pm

Mark_Price
Level 7

Re: Restricting flow steps in Smart Campaign to M-S between 7am-6pm

There wasn't a Sandy codepen for momentjs so went with the ol' timezonedb..     

Nice idea on the webhook response!  I was thinking it was just needing to sleep for 'their business hours' but now see they want it to send 7am - 6pm in the recipient's timezone.   

Melody_Frieda1
Level 2

Re: Restricting flow steps in Smart Campaign to M-S between 7am-6pm

Thanks Mark, for the feedback and options--and Sanford Whiteman​ for chipping in again.  Do the above options depend on a Marketo form submission? If so, it won't work for us. We have an application online that sends information to a centralized databased--and that is what is connected to Marketo via API. I would trigger this campaign (actually all of my campaigns) from Data Value Changes.

Ideally I need a solution that requires minimal "coding" experience. Something simple like:

  • Concatenate time stamp from DateTime field to it's own custom field
  • Smart campaign is able to look up value of field (assuming Marketo smart campaign's understand how to read timestamped values in fields--example "If timestamp field is greater than 7:00:00 PM, place into 'Afterhours' list"--and another  smart campaign would have to be created to replicate the original smart campaign, but correcting for afterhours applicants)

I'm a just a lowly Marketer with zero budget for data architects hoping to hack this together on my own 😞

Mark_Price
Level 7

Re: Restricting flow steps in Smart Campaign to M-S between 7am-6pm

Hi Melody,

Options A and B aren't Marketo Form specific, but the example certainly is.  Those solutions are intended to be used when data is submitted somewhere (but doesn't have to be Marketo).  If using the API, you would basically just add another field to that process and when the data is added via the API include the new data point. 

Justin_Norris1
Level 10 - Champion Alumni

Re: Restricting flow steps in Smart Campaign to M-S between 7am-6pm

Melody Frieda

The options that Sanford and others have suggested using a webhook with a gateway are ideal and the most scalable. FlowBoost is good for that.

However if you want a "no-code" version, you can check out this post I wrote a few years ago: https://nation.marketo.com/community/champion/blog/2016/01/19/marketo-time-based-logic-for-emails-le...

I might do a few things differently if I was writing the post today, but it gives you the gist of things. Instead of triggering on the form fill you can do a time stamp on your data value change and calculate from there.

It does require SFDC to do a CASE formula for the day of week though.

Justin 

SanfordWhiteman
Level 10 - Community Moderator

Re: Restricting flow steps in Smart Campaign to M-S between 7am-6pm

No CRM though.

Justin_Norris1
Level 10 - Champion Alumni

Re: Restricting flow steps in Smart Campaign to M-S between 7am-6pm

Didn't realize that.

In that case I also think that Mark's option C above with Sandy's suggested modification is your best option and could be achieved with an off the shelf webhook service and a bit of help from a professional to develop the script. It's a pretty small project and will get you on your way.

SanfordWhiteman
Level 10 - Community Moderator

Re: Restricting flow steps in Smart Campaign to M-S between 7am-6pm

  • Concatenate time stamp from DateTime field to it's own custom field

Think you mean "split" (deconcatenate) as opposed to "concatenate". Though actually you don't need to worry about this if — as should be becoming clear with everyone's input! — you're going to be passing the token to an external service. That service can handle just looking at the time portion, you don't have to split it out beforehand.

  • Smart campaign is able to look up value of field (assuming Marketo smart campaign's understand how to read timestamped values in fields--example "If timestamp field is greater than 7:00:00 PM, place into 'Afterhours' list"

There's no such thing as a Time-only datatype, only Date and DateTime, though you can use an Integer field to store the seconds in a day. But you don't need to worry about this workaround, because the heavy lifting is going to be done by the external service you call as a webhook. The service will write to DateTime and/or Boolean fields.

As Sydney mentions, said service could be built on a freeform webhook platform like FlowBoost: FB happens to be JavaScript-powered, so in that case the webhook payload -- the script code -- would naturally be JS.

Or you could build a bespoke service that does this one function, and any language could be used; Jay favors PHP, for example, and as long as you don't try to sleep any processes (just returning data immediately from the 'hook) that would work fine. Someone else might turn it around quickest in Python or Java or whatever they know.

But no matter what the underlying code is written in, you're gonna need something custom to get this done.  You don't have to write the code, just provide a block of configuration info (in the case that Sydney's talking about, there's a {{my.token}} with the business hours, business days, timezones and such, and that's all that the end user ever needs to touch, so they aren't touching the code itself).  But believe us when we say that there isn't a hack that doesn't use an external service to some degree.

SydneyMulligan
Level 10 - Champion Alumni

Re: Restricting flow steps in Smart Campaign to M-S between 7am-6pm

Hey Melody! Similar to what Sanford Whiteman​ mentioned, I've accomplished this functionality (with Sanford's help) using a webhook called Flowboost. The code in the webhook checked if the current time was acceptable (there was an array of blackout dates which were holidays, weekends were always blacked out, and there was a timezone variable to handle sending in different time zones) then a campaign was requested to execute the desired operation, if not a campaign was requested to wait until the next morning then check again.

Diane_Condon1
Level 1

Re: Restricting flow steps in Smart Campaign to M-S between 7am-6pm

Hi Melody,

Thought I would throw this out there - not a total solution for what you're trying to accomplish, but it's another way to think about business hours. We don't use wait steps. We basically want to stop automated emails from sending outside of our business hours (not the lead's time zone) and so we date time stamp users in a "Email System Time Field" and then use a smart list (screenshot below) to see if they are in our defined business hours. If they qualify for the smart list - we send the email. If they don't - we add them to a static list. Then we have a batch campaign that runs M-F at the beginning of our business hours to users that came in during the night/weekend. For holidays, we have an extra step to pause these emails from sending. 

Business Hours Smart List.jpg

Diane
SanfordWhiteman
Level 10 - Community Moderator

Re: Restricting flow steps in Smart Campaign to M-S between 7am-6pm

Ah, but it seems like you already have a String field you're using to represent only the time, which is exactly what the OP doesn't have! (I would've done this w/24-hour time -- no need to deal with AM/PM.)

You're on to something in the sense that you can run change Change Data Value against a String field, with the new value a DateTime {{lead.}} token. This will give you the ISO 8601 string representation (mmmm-YY-dd hh:MM:ss) of the date. That string always has a space before the hour (hh). Out-of-the-box you can't search on a leading space (it's stripped out) but if you hack around that using the same mechanism I use to create line break tokens, you can filter on the leading space followed by the hour.  It would be really fragile, though.