You can! Using conditional logic and multiple criteria, you can customize when your automation will run.
IFTTT Pro+ comes with a powerful tool for writing the logic for your Applets by using filter code. To get started, create your own Applet, or automation, by adding a trigger and at least one action.
This unlocks the filter code editor. Click on Add filter.
The filter code editor lets you write JavaScript to skip actions or update action fields on the fly.
For example, if you want an Applet to only run the action between 7am and 9pm you can add this filter code.
let currentHour = Meta.currentUserTime.hour();
if (currentHour < 7 || currentHour >= 21) {
Email.sendMeEmail.skip();
}
To only run an action at night you can modify the condition slightly:
if (currentHour > 7 && currentHour < 21)
Keep in mind, you are setting the condition for when the Applet should skip an action! All actions run by default when the Applet's trigger fires.
Below the filter code editor you have helpers that show the data you have access to in the code:
If you want to skip two actions, copy and paste them in the code:
let currentHour = Meta.currentUserTime.hour();
if (currentHour < 7 || currentHour >= 21) {
Email.sendMeEmail.skip();
IfNotifications.sendNotification.skip()
}
For more examples and ideas, check out our more in-depth articles on filter code and queries.