使用N8N助力AI总结RSS传送门,一键输出到Notion和频道

前言:这个示例是在N8N基础上的一个工作流,可以再进一步扩展和完善,通过该示例,你能学会如何在n8n中使用gpt和运行工作流

主要是通过调用open ai api读取RSS信息设定总结prompt来完成进一步的输出,如发送到notion页面、tg频道、企业微信群等等

预览:

说明

上图中为设置的多个rss源总结示例,已设置为仅一个rss工作流的运行,如需运行多个可自行更改

  1. 首先以定时任务为工作流开始,可以设定按小时运行,建议2小时以上,因为open ai api的调用有严格的限制
  2. 设定rss源地址并运行查看rss信息
  3. 启用open ai的工作流,设置连接的凭据api token。注意:调用open ai时选择聊天操作,可选择gpt3.5模型进行下一步设定
  4. 设定gpt聊天prompt,这里我们需要总结文本,所以ai角色设定system(系统)给定的提示:“归纳总结给出的内容,同时用列表列出要点“ 角色user(用户)设定为上一步中的rss文本内容【拖动左侧栏中的文本内容节点到user的设定内容】运行一次,查看ai总结效果​
  5. 添加一个合并操作,将rss和ai总结分别接入并选择合并输出
  6. 添加一个notion数据库添加的工作流,集成token在notion的设置中找到并添加到n8n,再添加数据库的id【如https://ppnoise.notion.site/5facadd932ea418b86be5e658e989e8?v=989cc3d3ebe453db25443796abc7e93&pvs=4中5facadd932ea418b86be5e658e989e8为数据库的id】,选择合并输出的信息到面板中,其中在属性栏中添加数据库更新页的标签、网址、日期等信息​![](https://jsd.cdn.noisework.cn/gh/rcy1314/tuchuang@main/20230805/2131.2cflm760u5c0.jpg)​
  7. 添加一个http请求的工作流,位于notion更新的同级,根据自己需要设置post发送通知

关于如何设置http推送及接入不同平台,如企业微信等渠道,我讲过太多次了,这里不再详细介绍,你可以阅读以前介绍过自动化相关的文章

