Created
October 12, 2020 05:35
-
-
Save yude/df85cbddb317eb768e6ce0401ddd6129 to your computer and use it in GitHub Desktop.
n8n 用設定ファイル: 新しい RSS 項目を Discord に流す
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "news", | |
"nodes": [ | |
{ | |
"parameters": {}, | |
"name": "Start", | |
"type": "n8n-nodes-base.start", | |
"typeVersion": 1, | |
"position": [ | |
230, | |
200 | |
] | |
}, | |
{ | |
"parameters": { | |
"url": "https://www.hiroshima-cu.ac.jp/news/feed/" | |
}, | |
"name": "RSS Feed Read", | |
"type": "n8n-nodes-base.rssFeedRead", | |
"typeVersion": 1, | |
"position": [ | |
600, | |
200 | |
], | |
"executeOnce": false | |
}, | |
{ | |
"parameters": { | |
"triggerTimes": { | |
"item": [ | |
{} | |
] | |
} | |
}, | |
"name": "Cron", | |
"type": "n8n-nodes-base.cron", | |
"typeVersion": 1, | |
"position": [ | |
400, | |
200 | |
] | |
}, | |
{ | |
"parameters": { | |
"functionCode": "const staticData = this.getWorkflowStaticData('global');\n\nlatestRead = staticData.latestRead;\n\nfor (let item of items) {\n item.json.latestRead = latestRead || '1970-01-01';\n}\n\nreturn items;" | |
}, | |
"name": "Latest Read", | |
"type": "n8n-nodes-base.function", | |
"typeVersion": 1, | |
"position": [ | |
800, | |
200 | |
] | |
}, | |
{ | |
"parameters": { | |
"functionCode": "const staticData = this.getWorkflowStaticData('global');\n\nif (items.length > 0) {\n staticData.latestRead = items[0].json.isoDate || staticData.latestRead;\n}\n\n\nreturn items;" | |
}, | |
"name": "Write Latest Read", | |
"type": "n8n-nodes-base.function", | |
"typeVersion": 1, | |
"position": [ | |
1200, | |
100 | |
] | |
}, | |
{ | |
"parameters": { | |
"conditions": { | |
"number": [ | |
{ | |
"value1": "={{new Date($node[\"Latest Read\"].data[\"latestRead\"]).getTime()}}", | |
"value2": "={{new Date($node[\"RSS Feed Read\"].data[\"isoDate\"]).getTime()}}" | |
} | |
] | |
} | |
}, | |
"name": "IF", | |
"type": "n8n-nodes-base.if", | |
"typeVersion": 1, | |
"position": [ | |
1000, | |
200 | |
] | |
}, | |
{ | |
"parameters": { | |
"functionCode": "let emailText = '';\n\nfor (let item of items) {\n emailText += `${item.json.title}\\n${item.json.link}\\n\\n`;\n}\n\nreturn [{json: {emailText}}];" | |
}, | |
"name": "Function", | |
"type": "n8n-nodes-base.function", | |
"typeVersion": 1, | |
"position": [ | |
1200, | |
300 | |
] | |
}, | |
{ | |
"parameters": { | |
"webhookUri": "", | |
"text": "={{$node[\"RSS Feed Read\"].json[\"title\"]}} {{$node[\"RSS Feed Read\"].json[\"link\"]}}" | |
}, | |
"name": "Discord", | |
"type": "n8n-nodes-base.discord", | |
"typeVersion": 1, | |
"position": [ | |
1390, | |
300 | |
], | |
"executeOnce": true | |
} | |
], | |
"connections": { | |
"RSS Feed Read": { | |
"main": [ | |
[ | |
{ | |
"node": "Latest Read", | |
"type": "main", | |
"index": 0 | |
} | |
] | |
] | |
}, | |
"Cron": { | |
"main": [ | |
[ | |
{ | |
"node": "RSS Feed Read", | |
"type": "main", | |
"index": 0 | |
} | |
] | |
] | |
}, | |
"Latest Read": { | |
"main": [ | |
[ | |
{ | |
"node": "IF", | |
"type": "main", | |
"index": 0 | |
} | |
] | |
] | |
}, | |
"IF": { | |
"main": [ | |
[ | |
{ | |
"node": "Function", | |
"type": "main", | |
"index": 0 | |
}, | |
{ | |
"node": "Write Latest Read", | |
"type": "main", | |
"index": 0 | |
} | |
] | |
] | |
}, | |
"Function": { | |
"main": [ | |
[ | |
{ | |
"node": "Discord", | |
"type": "main", | |
"index": 0 | |
} | |
] | |
] | |
}, | |
"Start": { | |
"main": [ | |
[ | |
{ | |
"node": "RSS Feed Read", | |
"type": "main", | |
"index": 0 | |
} | |
] | |
] | |
} | |
}, | |
"active": true, | |
"settings": {}, | |
"id": "1" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment