It’s always been part of human nature to automate the boring and mundane tasks of everyday life — whether its scraping a website every 4 days or sharing updates to a Slack channel.
I was doing so myself when I wound up on a really interesting workflow automation tool called n8n.io (pronounced nodemation).
You know — like Kubernetes is k8s, nodemation is n8n.io.
It’s pretty sweet.
Out of the box, it doesn’t look like it has much to do with programming.
A quick check on the integrations page and you see a growing number of third party APIs available to make your life easy.
Don’t worry if you can’t find inspiration immediately, the templates and community inspired workflows page has a cool list of already automated workflows you can either use yourself or get a few ideas from.
This product has a pretty cool thing going on.
Today, we’ll be adding to that list of workflows.
We aren’t going through the easiest time at the moment with everything going on in the world, and sometimes we need a little lift up.
We’re going to create a workflow that sends positive affirmations to your telegram chat or group everyday at the time you want.
Getting up and started with n8n.io is really cool.
Note: You might have some trouble if you don’t have
node-gyp
installed.
The official GitHub page has instructions for how to get it running on multiple operating systems.
Once you meet all the prerequisites, you can install the n8n CLI with npm install n8n -g
and run it with n8n
.
When prompted, press o
in your terminal to open the local address in your browser and begin automating workflows.
You’ll be met with this screen:
Nodemation calls integrations nodes.
It has a good number of third party nodes and inbuilt nodes.
Sometimes, nodes can be used to trigger or start a workflow.
To start it off, we’ll add a Cron trigger that will start our workflow at a specific time.
If you click the X in the top right corner, you’ll open up a menu of nodes.
Click on the trigger tab and search Cron.
Click on it at the time you want it to be triggered.
Click execute workflow, and you should see a small alert in the bottom right corner telling you the workflow ran successfully.
Be sure to change settings in left tab so that the Cron job runs at a time in your timezone. That can be an issue.
We have our workflow being triggered at a specific time every day.
Now we need to request data from an API to get us these affirmations.
Luckily for us, n8n has an HTTP Request node and thanks to the folks at affirmations.dev, we have some awesome messages to return.
Again, we click the X in the top right corner and search HTTP and click on the HTTP Request node.
Paste https://affirmations.dev
in the URL
section and execute the workflow.
Successfully run it again, but this time you get returned some data, which is always good when making a request.
Close the modal and now the flow portion, click and hold the circle on the Cron node, and drag it to the left side of the HTTP Request node.
This way, we’re telling nodemation that when the Cron node is triggered, we need to make a request and return some data.
We’re being returned affirmations in JSON format, and we want to be able to send these out via Telegram.
We have a Telegram node at our disposal.
As we did before with the Cron and HTTP Request nodes, search and click Telegram.
There’s a few fields highlighted and we don’t have that data yet.
So before we use the Telegram node, we have to get those details. Here’s what we need to do:
Here, you give your bot a name and a unique username and get back a URL that directs you to the bot and token to access the bot via HTTP. We need to keep this safe.
Click on the bots URL (t.me/<bot username>) and press start when taken to its chat window.
/test hi
in the group chat you just added the bot tohttps://api.telegram.org/bot<TOKEN>/getUpdates
– replace <TOKEN>
with the token you get when creating the bot.chat:{id:-12345
)Now we have our Telegram API token and chat ID.
We need to add credentials in our n8n credentials section.
We’ll name it Telegram Token and then paste the token from the botfather into the access token field.
We connected the HTTP Request node and Telegram so we can send the response as a message.
n8n lets us take data from other nodes and use it in different fields.
In our case, we’re getting the response data from the HTTP Request node and adding it to a message that we’ll send using the Telegram node.
We open the Telegram node, click the gears next the the text field, and click add expression.
We have two sections — variable selector and expression.
In the expression section, we type out the message.
Because we want the affirmation to be sent at the end of the text, we make a few new lines before we head over to the variable selector.
We use this section to interpolate data from other nodes into the main expression.
To select the data, we click on current node > Input Data > JSON and then select the JSON property we want, which in our case is affirmations.
This way, at the end of the expression “Hey Daniel, here is your daily affirmation”, we have a different affirmation every day depending on what the API request returned.
Add your Chat ID and make sure all other credentials in the Telegram field have been filled.
We’ll leave the chat operation as send message because that’s what we’re going for.
Close the node and click execute workflow.
Check your Telegram and you should have a new message from your Daily Good Vibes bot.
Looking back it’s pretty cool what we’ve got done with practically no code.
We’re requesting data from an API and delivering it to our Telegram client.
With tons of other cool nodes, there’s so much to do with nodemation.
Now, this is a really basic example of workflow automation, check it out here.
These happen to be some of my favorites that aren’t as basic:
Hopefully with this you now have an understanding of how to use n8n.io. I hope you’ll go on to create some really useful workflows.
Let me know on Twitter if you do or add them to be displayed on the n8n.io workflows page.
Stay safe and take care.
Deploying a Node-based web app or website is the easy part. Making sure your Node instance continues to serve resources to your app is where things get tougher. If you’re interested in ensuring requests to the backend or third-party services are successful, try LogRocket.
LogRocket is like a DVR for web and mobile apps, recording literally everything that happens while a user interacts with your app. Instead of guessing why problems happen, you can aggregate and report on problematic network requests to quickly understand the root cause.
LogRocket instruments your app to record baseline performance timings such as page load time, time to first byte, slow network requests, and also logs Redux, NgRx, and Vuex actions/state. Start monitoring for free.
Hey there, want to help make our blog better?
Join LogRocket’s Content Advisory Board. You’ll help inform the type of content we create and get access to exclusive meetups, social accreditation, and swag.
Sign up nowBackdrop and background have similar meanings, as they both refer to the area behind something. The main difference is that […]
AI tools like IBM API Connect and Postbot can streamline writing and executing API tests and guard against AI hallucinations or other complications.
Explore DOM manipulation patterns in JavaScript, such as choosing the right querySelector, caching elements, improving event handling, and more.
`window.ai` integrates AI capabilities directly into the browser for more sophisticated client-side functionality without relying heavily on server-side processing.