If This Then That is a service for automating tasks and creating pipelines from actions in different services. This is the most famous and functional product on the market, but its popularity has hurt it: the full-fledged creation of applets is now possible only with a paid subscription, and reddit periodically complains about the unstable operation of the service. As with any useful but paid product, those looking for alternatives will find them in the open source community. We will compare three self-hosted tools: Huginn, Beehive and Node-RED, try them in action and choose the best in functionality and usability.
Huginn is one of the oldest services for automating routine tasks, the first version was released in spring 2013. In Scandinavian mythology, Hugin and Munin are Odin’s ravens, bringing him news about everything that happens in the world, but here he is the manager of agents who perform small tasks for given triggers. Agents can be chained and generally organized into structures of arbitrary complexity. Hugginn is even sometimes used by entire companies to automate processes (example>). Agents can:
- Monitor any site and respond when certain information appears. Basic example – an agent checks the weather forecast in the morning and sends a notification if it rains during the day
- Follow topics on twitter and pay attention to the peak of mentions, for example, during a heated discussion
- Watch for price drops for goods / tickets / subscriptions / etc
- Track mentions like Google Alerts
- Track changes to entire sites or parts of them. Suitable for those web scraping cases that are not covered by the options above. For example – hang up an alert for a change in the user agreement page or a product moving from beta to release
- Recognize plain text quest chains via Amazon Mechanical Turk
- Send and receive webhooks
- Track current geolocation and save movement history
- Use integrations with open APIs of any services (quite a few are already ready, but for exoticism you will have to write your own agent, this is not difficult)
- When the trigger fires, run custom JS / CoffeeScript code without directly editing the agents
- Aggregate all actions in one process and produce a digest on several topics at once
- Send alerts and generally any output via RSS, webhooks, EMail and SMS
All running agents are automatically visualized as a graph to make it easier to create task chains and more complex structures:
Over seven years of development, Huginn has built a community adding new agents as needed. He also has an open Bountysource program…
Hereinafter, we will consider only the server installation, because such services obviously have nothing to do on the home machine. The service should run on a hotel machine with a dedicated address and predicted uptime and be accessible from different devices, so a home installation is only suitable for development.
Huginn is distributed as a docker image, so install docker, then just run:
docker run -it -p 3000:3000 huginn/huginn
We are waiting for installation and launch, then we go to port 3000, log in under the default admin: password account and see the service completely ready for work. By default, Huginn already has several agents (they were on the graph above), but we will create our own chain from scratch.
First, let’s create an agent that reads the RSS-version of Habr:
All available options and general information for each agent are indicated to the right of the fields, conveniently. For now, we don’t need any fields other than
url… We insert the address, save it, go to / agents / new again and make an agent that reacts to data from the reader agent:
Then we create a script from these two agents and put it on launch.
In the Beehive, agents are called hives now wiki list has 43 ready-made hives. They can:
- Read and post on social networks and instant messengers, forward posts from one service to another. Supported Twitter, Telegram, Facebook (limited), Slack, Discord, Tumblr, Mastodon, Jabber, Rocket.Chat, Gitter, IRC, Mumble
- Monitor sites, RSS and OpenWeatherMap. For the web, you can also appear not only as a client, but also as a server, responding to incoming requests.
- Send by trigger HTTP requests, push notifications, EMail, SMS, messages in any of the above services, post to Pastebin, upload files to S3.
- Aggregate monitoring data from GitHub, Prometheus, Nagios
- Use as a trigger not only standard events and a timer, but also a full-fledged cron.
- Execute arbitrary commands from the host system
- Monitor individual directories on the host system
- Control smart lighting compatible with Philips Hue
Many hives do not deal with a specific task, but simply provide separate features, such as sending data over UDP. In general, the number of integrations in Beehive is less than in Hugginn, but they are made more functional, and the number of options for sending data is generally off scale.
We need docker again and one command:
docker run -it -p 8181:8181 fribbledom/beehive
But the admin panel will confidently refuse to load due to requests to localhost, so you have to forward the address:
docker run -it CANONICAL_URL="http://your.ip.address.here:8181" -p 8181:8181 fribbledom/beehive
Authorization is not provided – apparently, it is understood that without authentication you simply cannot get into the admin panel.
The process of creating tasks and chains is shown in full on gifs from the repository:
Here we are already dealing not just with an agent-manager, but with a full-fledged platform for organizing tasks, focused not only on programmers, but also on ordinary users. Like its counterparts, Node-RED, in addition to using ready-made scripts and modules (nodes), allows you to define custom tasks, their logic and triggers. But if in other managers any customization means writing an interface (or a whole module) from scratch or rewriting an existing one, then here you can create all tasks and scripts without leaving the browser using visual programming of data streams. Creating modules still requires programming skills, as well as working with the API or the core of the system, but in general, of all three options, only this one is really close to IFTTT in terms of ease of use, and in addition to the widest functionality, it also has the largest community, spreading thousands self-written modules and scripts.
An example of organizing a script
Node-RED offers several installation options, including npm, cloud deployments, and even Raspberry Pi installations. Detailed instructions for all options here, and here is the simplest docker image installation:
docker run -it -p 1880:1880 -v node_red_data:/data --name mynodered nodered/node-red
-v node_red_data:/data will mount the node_red_data directory in / data of the container so that any changes made to the script are saved.
The Node-RED instance will be available (without authorization) on port 1880. Since the hello-world example will not help at all to understand the rather complex structure of the script, it is better to read the full tutorial. here.
It is safe to say that not a single open source product will be able to repeat the success of IFTTT in self-hosted – too much time and resources will have to be invested in development, which most likely will not work and will not bring income. Therefore, all three tools have a narrower niche: they help automate tasks not for everyone-and-everyone-in-two-clicks, but only for real nerds who are ready to write their modules and delve into someone else’s code, because it is they who really care about the shortcomings IFTTT business model tying their hands.
- Hugginn – Covers a lot of basic scripting out of the box, quickly creating tasks and scripts. Advanced options require a lot of code and debugging, little really working integrations with third-party services. Allows you to implement basic logic in scripts.
- Beehive – a lot of ready-made integrations that are clearly written by developers primarily for themselves. If your script is not based on complex logic, but simply pulls data from the API and sends it for processing or sending, then this is the fastest option to run.
- Node-RED – the ability to work out scripts in detail, a huge number of available modules, it is difficult to understand and run the first script. But then you can turn mountains with this thing.
VDSina offers powerful and inexpensive VDS with daily payment to install almost any software. The Internet channel for each server is 500 Megabits, protection against DDoS attacks is included in the tariff, the ability to install Windows, Linux or the OS in general from your image, and also a very convenient proprietary server control panel. Try it!