Workflow automation with n8n.io
Tags: node
Published: 2020-05-08 13:40:47

---
title: Workflow automation with n8n.io
published: true
date: 2020-04-10 17:15:15 UTC
tags: node
canonical_url: https://blog.logrocket.com/workflow-automation-with-n8n-io/
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/n93c7s1fnqwauimrl41y.png
---
**Written by [Daniel Phiri](https://blog.logrocket.com/author/malgamves/)**✏️

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](https://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](https://n8n.io/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 [workflow](https://n8n.io/workflows)s 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.

[![LogRocket Free Trial Banner](https://i0.wp.com/blog.logrocket.com/wp-content/uploads/2017/03/f760c-1gpjapknnuyhu8esa3z0jga.png?resize=1200%2C280&ssl=1)](https://logrocket.com/signup/)

## Prerequisites

Getting up and started with n8n.io is really cool.

- You need to have [Node.js](https://nodejs.org/en/) installed
- You need to have [npm](https://www.npmjs.com/get-npm) installed

> Note: You might have some trouble if you don’t have `node-gyp` installed.

The official [GitHub page](https://github.com/nodejs/node-gyp#on-windows) has instructions for how to get it running on multiple operating systems.

### Getting started

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:

![The starting screen to begin an automated workflow on n8n.io](https://i1.wp.com/blog.logrocket.com/wp-content/uploads/2020/04/n8-workflow.gif?resize=730%2C350&ssl=1)  
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](https://n8n.io/integrations/n8n-nodes-base.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.

![A screenshot of n8n.io when a workflow runs successfully.](https://i0.wp.com/blog.logrocket.com/wp-content/uploads/2020/04/workflow-not-saved.gif?resize=730%2C355&ssl=1)

> 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](https://n8n.io/integrations/n8n-nodes-base.httpRequest) node and thanks to the folks at [affirmations.dev](https://github.com/annthurium/affirmations/blob/master/affirmations.js), 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`](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.

![A screenshot showing developers how to request that n8n.io return data.](https://i2.wp.com/blog.logrocket.com/wp-content/uploads/2020/04/workflow-not-saved-2.gif?resize=730%2C355&ssl=1)

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](https://n8n.io/integrations/n8n-nodes-base.telegram) at our disposal.

As we did before with the Cron and HTTP Request nodes, search and click Telegram.

![Searching and clicking Telegram in nodemation.](https://i1.wp.com/blog.logrocket.com/wp-content/uploads/2020/04/no-data-to-display.png?resize=730%2C411&ssl=1)

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](https://desktop.telegram.org/)
- 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/<bot username>) and press **start** when taken to its chat window.

![The chat window for the botfather.](https://i0.wp.com/blog.logrocket.com/wp-content/uploads/2020/04/what-can-this-bot-do.gif?resize=730%2C415&ssl=1)

- Add the bot to a group
- Send `/test hi` in the group chat you just added the bot to
- In your browser, go to [`https://api.telegram.org/bot<TOKEN>/getUpdates` ](https://api.telegram.org/bot<TOKEN>/getUpdates)– replace `<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. `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.

![A gif depicting a user pasting a token from the botfather into the access token field.](https://i0.wp.com/blog.logrocket.com/wp-content/uploads/2020/04/cron-http-reqhest.gif?resize=730%2C359&ssl=1)

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.

![Setting up our daily affirmations in n8n.io.](https://i1.wp.com/blog.logrocket.com/wp-content/uploads/2020/04/whatever-it-is.gif?resize=730%2C359&ssl=1)

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.

![The final step to initiating our workflow.](https://i2.wp.com/blog.logrocket.com/wp-content/uploads/2020/04/telegram.png?resize=730%2C411&ssl=1)

Check your Telegram and you should have a new message from your Daily Good Vibes bot.

![Our 'Daily Good Vibes' workflow autoamtion.](https://i2.wp.com/blog.logrocket.com/wp-content/uploads/2020/04/daily-good-vibes.gif?resize=730%2C402&ssl=1)

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](https://n8n.io/workflows/342).

These happen to be some of my favorites that aren’t as basic:

- [API which queries data from GraphQL](https://n8n.io/workflows/216)
- [Typeform to Google Sheet and depending on severity to Slack or Email](https://n8n.io/workflows/29)
- [Scheduled Web-Scraping to Google Sheets](https://n8n.io/workflows/5)
- [Notification on GitHub star in Slack](https://n8n.io/workflows/4)

## Conclusion

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](https://twitter.com/malgamves) if you do or add them to be displayed on the [n8n.io](https://n8n.io/dashboard) workflows page.

Stay safe and take care.

* * *
## 200's only ‎✅: Monitor failed and show GraphQL requests in production 

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.](https://www2.logrocket.com/signup-lr)

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/jd2amkhuiynfjf3i33qk.png)

[LogRocket](https://www2.logrocket.com/signup-lr) 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.](https://www2.logrocket.com/signup-lr)
* * *

The post [Workflow automation with n8n.io](https://blog.logrocket.com/workflow-automation-with-n8n-io/) appeared first on [LogRocket Blog](https://blog.logrocket.com).