Logo

dev-resources.site

for different kinds of informations.

How I built a COVID-19 newsletter with n8n (in just 5 minutes)

Published at
1/11/2021
Categories
javascript
automation
covid19
n8n
Author
alexanderschau
Categories
4 categories in total
javascript
open
automation
open
covid19
open
n8n
open
Author
14 person written this
alexanderschau
open
How I built a COVID-19 newsletter with n8n (in just 5 minutes)

The idea

My idea was quite simple. I wanted to build a corona newsletter, which sends me a daily email with the latest number of corona cases in my region, so I can keep myself up to date without checking multiple websites every day. To keep the whole project simple I also decided to use the open source workflow automation tool n8n.

The dataset

The biggest challenge at this whole project was the dataset. A simple method to get the data would be to just scrape the website of the local authorities and filter out the important stuff, but I wanted to challenge myself a little bit and build a tool, which will also work in other regions or countries. So, I started searching for a dataset with daily updates.

A dataset, which looked nice to me, was one provided by the European Union. The only problem with it: It doesn’t receive daily updates 😟.

After searching GitHub for a dataset, I found a, currently quite popular, repository of the Johns Hopkins University. It provides daily reports from many countries in the world and was thus my choice to go on.

The workflow

After finding the perfect dataset, I started building my workflow by adding a daily Cron node at 7am GMT, so I can get the latest data (they usually publish updates between 04:45 and 05:15 GMT)
Alt Text
After that I add a Function Item node, which formats the current date to the MM-DD-YYYY format, so we can use it as filename.

const date = new Date(new Date().setDate(new Date().getDate() - 1)).toISOString().split("T")[0].split("-");
item.date = `${date[1]}-${date[2]}-${date[0]}`;
return item;
Enter fullscreen mode Exit fullscreen mode

Then I made a HTTP Request to get the file binary from the GitHub raw URL and convert the CSV file into JSON using the Spreadsheet File node.
Alt Text
The only thing, that’s left now, is to filter out the data of a region and sending it through email.

items[0].json.myVariable = 1;
return items.filter(item => item.json.Combined_Key == "Berlin, Germany");
Enter fullscreen mode Exit fullscreen mode

Alt Text

Final words

Seriously, I never thought it would be that easy to build something powerful like this. Next to the possibility to sending emails, n8n also support lots of other ways like Matrix or Slack, which allows you to send this newsletter to the place where you need it the most.

If you now want to build this project on your own feel free to use my code (you will find it on n8n’s website and on GitHub), but I really recommend you, to build it from scratch, because it’s incredible to build something like this in just 5 minutes 😁.

covid19 Article's
30 articles in total
Favicon
The New Normal: COVID-19’s Enduring Impact on Remote Work and Cloud Technologies
Favicon
Leadership Series: The Isolation of a Leader
Favicon
i am our genius on this searching to end this bad ass worthy taking my stress away. hashtag ready
Favicon
Pandas in the Pandaemic. (COVID-19 in — Scotland statistics) Part 2
Favicon
Pandas in the Pandaemic. (COVID-19 in Scotland — statistics) Part 3
Favicon
How has COVID accelerated use of AI for mental health?
Favicon
Creating through a crisis
Favicon
Secure Your Brand Integrity After a Covid-19 Crisis
Favicon
My open source web app for reading data from EU Green Pass QR Code.
Favicon
Work very well with other people on teams
Favicon
Ya no nos quedan lĂ­deres
Favicon
The Brilliance of the Compartmental Models
Favicon
Open Source Super Fast Covid19 Parser and Dashboard
Favicon
La pandemia sta dimostrando la necessitĂ  per tutte le attivitĂ  di essere online
Favicon
COVID-19 Vaccines in India: How to Build an API-based Vaccine Locator with Postman
Favicon
Coronavirus Dashboard in MG / Brazil - Power BI
Favicon
Covid-19, Programming and Optimization
Favicon
CrowdNotifier explained: tracing COVID-19 contacts with privacy in mind
Favicon
Startup Snapshot Surveys – Covid’s 2020 Impact on Israeli Startups
Favicon
Leaning pandas. Data manipulation and visualization. (COVID-19 in — Scotland statistics)
Favicon
Working remotely with a cargo cult
Favicon
How to Design an Interactive Dashboard for COVID-19 Updates in JavaScript
Favicon
Tracking the Spread of COVID-19 at Chicago Public Schools, the 3rd Largest Public School District in the United States
Favicon
Belanja Online Aman Aman Saja Walau Pandemi Kalau Kamu Pakai 5 Cara Ini
Favicon
COVID-19 Analytics using InterSystems IRIS
Favicon
Pesar por membros da comunidade da UFAM
Favicon
Covtact: New name and design [DO-Hackathon]
Favicon
Face Mask Detector
Favicon
How I built a COVID-19 newsletter with n8n (in just 5 minutes)
Favicon
2021 Surprise

Featured ones: