Written by Daniel Phiri✏️
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
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
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:
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.
Again, we click the X in the top right corner and search HTTP and click on the HTTP Request node.
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:
- Create a Telegram account and get the Desktop client
- Talk to the [Botfather](https://telegram.me/botfather%5D(https://telegram.me/botfather), a bot we use to create our bot
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/) and press start when taken to its chat window.
- Add the bot to a group
/test hiin the group chat you just added the bot to
- In your browser, go to
<TOKEN>with the token you get when creating the bot.
- You’ll get back some JSON, find a property called chat , and get the corresponding ID (i.e.
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:
- API which queries data from GraphQL
- Typeform to Google Sheet and depending on severity to Slack or Email
- Scheduled Web-Scraping to Google Sheets
- Notification on GitHub star in Slack
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.
Stay safe and take care.
While GraphQL has some features for debugging requests and responses, making sure GraphQL reliably serves resources to your production app is where things get tougher. If you’re interested in ensuring network requests to the backend or third party services are successful, try LogRocket.
LogRocket is like a DVR for web apps, recording literally everything that happens on your site. Instead of guessing why problems happen, you can aggregate and report on problematic GraphQL requests to quickly understand the root cause. In addition, you can track Apollo client state and inspect GraphQL queries' key-value pairs.
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.