Ways to trigger a Logicblock

When you create your Logicblock, you’ll find a few different options to launch it and make things happen. Apilio is so flexible that you might not be aware of all the different options available for launching your actions! Here’s a summary with all the different ways to trigger logic in Apilio :slight_smile:

1. Trigger a Logicblock directly via IFTTT

You can launch your Logicblock evaluation from IFTTT using an applet that:

  • IF (something happens) THEN (evaluate Logiblock in Apilio).

Thanks to our direct integration with IFTTT you’ll be able to find this action in the Apilio service: https://ifttt.com/apilio

image

When your applet evaluates, the resulting action will be to launch a Logicblock evaluation. It is handy to think of IFTTT and Apilio working together as a way of daisy-chaining applets, adding more functionality to IFTTT by routing the action flow through Apilio.

2. Trigger a Logicblock directly via webhooks

When you are looking at the show view of a variable or a Logicblock, you’ll find the different ways to update that element. One of the options is Webhooks, which is a URL that you can call from another service or app to perform an action. For our logic evaluation, we’ll choose the webhooks URL to Evaluate the Logicblock:

Click or tap on the icon next to it to copy the URL to your clipboard. You can then use this URL in the app or service of your choice. Similar to IFTTT, when that external service reacts to something, it will call this URL and perform the evaluation of your Logicblock. For example you can use webhook URLS in iOS shortcuts, your shortcut will be triggering the Logicblock evaluation.

For a more detailed explanation on how to use webhooks, have a look here:

3. Trigger a Logicblock indirectly: when the condition changes

Logicblocks have two elements inside them: the condition that makes them true or false, and the actions that should be executed.

In Apilio, it is possible to create triggering conditions that, when they change, they evaluate the Logicblock where they are being used. These are highlighted in the list of conditions in the Logicblock with a lighting bolt icon :zap: You can think of these as an element that, when changes, it forces the Logicblock to check whether it is the right time to be running some actions.

There are several different types of conditions in Apilio, some are always triggering, some can be made to be triggering when they change:

  • Tuya conditions: they use attributes from your Tuya devices. For example: if they are on or off, if they have detected someone, if they have detected a water leak, if the temperature is more or less than 18ºC.
  • Time event: this condition is only true during an instant. For example ‘it’s 8AM’.
  • Time frame: this condition has a starting and an ending time. The condition can be a trigger on both ends, when it becomes active and when it stops.
  • Conditions applied to a variable: if the connected variable changes, the condition can be made a trigger.

If you want to make a condition act as the trigger for a Logicblock, you can select this when creating the condition:

The time event, as it only happens on an instant, will always be a trigger for your logicblock:

For a more detailed explanation on how to use conditions in Apilio, have a look at this article:

4. Trigger a Logicblock directly via our REST API

You’ve seen that we can trigger our Logicblock via webhooks. Also in the show view, you’ll find the UUID ready to be copied so you can evaluate your Logicblock via our API.

Here’s all the documentation if you wish to give this a go:

How do I choose the trigger for my Logicblock :question:

We end with a table summarising all the different options and when to use them:

Evaluate Logicblock When to use it
via IFTTT When the trigger is available on IFTTT, maybe a service or device
via Tuya condition When using a Tuya device with Apilio
via Time Event condition When something happens in an instant
via Time Frame condition At the beginning and end of the timeframe
via Variable condition When a connected variable changes
via webhooks When using a third-party service with webhooks
via REST API When using a third-party service with API requests

If your trigger is a device, then you’ll be able to use IFTTT or our Tuya integration. You could also be monitoring a device through a variable that is connected to IFTTT or any other service via webhooks or our API.

For time triggers, you have time events and time frame conditions, also don’t forget our powerful cron expressions to setup very flexible time conditons.

For anything else that is connected to Apilio, you could use variables, webhooks, or even our API if this is something up your alley.

As always, if there are any questions, please put them below :blush:

2 Likes