可一键复制到n8n的代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
{
"name": "AI总结RSS",
"nodes": [
{
"parameters": {
"method": "POST",
"options": {}
},
"id": "918f8863-ecd9-428e-a716-d05aa50e5003",
"name": "发出通知",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.1,
"position": [
920,
440
],
"disabled": true
},
{
"parameters": {},
"id": "b1a6287c-a5fd-4de5-9fff-84c1ef4d5d50",
"name": "合并数据",
"type": "n8n-nodes-base.merge",
"typeVersion": 2.1,
"position": [
620,
280
]
},
{
"parameters": {},
"id": "9e9f2d39-5b71-407f-9127-6a3184b1c4a5",
"name": "合并数据1",
"type": "n8n-nodes-base.merge",
"typeVersion": 2.1,
"position": [
620,
540
],
"disabled": true
},
{
"parameters": {
"resource": "chat",
"model": "gpt-3.5-turbo-0613",
"prompt": {
"messages": [
{
"role": "system",
"content": "归纳总结给出的内容,同时用列表列出要点"
},
{
"content": "={{ $json.contentSnippet }}"
}
]
},
"options": {
"maxTokens": 1500,
"n": 1
}
},
"id": "3320990e-4d12-49f4-af53-18c739d725e6",
"name": "GPT总结",
"type": "n8n-nodes-base.openAi",
"typeVersion": 1,
"position": [
460,
660
],
"credentials": {
"openAiApi": {
"id": "7zKviAnzAKXmhUDY",
"name": "OpenAi account 2"
}
},
"disabled": true
},
{
"parameters": {
"resource": "chat",
"model": "gpt-3.5-turbo-0613",
"prompt": {
"messages": [
{
"role": "system",
"content": "归纳总结给出的内容,同时用列表列出要点"
},
{
"content": "={{ $json.contentSnippet }}"
}
]
},
"options": {
"maxTokens": 1500,
"n": 1,
"temperature": 0.7
}
},
"id": "716a7841-b885-4750-90dc-a138e7cdaebc",
"name": "GPT总结1",
"type": "n8n-nodes-base.openAi",
"typeVersion": 1,
"position": [
460,
400
],
"credentials": {
"openAiApi": {
"id": "7zKviAnzAKXmhUDY",
"name": "OpenAi account 2"
}
}
},
{
"parameters": {
"url": "https://www.noiseblog.top/atom.xml"
},
"id": "97106018-9eb9-488b-8f16-eba9fb86756e",
"name": "RSS",
"type": "n8n-nodes-base.rssFeedRead",
"typeVersion": 1,
"position": [
280,
280
]
},
{
"parameters": {},
"id": "a8682be0-14ec-405f-9673-9b42c536b384",
"name": "RSS1",
"type": "n8n-nodes-base.rssFeedRead",
"typeVersion": 1,
"position": [
280,
580
],
"disabled": true
},
{
"parameters": {
"rule": {
"interval": [
{
"field": "hours"
}
]
}
},
"id": "670fca39-0096-46b2-9c76-115fe1272973",
"name": "定时运行",
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.1,
"position": [
120,
440
]
},
{
"parameters": {
"resource": "databasePage",
"databaseId": {
"__rl": true,
"value": "5facadd9-32ea-418b-86be-5e658e98d9e8",
"mode": "list",
"cachedResultName": "说说mark",
"cachedResultUrl": "https://www.notion.so/5facadd932ea418b86be5e658e98d9e8"
},
"title": "={{ $json.title }}",
"propertiesUi": {
"propertyValues": [
{
"key": "标签|multi_select",
"multiSelectValue": [
"每日一技",
"推荐"
]
},
{
"key": "URL|url",
"ignoreIfEmpty": true,
"urlValue": "={{ $json.link }}"
}
]
},
"blockUi": {
"blockValues": [
{}
]
},
"options": {}
},
"id": "129a333a-f010-42a5-9cbe-87c6635ce3b0",
"name": "Notion数据更新",
"type": "n8n-nodes-base.notion",
"typeVersion": 2,
"position": [
920,
240
],
"credentials": {
"notionApi": {
"id": "AgRqO2SZ6YsrjS7Z",
"name": "Notion account"
}
}
},
{
"parameters": {
"resource": "databasePage",
"databaseId": {
"__rl": true,
"value": "5facadd9-32ea-418b-86be-5e658e98d9e8",
"mode": "list",
"cachedResultName": "说说mark",
"cachedResultUrl": "https://www.notion.so/5facadd932ea418b86be5e658e98d9e8"
},
"title": "={{ $json.title }}",
"propertiesUi": {
"propertyValues": [
{
"key": "标签|multi_select",
"multiSelectValue": [
"每日一技",
"推荐"
]
},
{
"key": "URL|url",
"ignoreIfEmpty": true,
"urlValue": "={{ $json.link }}"
}
]
},
"blockUi": {
"blockValues": [
{}
]
},
"options": {}
},
"id": "b7488917-6c24-4ffb-a7be-8b37bdee3f87",
"name": "Notion数据更新1",
"type": "n8n-nodes-base.notion",
"typeVersion": 2,
"position": [
920,
680
],
"credentials": {
"notionApi": {
"id": "AgRqO2SZ6YsrjS7Z",
"name": "Notion account"
}
},
"disabled": true
}
],
"pinData": {},
"connections": {
"合并数据": {
"main": [
[
{
"node": "Notion数据更新",
"type": "main",
"index": 0
},
{
"node": "发出通知",
"type": "main",
"index": 0
}
]
]
},
"合并数据1": {
"main": [
[
{
"node": "Notion数据更新1",
"type": "main",
"index": 0
},
{
"node": "发出通知",
"type": "main",
"index": 0
}
]
]
},
"GPT总结": {
"main": [
[
{
"node": "合并数据1",
"type": "main",
"index": 1
}
]
]
},
"GPT总结1": {
"main": [
[
{
"node": "合并数据",
"type": "main",
"index": 1
}
]
]
},
"RSS": {
"main": [
[
{
"node": "GPT总结1",
"type": "main",
"index": 0
},
{
"node": "合并数据",
"type": "main",
"index": 0
}
]
]
},
"RSS1": {
"main": [
[
{
"node": "合并数据1",
"type": "main",
"index": 0
},
{
"node": "GPT总结",
"type": "main",
"index": 0
}
]
]
},
"定时运行": {
"main": [
[
{
"node": "RSS",
"type": "main",
"index": 0
},
{
"node": "RSS1",
"type": "main",
"index": 0
}
]
]
},
"Notion数据更新1": {
"main": [
[]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "26007f48-7d11-473b-876f-e0b2677d0d32",
"id": "Ik2rkftMfcm8Yy4T",
"meta": {
"instanceId": "6c252d0ece090a194d0d4864a069daca7b9c8cafaddfa97a69d779cffd00b0a5"
},
"tags": []
}

总结:n8n是一个功能强大的自动化集成平台,运用好它能更好的提高生产效率,通过上面的这个例子,可以更好的帮助我们学习了解n8n及自动化的工作流