Storing and loading content from filesystem

Hello, i want to scrape a knowledge base and send myself new posts. For this I plan to store the article IDs somwhere in n8n and then filter them out in subsecuent executions.

Can this be done?

Welcome to the community @luisito345!

There are multiple ways to store data. If it is just very little data like a few values you can store it directly in the workflow with static data:

Apart from that can you anytime save data in a file:

Or in a database like Redis, Mongo, Postgres or MySQL:

1 Like

You might want to have a look here. It’s a workflow that tracks sitemap changes.

How to get new RSS item?

Until there is no better support for tracking node data changes it’s going to be ugly - but doable.

1 Like

Thanks all for the information, I’m having a hard time making this work, can some one point where the problems are??

In a previous function I generate a lot of items, they haven an ID, so my idea is to get the previous latest id and send all items with a bigger number, then saving the new id in node data. Or that is what i want to believe it does.

Function Code
let SITEURL = '';
let HTMLHEADER = '<html>'; //'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
//<html xmlns="">
let HTMLFOOTER = '</body></html>';
let emailText = `${HTMLHEADER}` + 'KB de Site: \n\n<ul>';

let idMasGrande = 0;
let newidMasGrande = 0;
const staticNodeData = getWorkflowStaticData('node');
const oldidMasGrande = staticNodeData.idMasGrande;
const newItems = [];

for (let item of items) {
  if (item.json.articuloID >= idMasGrande) {
      newidMasGrande = item.json.articuloID;
      item.json.estado = "pasaFiltro";
      newItems.push({ json: item });
  // filtrarlo
  if (item.json.articuloID > oldidMasGrande) {
      //newidMasGrande = item.json.articuloID;
      //item.json.estado = "pasaFiltro";
      //newItems.push({ json: item });
  // fin filtrarlo

staticNodeData.idMasGrande = newidMasGrande;
// fim seteo el id

emailText += `\n\n results:`;
for (let item of newItems) {
  emailText += `<li>${item.json.estado} * ${item.json.articuloTitulo}
   ${item.json.airticuloDate} - ${SITEURL}${item.json.articuloHref}\n
emailText += `<ul> ${HTMLFOOTER}`;

return [{json: {emailText}}]

Also, i love to use ‘console.log’ is there any way for me to just log/debug messages ?


Hey @luisito345, where are you having the issue exactly?

Yes, you can use console.log() in the function node, just add it and you will see the data in the terminal you ran n8n.

1 Like