{
"name": "rss",
"nodes": [
{
"parameters": {},
"name": "Start",
"type": "n8n-nodes-base.start",
"typeVersion": 1,
"position": [
-800,
580
]
},
{
"parameters": {
"chatId": "5210106995",
"text": "=📝 {{$json[\\"title\\"]}}#blog\\n\\n{{$json[\\"url\\"]}}",
"additionalFields": {
"parse_mode": "HTML"
}
},
"name": "Telegram",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1,
"position": [
-100,
420
],
"credentials": {
"telegramApi": {
"id": "1",
"name": "Telegram account"
}
}
},
{
"parameters": {
"url": "=http://stiles.cc/feed/"
},
"name": "RSS Feed Read",
"type": "n8n-nodes-base.rssFeedRead",
"position": [
-600,
500
],
"typeVersion": 1
},
{
"parameters": {
"functionCode": "// Get the global workflow static data\\nconst staticData = getWorkflowStaticData('global');\\n\\n// Access its data\\nconst lastRssId = staticData.lastRssId\\n\\nlet list = []\\n\\nconsole.log(\\"items\\"+$items)\\nfor (const item of $items(\\"RSS Feed Read\\")){\\n console.log(item);\\n let currentId = item.json[\\"guid\\"].split('/').pop()\\n if(currentId == lastRssId) break;\\n let length = 1000;\\n let contentSnippet = item.json['contentSnippet'].length > length ? item.json['contentSnippet'].substring(0, length - 3) + \\"...\\" : item.json['contentSnippet'];\\n let content = `${contentSnippet}\\\\r\\\\n\\\\r\\\\n<h3>Written By: ${item.json['author']}</h3>\\\\r\\\\n<h3>Original Article: <a href=\\"${item.json['link']}\\">${item.json['link']}</a></h3>`;\\n list.push({'json': {\\n 'id': currentId,\\n 'author': item.json['author'],\\n 'lastId': lastRssId,\\n 'title': item.json[\\"title\\"],\\n 'url': item.json[\\"link\\"],\\n 'content': content\\n }})\\n}\\n\\n\\n// Get the last ID from Rss Feed\\nlet currentRssId = $item(0).$node[\\"RSS Feed Read\\"].json[\\"guid\\"].split('/').pop()\\n\\n// TODO: make a loop to get all the items beyond the last saved id\\nif(!lastRssId || currentRssId != lastRssId)\\n{ \\n // Update its data\\n staticData.lastRssId = currentRssId;\\n \\n}\\nelse { list = [{'json':{'id': 'NaN', 'lastId': staticData.lastRssId }}] }\\nreturn list;\\n\\n"
},
"name": "Function",
"type": "n8n-nodes-base.function",
"position": [
-440,
500
],
"typeVersion": 1
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{$node[\\"Function\\"].json[\\"id\\"]}}",
"operation": "notEqual",
"value2": "NaN"
}
],
"boolean": []
}
},
"name": "IF",
"type": "n8n-nodes-base.if",
"position": [
-300,
500
],
"typeVersion": 1
},
{
"parameters": {},
"name": "NoOp",
"type": "n8n-nodes-base.noOp",
"position": [
-100,
580
],
"typeVersion": 1
},
{
"parameters": {
"interval": 5,
"unit": "minutes"
},
"name": "Interval",
"type": "n8n-nodes-base.interval",
"typeVersion": 1,
"position": [
-800,
400
]
}
],
"pinData": {},
"connections": {
"IF": {
"main": [
[
{
"node": "Telegram",
"type": "main",
"index": 0
}
],
[
{
"node": "NoOp",
"type": "main",
"index": 0
}
]
]
},
"Function": {
"main": [
[
{
"node": "IF",
"type": "main",
"index": 0
}
]
]
},
"RSS Feed Read": {
"main": [
[
{
"node": "Function",
"type": "main",
"index": 0
}
]
]
},
"Interval": {
"main": [
[
{
"node": "RSS Feed Read",
"type": "main",
"index": 0
}
]
]
},
"Start": {
"main": [
[
{
"node": "RSS Feed Read",
"type": "main",
"index": 0
}
]
]
}
},
"active": true,
"settings": {},
"id": 2,
"tags": []
}