Adding Time Conditions to an Automation
Adding Time Conditions to an Automation
Streamlining Automation with Time Conditions
Automation is a powerful tool that can save time and increase efficiency in various workflows. In this blog post, we'll dive into the intricacies of adding time conditions to automation processes, as discussed in a recent script conversation. By incorporating specific time conditions into your automation flow, you can customize actions based on the time of day, day of the week, or other time-related parameters. Let's explore how to implement these time conditions effectively.
Understanding the Process
The conversation highlighted the process of duplicating an existing automation flow and modifying it to include time-based triggers and filters. The goal was to create a scenario where specific actions are taken based on the time of day, such as distinguishing between weekday work hours and after-hours or weekend responses.
One of the key challenges discussed was configuring the automation to trigger specific actions based on the time range, such as between 5:00 PM and 8:00 AM. This required setting up filters and conditions within the automation flow to determine the appropriate responses based on the current time.
Implementing Time Conditions
To effectively incorporate time conditions into your automation process, consider the following steps:
1. Define Time-Based Triggers
Start by defining the specific time frames or conditions that will trigger different actions within your automation flow. This can include specifying weekdays, weekends, work hours, or after-hours periods.
2. Set Up Filters and Conditions
Create filters and conditions within your automation platform to evaluate the current time and date parameters. These filters will help route the automation flow to different branches based on the specified time conditions.
3. Test and Validate
Before deploying your automation flow with time conditions, thoroughly test and validate the setup to ensure that the logic accurately captures the intended scenarios. Use test data and scenarios to simulate different time conditions and verify the outcomes.
4. Monitor and Refine
Once the automation is live, monitor its performance and effectiveness in handling the specified time conditions. Continuously refine and optimize the time-based triggers and actions based on real-world usage and feedback.
Conclusion
Incorporating time conditions into your automation processes can enhance the efficiency and personalization of your workflows. By leveraging specific time-based triggers and filters, you can tailor your automation responses to align with different timeframes and scenarios.
Automation with time conditions opens up a world of possibilities for creating dynamic and responsive workflows that adapt to varying time-related parameters. Whether you're scheduling messages, triggering actions based on work hours, or implementing after-hours responses, integrating time conditions can streamline your automation processes and enhance user experiences.
Stay tuned for more insightful tips and strategies on optimizing your automation workflows. Happy automating!
Video
Steps
Step 1- Click on Get Current Date—Click on Current date result to get the current date and time
Step 2- Search for text in Search box – Select and click on Text Helper
VIDEO TRANSCRIPT
Duplicated the, well, I duplicated the other automation and just changed, it was exactly the same. I just changed the text message and then I wanted to just make this one trigger the other automation, but then two things, I couldn't mess with the trigger. So, and then the other thing was. I made this branch based off of if it is, let's see, I was messing with this.
So it's like, if it, if the text has Saturday or Sunday in it, then it would send this. But the other thing I'm trying to figure out is if I can make it in between. Like after five o'clock PM to eight o'clock AM, you should be able to have the phone, like all the functionality to do that should be here.
It's just a little complicated because you're working with like a lot of time and filtering, um, and probably some like math for the time. Um, I haven't set this up. This is how I would be going about it is just using the filter and those date, uh, those date, um, apps that you have already. Um, Yeah, as far as a specific time, I'm not, I don't know if I'm familiar enough with the date app specifically trying to build something like this, um, but I definitely think it would be doable.
What is the, what does the output look like when you have like the current date? Could you show me what that step does? So it allows you to change the, let's see. So when you get the current date, you can change the stat. So I made it like this. So that way I could see. So it says the day. Oh, here we go. So where it says Sunday, it's like, I was just trying to be where it says the day of the week and then it says the time, but it looks like it's like army time, but when I pulled it, it was like, I don't know how to filter it because you can't, you can only do it.
Like if this number contains like, this is the time I'm imagining. Right? Right. Yeah. It's probably military time. Yes. This is our minute seconds. So our mid seconds. So that's what it's pulling. And then if I tried to go into the branch, then I have the text does not contain Saturday or Sunday. So that's that.
And then it's like, and, uh, then there's all of these, but it's like contains, but I can say a number, but the thing is, like, if I do text contains, it's like, I can say. Uh, if I were to say 16, like there can be 16 here, here or here, you know, what you're probably going to want to do is get fancy with the text helper app.
Can you can you quickly add the text helper app in between step 3 and 4? Yeah, and then just type text and this will kind of give you an idea of the direction there. Okay, so action, uh, you'll do split and then what you can do here is you can enter a semicolon since the first semicolon shows up after the hour mark is what I noticed.
So just enter a, um, is it a semicolon? Right? Colon? Yeah, colon. Yeah. Um, and then, uh, Or sorry, the text is going to be whatever step three returns. The delimiter is going to be the colon. So yeah, that'll be the colon. Correct. So what I'm hoping this does and then go ahead and click test step. Let's see what this returns.
Okay, so now we have. The hour is the last space . So I'm trying to think about how we can go about this. There might, I think this is the hour. Yeah, the last one of the first there. So I'm trying to think of the easiest way to do it. Hour, minute, second. Yeah. Um, okay. What we might want to do instead, can you.
Can you open up your date helper app really quick? And then let me see the format of that. Can you copy and paste that text for me? The result just a Thursday through? Yeah, just page. Whatever. I'll get what I need there. You want me to copy and paste it? Where? Yeah, if you could post it in the Google meet chat.
Oh, what the? Oh, here we go. Perfect. Yeah, that's fine. I'll get what I from that.
Okay. Um, really quick. I'll just share my screen to show you what I'm going to try with this rest. I wonder if there's also just a thought. I mean, yours is probably better than mine, but I was like, what if I did another current day helper and just change the format to a different format? So I can pull we're going to use the format is fine.
Well, we're going to use, it's called regex. Um, what that is, is it's like a, it's like a rule for extracting information. So basically what we're setting up is a rule that will always return the hour only from this. So you're going to get 16. That way you can say, if this number is greater than 12. It's afternoon, right?
That's kind of the way I'm going about this. Yeah. Let me quickly. Okay. Can you open that split app again? The text helper and then, uh, on the right there, instead of action being split, can you open the actions again? And it's going to be find, which is where we're using rejects. The text again is going to be what the date returned.
Make sure you only have the result if you click two of them there, so it would add extra information. Just go ahead and delete that. Perfect. And then the expression is what I pasted in the chat of Google meat. It's a little weird. I want to test out if this works and then I'll explain how I got that afterwards because it's not supposed to make sense what it looks like.
And then go ahead and click retest. Um, after it finishes saving for you, it might take a second to save the text. The text app, for whatever reason, has been really slow to save sometimes with the edits. Um, if that's safe for you, you'll be good. Let me, in the meantime, uh, I'll just share my screen since that's saving so I can show you how I generated this, um, and then we can edit it.
Can you see my screen okay? Um, it's like loading. Yep. Okay. So I just, I mean, I just gave this really simple prompt to chat. GPT have come up with a regex expression for this text and saying, I want to find the hour mark and then it should be able to very easily know that obviously, um, and we're just grabbing these regex expressions and we can adjust this however we want.
So what this is, uh, chat, GPT explains it here, but it's just a, it's a format. It's allowing us to basically create a rule saying this is always the right text and this type of a regex expression is really useful for things like extracting emails, extracting addresses or something where you like have a perfect rule in place of basically grab this every time.
Um, easiest way to do that. So I just had Chachi Petit generate this and then what we're going to do. Is we're going to test this expression and make sure it worked properly in apps and that it pulled just 16. If it doesn't, we're just going to tell Chachi BT what was wrong, get a new expression and kind of retest like that.
It's the easiest way compared to having to learn how reject expressions actually work and how to build them themselves. Okay, um, did that app step save for you now so that we can retest that? Um, yes. There we go. Okay. And then retest. Sweet. Okay. Um, so now what I expect we can do is we can set up a filter to say if step 4 is greater than, uh, 5, what would it be?
17? For 5pm? Yeah, 17. Or that's that, would you wanna go about that? So it'd be like the date is this and then the time. Okay. Make sure that you, yeah, this would be result from step four. Correct. And then it would be greater than
number is greater than, and then, um, if you're doing 5:00 PM 17. Yeah.
And then we would do and and the same thing. So find is less than,
uh, 8 o'clock a. m. is what it'd just be 8. 8. Yeah. So if it's less than 8.
Let's see. So yeah, if it's less than greater than 17 or less than eight. So is it this should be right? Right? Like, so it it's so it's not Saturday. It's not Saturday. You should you're also checking that. It's not Sunday, right? Yeah, so I did another one down here. Oh, okay. Okay for this so it'd have to be if it's not Saturday Oh, I would have to make this if it is Saturday so I have to do the I have to do the inverse of this so like Because this is the this is the false one You I think that you're going to want your Sunday condition to be and not or so you're going to want to check.
I want to make sure that it's not Sunday and it's not Saturday. I mean, it depends. You can check. It depends how maybe we're trying to check opposite things. You're trying to check if it's not the weekend and I'm trying to check if it is the weekend. I think we're talking, we're doing the opposite thing there.
But yeah, that's the logic that you'd be setting up is, is it not Saturday and not Sunday? And then is it? Within 8 to 17 is kind of what we're looking at. So it would be greater than 8, but less than correct. So, yeah, right. That sounds right. But less than 17 because this would be so this one. Yeah, so I'm trying to make it if it's true Then it's the weekend.
It's the weekday during work hours and if it's false then it's a week It's the week after work hours. Got it. Okay, then Yeah, we should make that an and condition for sunday too. Otherwise, this is going to basically always pass if it's not sunday, um So and correct and then that would be and then you're going to want to delete the or statement there You I think it's the next mark next to condition on the left right there.
You see, like, Oh, yeah, there we go. Okay, cool value. And then current date, Thursday contains Sunday. Yeah, and then I just double check your conditions because it's really easy to flip what you're checking against or for in this, especially when you're chaining a bunch of these together, uh, you're doing it does.
Yeah. Okay. There we go. Now, both of the weekends are does not contain. So then test this. Yeah, I think that it's probably best. Let's click test step. I mean, nothing bad can happen from here. We'll just see. Um, it's true. So what I would do is I would, um, what you can do this is and also we have these, I'm going to have to jump on another one in a couple of minutes, but I want to give you kind of best steps on this.
What I would probably do with your filter here is remove all of your variables, like remove all of the, this is coming from step four, this is coming from step three, et cetera, and just test with like. I guess more with, um, hard coded values. If that makes sense. What I would do is just make sure you can edit and test your filter a bunch of different ways.
Like, right now, what I'm saying is if you wanted to check for a different condition today is you can't test for a different day until tomorrow unless you're. Manually update it. So just a suggestion to kind of do that with your filter and then add all your variables back because you have a bunch of different things here.
Um, that's, that's at least what I would do. Um, but I think we have the conditions set up or at least the structure of the logic should be right. Okay, I can do that. And then, um, I guess the last thing real quick, just on this one before you go is I wasn't running into an issue of it wasn't letting me switch to this automation because this So this webhook trigger is what I need to copy into.
I need to paste the webhook trigger from the, from the actual, uh, automation. So like I have these two automations. There's, uh, this is the one that's running and then this was the duplicate. Okay. Um, wait, no, that one's an old one. This is the one that's currently running. Okay. This is the duplicate. So this is the one it's exactly the same.
The only thing that I did was change the text message to be like, Hey, you caught me after Um, I mean, I was trying to change the trigger, but it won't let me change the trigger. Uh, that's odd.
If you click the click to edit your webhook trigger, does it let you in there? Even if I click over here on, let's see. Manage trigger. It doesn't do anything. That is definitely odd. Uh, one second.
Um, well, I can assume you're going about this the right way then. Yes, you would be grabbing the webhook trigger. It would have a different URL, although it's going to look identical, um, yeah, pasting that in that for that opposite one. Um, one other option not to make you want to redo anything. You could send your message as a variable.
So that that filter, um, so you only need one automation, and then it has a message variable coming from apps that adjusted based on weekend or not, since that seems like the only thing you, you change there. But the way you did about it, you, the way you did it is definitely a easy to manage doable way.
Okay. Um, The after hours one is the trigger you're trying to edit. Yeah. Okay. Um, I do not know why it's not opening for you. I was able to open this quickly. Here's the web hook URL. Let me give that to you really quick for that automation. Um, so that you can that's the after hours 1. Okay. So I just put this here.
And then that should be good to go, right? Correct. You wouldn't need to do any additional setup with that. That's all going to be the same. Um, but I want to know why you can't open that. Do I still need the split step? I don't remember what we were using that for. Because this was finding This is pulling Oh, then no, you don't need that split step.
Uh, we're not going to do it that way anymore. That's correct. I was hoping to and then I realized it was going to be a lot more complex and we can probably just have ChatGPT make that quickly. Okay. Yeah, so okay. I might need to jump onto the call with you. I can do all the duplicating side of it But I'm sure I'll run into something.
I just need to duplicate this. It's just it's the same exact flow The only thing I need to change is I need to duplicate these and then just change like the login information Okay, did we use cookies or did we log so we logged in? It looks like we logged in. Yeah. Okay. Um, really quick. I'm gonna I want to make sure that you can enter your, uh, automation and everything for that trigger.
So let me quickly. Can you do me a favor and click the, um, can you hold down command are on your computer for a few seconds? So the app reloads, it should go like white after a few seconds. You can let go now. That's okay.
And then I just want to make sure it loaded the changes for the automation. Can you click into that after hours one again? And then it'll probably show that your trigger is not set. Can you click that now? Is it still not letting you click that? Oh, there we go. Oh, okay. Um, and then yeah. And this is, this is what you copied.
Basically, you don't need to change it. Um, can you click, uh, can you click back into the citrus automation there? And then can you try clicking, I just want to make sure that like, you can click back into the trigger. Um, can you just try clicking like the click to edit again and things like that? Okay. Um, it might've been something with duplicating the automation.
All we're finding out why that was, webhook URL I gave you is the right one. Um, Let me know where you get with the filter stuff. Happy to jump on. But yeah, for editing your, your login steps, I think that you have those, uh, step two and step three. So you can just update those and you should be good. Okay.
And then I can just turn this on from the cloud, right? And then we're good. Yep. Yeah, that's a lot of very, very weird things going on with like the hover menus, not running properly almost, um, but we got it working. So we're good there. So I just published this. I'll talk with my team and just make sure it's all working.
And then if once it works, I'll duplicate it. And then I'll probably schedule another call with you just to make sure everything's running smoothly, but sweet. Awesome. I'm glad you're able to figure out some of this date stuff. It's some cool kind of extra logic to add your automation. Yeah, yeah, it's gonna be it's just cool.
My office staff was like, hey, this is awesome. But like them people They get a text in the weekend being like, oh, yeah, call me in five minutes and then yeah our office It's nice. It's nice when you start having problems from the automation helping you and then you have to adjust the automation to To account for that.
But yeah Cool. Yeah, feel free to schedule a call when you need a little bit more help there Um, yeah, keep me updated on the things you're building. Definitely happy to help