Create filter based on time of day

(Jon Field) #1

Hey guys,
I would like to create a filter that delivers a new message and asks a new question based on the time of day the message is received.
eg if time i s0600-1400 - “the doctor will call you back at 1430 hours”

thoughts please?

(Karen Barker) #2

Hi Jon,

We store the time a message is received. You can use the date and time service to format this to return a time - Format HH:mm

On your message “the doctor will call you back at 1430 hours” you will need to add 2 filters that use the result of the date and time action.

  • Date and time is greater than 6

OR

  • Date and time is less than 14
(Deibys Paredes) #3

HI, Karen.

I’m trying to do this filter but it doesn’t work. Are there any step by step tutorial to work with datetime?
Thanks in advance.

(Karen Barker) #4

Hi Deibys,

Unfortunately at the moment we don’t have an tutorials that would step you through doing this precisely although we do have a tutorial on filters here.

What exactly are you trying to achieve here and I’ll happily help give you any advice/guidance that you may need. If you prefer feel free to email us the details to support@flowxo.com and we can discuss your requirements that way.

(Nash) #5

Hi Deiby’s not sure why no one has given you detailed help. Here’s how to do this.

You’ll need to first process the date into a simpler format. To begin, add a new action in your flow:

Click “More Services” at the bottom

Select Date & Time

Select Format Date

Now in this dialog, we need to specify which date we want to process. In this case, we want to process when the message was received, so we pick “{{user_is_asking_a_question.datetime}}” in my example

Then we need to specify what format we need this date in. I only need the Hour part so I’ll specify HH as the hour in format:

Click Next then Save and now you should have this action setup

Right after this date action, create your message action. In the filter, you want to add the condition that you only want to send this message if the time is between 12:00 to 18:00

So, in your filter, mention:

In the above, Value is the action you just created where we get the Hour. And the condition is that it has to be greater or equal to 12

We then add and AND condition which says the time is Less than and Equal to 18

I hope this helps!

(Nash) #6

Click “More Services” at the bottom

(Nash) #7

Select Date & Time

Edit: sorry, as a new user, I can’t post multiple pictures, so here’s the rest without the images:

Select Date & Time

Select Format Date

Now in this dialog, we need to specify which date we want to process. In this case, we want to process when the message was received, so we pick “{{user_is_asking_a_question.datetime}}” in my example

Then we need to specify what format we need this date in. I only need the Hour part so I’ll specify HH as the hour in format:

Click Next then Save and now you should have this action setup

Right after this date action, create your message action. In the filter, you want to add the condition that you only want to send this message if the time is between 12:00 to 18:00

So, in your filter, mention:

In the above, Value is the action you just created where we get the Hour. And the condition is that it has to be greater or equal to 12

We then add and AND condition which says the time is Less than and Equal to 18

I hope this helps!

1 Like