├── backup-n8n-workflows.json ├── notion-n8n-automations ├── invoice-ocr-assistant-mindee.json ├── social-image-generator-renderform.json └── stock-portfolio-tracker-alpha-vantage.json ├── scrape-data-n8n-puppeteer ├── puppeteer-script │ ├── google-cloud-functions-adjusted │ │ ├── .puppeteerrc.cjs │ │ ├── index.js │ │ └── package.json │ └── index.js └── retrieve-email-addresses.js ├── telegram-ai-bot.json └── telegram-memory-sessions-flowise-zep.json /backup-n8n-workflows.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Backup n8n workflows", 3 | "nodes": [ 4 | { 5 | "parameters": {}, 6 | "id": "487d5c3d-9688-4ebe-aa9f-5f2612ade7d4", 7 | "name": "Execute workflow", 8 | "type": "n8n-nodes-base.manualTrigger", 9 | "typeVersion": 1, 10 | "position": [ 11 | -1003.7718430272375, 12 | 589.8065175238871 13 | ] 14 | }, 15 | { 16 | "parameters": { 17 | "options": {} 18 | }, 19 | "id": "e9283874-dae3-4a7b-acef-8c63ed463e97", 20 | "name": "Set date", 21 | "type": "n8n-nodes-base.dateTime", 22 | "typeVersion": 2, 23 | "position": [ 24 | -803.7718430272375, 25 | 589.8065175238871 26 | ] 27 | }, 28 | { 29 | "parameters": { 30 | "operation": "formatDate", 31 | "date": "={{ $json.currentDate }}", 32 | "format": "custom", 33 | "customFormat": "dd-MM-yyyy/H:mm", 34 | "options": {} 35 | }, 36 | "id": "89fcb0e3-1831-49c6-b7ef-cd2f9bdd7899", 37 | "name": "Format date", 38 | "type": "n8n-nodes-base.dateTime", 39 | "typeVersion": 2, 40 | "position": [ 41 | -603.7718430272375, 42 | 589.8065175238871 43 | ] 44 | }, 45 | { 46 | "parameters": { 47 | "keepOnlySet": true, 48 | "values": { 49 | "string": [ 50 | { 51 | "name": "commitDate", 52 | "value": "={{ $json.formattedDate }}" 53 | } 54 | ] 55 | }, 56 | "options": {} 57 | }, 58 | "id": "f25974a9-df6b-4fe0-ba7d-961358eba280", 59 | "name": "Set commit date", 60 | "type": "n8n-nodes-base.set", 61 | "typeVersion": 2, 62 | "position": [ 63 | -403.77184302723754, 64 | 589.8065175238871 65 | ] 66 | }, 67 | { 68 | "parameters": { 69 | "authentication": "oAuth2", 70 | "resource": "file", 71 | "operation": "list", 72 | "owner": { 73 | "__rl": true, 74 | "mode": "list", 75 | "value": "" 76 | }, 77 | "repository": { 78 | "__rl": true, 79 | "mode": "list", 80 | "value": "" 81 | }, 82 | "filePath": "=" 83 | }, 84 | "id": "4e9c6fe4-17e0-40fa-8f69-ae1f33cd6aa6", 85 | "name": "List files from repository [GITHUB]", 86 | "type": "n8n-nodes-base.github", 87 | "typeVersion": 1, 88 | "position": [ 89 | -203.77184302723754, 90 | 589.8065175238871 91 | ], 92 | "alwaysOutputData": true, 93 | "credentials": { 94 | "githubOAuth2Api": { 95 | "id": "2", 96 | "name": "GitHub account" 97 | } 98 | } 99 | }, 100 | { 101 | "parameters": { 102 | "operation": "aggregateItems", 103 | "fieldsToAggregate": { 104 | "fieldToAggregate": [ 105 | { 106 | "fieldToAggregate": "name" 107 | } 108 | ] 109 | }, 110 | "options": {} 111 | }, 112 | "id": "3c6ff6db-b8fc-4dee-a419-c792304bc69e", 113 | "name": "Combine file names [GITHUB]", 114 | "type": "n8n-nodes-base.itemLists", 115 | "typeVersion": 2.1, 116 | "position": [ 117 | -3.771843027237537, 118 | 589.8065175238871 119 | ] 120 | }, 121 | { 122 | "parameters": { 123 | "filters": {} 124 | }, 125 | "id": "983e2746-1668-4646-8b31-e271e8f14c62", 126 | "name": "Retrieve workflows [N8N]", 127 | "type": "n8n-nodes-base.n8n", 128 | "typeVersion": 1, 129 | "position": [ 130 | 196.22815697276246, 131 | 589.8065175238871 132 | ], 133 | "credentials": { 134 | "n8nApi": { 135 | "id": "5", 136 | "name": "n8n account" 137 | } 138 | } 139 | }, 140 | { 141 | "parameters": { 142 | "mode": "jsonToBinary", 143 | "options": { 144 | "fileName": "={{ $json.name.replace(/\\s+/g, '-').toLowerCase() }}-{{ $json.id }}.json" 145 | } 146 | }, 147 | "id": "28e3cb93-88eb-4a56-aafb-21288e9d7589", 148 | "name": "Move JSON to binary", 149 | "type": "n8n-nodes-base.moveBinaryData", 150 | "typeVersion": 1, 151 | "position": [ 152 | 396.22815697276246, 153 | 589.8065175238871 154 | ] 155 | }, 156 | { 157 | "parameters": { 158 | "batchSize": 1, 159 | "options": {} 160 | }, 161 | "id": "a1c81d3a-3dec-45b3-87a2-182720f378eb", 162 | "name": "Split to single items", 163 | "type": "n8n-nodes-base.splitInBatches", 164 | "typeVersion": 2, 165 | "position": [ 166 | 636.2281569727625, 167 | 589.8065175238871 168 | ] 169 | }, 170 | { 171 | "parameters": { 172 | "conditions": { 173 | "string": [ 174 | { 175 | "value1": "={{ $node['Combine file names [GITHUB]'].json.name }}", 176 | "operation": "contains", 177 | "value2": "={{ $binary.data.fileName }}" 178 | } 179 | ] 180 | } 181 | }, 182 | "id": "05739e46-c2ea-4a3f-97b3-4381937f8431", 183 | "name": "Check if file exists in repository", 184 | "type": "n8n-nodes-base.if", 185 | "typeVersion": 1, 186 | "position": [ 187 | 876.2281569727625, 188 | 509.8065175238871 189 | ] 190 | }, 191 | { 192 | "parameters": { 193 | "authentication": "oAuth2", 194 | "resource": "file", 195 | "operation": "edit", 196 | "owner": { 197 | "__rl": true, 198 | "mode": "list", 199 | "value": "" 200 | }, 201 | "repository": { 202 | "__rl": true, 203 | "mode": "list", 204 | "value": "" 205 | }, 206 | "filePath": "={{ $binary.data.fileName }}", 207 | "binaryData": true, 208 | "commitMessage": "=backup-{{ $node['Set commit date'].json.commitDate }}" 209 | }, 210 | "id": "b0b5fbfa-44ff-4b18-b5a0-8edfde3cd92e", 211 | "name": "Update file [GITHUB]", 212 | "type": "n8n-nodes-base.github", 213 | "typeVersion": 1, 214 | "position": [ 215 | 1096.2281569727625, 216 | 309.8065175238871 217 | ], 218 | "credentials": { 219 | "githubOAuth2Api": { 220 | "id": "2", 221 | "name": "GitHub account" 222 | } 223 | } 224 | }, 225 | { 226 | "parameters": { 227 | "authentication": "oAuth2", 228 | "resource": "file", 229 | "owner": { 230 | "__rl": true, 231 | "mode": "list", 232 | "value": "" 233 | }, 234 | "repository": { 235 | "__rl": true, 236 | "mode": "list", 237 | "value": "" 238 | }, 239 | "filePath": "={{ $binary.data.fileName }}", 240 | "binaryData": true, 241 | "commitMessage": "=backup-{{ $node['Set commit date'].json.commitDate }}" 242 | }, 243 | "id": "b21bda86-6ad8-41f1-bb4d-f4cc45e15070", 244 | "name": "Upload file [GITHUB]", 245 | "type": "n8n-nodes-base.github", 246 | "typeVersion": 1, 247 | "position": [ 248 | 1096.2281569727625, 249 | 709.8065175238871 250 | ], 251 | "credentials": { 252 | "githubOAuth2Api": { 253 | "id": "2", 254 | "name": "GitHub account" 255 | } 256 | } 257 | }, 258 | { 259 | "parameters": { 260 | "content": "## Trigger\nYou can change it to [\"Schedule\" trigger](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.scheduletrigger/) to make backups on regular basis.", 261 | "height": 339.51767272727324, 262 | "width": 182.4715262478496 263 | }, 264 | "id": "0db956f6-63e5-47dd-859d-1d6bc9b00ca0", 265 | "name": "Sticky Note", 266 | "type": "n8n-nodes-base.stickyNote", 267 | "typeVersion": 1, 268 | "position": [ 269 | -1043.7718430272375, 270 | 429.8065175238871 271 | ] 272 | }, 273 | { 274 | "parameters": { 275 | "content": "## Set and format date/time\nThose nodes are responsible for setting a current date and time in format `dd-MM-yyyy/H:mm`. Date and time are used to compose commit messages in GitHub, for example: `backup-12-07-2023/14:18`.", 276 | "height": 339.42690909090965, 277 | "width": 585.4045090909088 278 | }, 279 | "id": "d1099550-d45c-4059-840e-d738110f6a33", 280 | "name": "Sticky Note1", 281 | "type": "n8n-nodes-base.stickyNote", 282 | "typeVersion": 1, 283 | "position": [ 284 | -846.2294430272375, 285 | 429.8065175238871 286 | ] 287 | }, 288 | { 289 | "parameters": { 290 | "content": "## Make a list of existing files\nReturn a list of existing files (backups) in GitHub repository. Data returned by those nodes is used by \"IF\" node (later in workflow) to check whether the backup files should be created or updated.", 291 | "height": 339.42690909090965, 292 | "width": 389.89265454545443 293 | }, 294 | "id": "dc164e36-c0c4-46e0-80d6-c00f491d9439", 295 | "name": "Sticky Note2", 296 | "type": "n8n-nodes-base.stickyNote", 297 | "typeVersion": 1, 298 | "position": [ 299 | -243.77184302723754, 300 | 429.8065175238871 301 | ] 302 | }, 303 | { 304 | "parameters": { 305 | "content": "## Retrieve workflows\nGet all workflows form your n8n instance. Remember that **your credentials need to point to the instance that you want to backup.**", 306 | "height": 339.42690909090965, 307 | "width": 384.14708363636373 308 | }, 309 | "id": "44312eca-4114-4cf3-a9c6-44474745c0be", 310 | "name": "Sticky Note3", 311 | "type": "n8n-nodes-base.stickyNote", 312 | "typeVersion": 1, 313 | "position": [ 314 | 161.14335697276192, 315 | 429.8065175238871 316 | ] 317 | }, 318 | { 319 | "parameters": { 320 | "content": "## Upload backup\nSplit JSON files into batches of 1, check if they were uploaded to repository before. If yes (true), upload the new version of the file. Otherwise (false) create the file in repository.", 321 | "height": 731.633426614796, 322 | "width": 703.8733020263451 323 | }, 324 | "id": "43a5d3f9-4211-46f7-be7e-fa63e1bb01d5", 325 | "name": "Sticky Note4", 326 | "type": "n8n-nodes-base.stickyNote", 327 | "typeVersion": 1, 328 | "position": [ 329 | 560, 330 | 180 331 | ] 332 | }, 333 | { 334 | "parameters": { 335 | "content": "## ⚠️ Note\n\n1. Complete video guide for this workflow is available [on my YouTube](https://www.youtube.com/watch?v=dNuVuoPD0Jo). \n2. Remember to add your credentials and configure GitHub nodes (covered in the video guide).\n3. If you like this workflow, please subscribe to [my YouTube channel](https://www.youtube.com/@workfloows) and/or [my newsletter](https://workfloows.com/).\n\n**Thank you for your support!**", 336 | "height": 234.82946582693546, 337 | "width": 508.8662091091177 338 | }, 339 | "id": "d530bb8c-a50d-4332-8c3a-cafa6f971499", 340 | "name": "Sticky Note5", 341 | "type": "n8n-nodes-base.stickyNote", 342 | "typeVersion": 1, 343 | "position": [ 344 | -1043.0246857765833, 345 | 180 346 | ] 347 | } 348 | ], 349 | "pinData": {}, 350 | "connections": { 351 | "Execute workflow": { 352 | "main": [ 353 | [ 354 | { 355 | "node": "Set date", 356 | "type": "main", 357 | "index": 0 358 | } 359 | ] 360 | ] 361 | }, 362 | "Set date": { 363 | "main": [ 364 | [ 365 | { 366 | "node": "Format date", 367 | "type": "main", 368 | "index": 0 369 | } 370 | ] 371 | ] 372 | }, 373 | "Format date": { 374 | "main": [ 375 | [ 376 | { 377 | "node": "Set commit date", 378 | "type": "main", 379 | "index": 0 380 | } 381 | ] 382 | ] 383 | }, 384 | "Set commit date": { 385 | "main": [ 386 | [ 387 | { 388 | "node": "List files from repository [GITHUB]", 389 | "type": "main", 390 | "index": 0 391 | } 392 | ] 393 | ] 394 | }, 395 | "List files from repository [GITHUB]": { 396 | "main": [ 397 | [ 398 | { 399 | "node": "Combine file names [GITHUB]", 400 | "type": "main", 401 | "index": 0 402 | } 403 | ] 404 | ] 405 | }, 406 | "Combine file names [GITHUB]": { 407 | "main": [ 408 | [ 409 | { 410 | "node": "Retrieve workflows [N8N]", 411 | "type": "main", 412 | "index": 0 413 | } 414 | ] 415 | ] 416 | }, 417 | "Retrieve workflows [N8N]": { 418 | "main": [ 419 | [ 420 | { 421 | "node": "Move JSON to binary", 422 | "type": "main", 423 | "index": 0 424 | } 425 | ] 426 | ] 427 | }, 428 | "Move JSON to binary": { 429 | "main": [ 430 | [ 431 | { 432 | "node": "Split to single items", 433 | "type": "main", 434 | "index": 0 435 | } 436 | ] 437 | ] 438 | }, 439 | "Split to single items": { 440 | "main": [ 441 | [ 442 | { 443 | "node": "Check if file exists in repository", 444 | "type": "main", 445 | "index": 0 446 | } 447 | ] 448 | ] 449 | }, 450 | "Check if file exists in repository": { 451 | "main": [ 452 | [ 453 | { 454 | "node": "Update file [GITHUB]", 455 | "type": "main", 456 | "index": 0 457 | } 458 | ], 459 | [ 460 | { 461 | "node": "Upload file [GITHUB]", 462 | "type": "main", 463 | "index": 0 464 | } 465 | ] 466 | ] 467 | }, 468 | "Update file [GITHUB]": { 469 | "main": [ 470 | [ 471 | { 472 | "node": "Split to single items", 473 | "type": "main", 474 | "index": 0 475 | } 476 | ] 477 | ] 478 | }, 479 | "Upload file [GITHUB]": { 480 | "main": [ 481 | [ 482 | { 483 | "node": "Split to single items", 484 | "type": "main", 485 | "index": 0 486 | } 487 | ] 488 | ] 489 | } 490 | }, 491 | "active": false, 492 | "settings": {}, 493 | "versionId": "abf6d11d-4aeb-4d58-aa31-715dbcc10775", 494 | "id": "13", 495 | "meta": { 496 | "instanceId": "d4e165dcdbf908c0b0d5d4e6ec8ce6a720943b589cb469414465cf7d542ff754" 497 | }, 498 | "tags": [] 499 | } -------------------------------------------------------------------------------- /notion-n8n-automations/invoice-ocr-assistant-mindee.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Invoice OCR with NOTION and MINDEE", 3 | "nodes": [ 4 | { 5 | "parameters": { 6 | "url": "={{ $json['Invoice PDF'][0] }}", 7 | "options": {} 8 | }, 9 | "id": "8e8fe8f0-0f20-479f-9eb0-3fc16fcf5730", 10 | "name": "Get PDF", 11 | "type": "n8n-nodes-base.httpRequest", 12 | "typeVersion": 4.1, 13 | "position": [ 14 | 620, 15 | 740 16 | ] 17 | }, 18 | { 19 | "parameters": { 20 | "resource": "invoice" 21 | }, 22 | "id": "c9e5b882-e895-4733-8813-cb8b4a872337", 23 | "name": "Doc OCR [Mindee]", 24 | "type": "n8n-nodes-base.mindee", 25 | "typeVersion": 3, 26 | "position": [ 27 | 840, 28 | 740 29 | ], 30 | "credentials": { 31 | "mindeeInvoiceApi": { 32 | "id": "YLXkayEbTNlTMvoO", 33 | "name": "Mindee Invoice API" 34 | } 35 | } 36 | }, 37 | { 38 | "parameters": { 39 | "conditions": { 40 | "string": [ 41 | { 42 | "value1": "={{ $json['Invoice PDF'][0] }}", 43 | "operation": "isNotEmpty" 44 | }, 45 | { 46 | "value1": "={{ $json['Customer name'] }}", 47 | "operation": "isEmpty" 48 | }, 49 | { 50 | "value1": "={{ $json.Value }}", 51 | "operation": "isEmpty" 52 | }, 53 | { 54 | "value1": "={{ $json['Customer name'] }}", 55 | "operation": "isEmpty" 56 | }, 57 | { 58 | "value1": "={{ $json.Currency }}", 59 | "operation": "isEmpty" 60 | } 61 | ] 62 | } 63 | }, 64 | "id": "1adadaf5-54a5-4ae4-b68e-f6b81c89156f", 65 | "name": "Filter out non-empty records", 66 | "type": "n8n-nodes-base.filter", 67 | "typeVersion": 1, 68 | "position": [ 69 | 400, 70 | 740 71 | ] 72 | }, 73 | { 74 | "parameters": { 75 | "resource": "databasePage", 76 | "operation": "update", 77 | "pageId": { 78 | "__rl": true, 79 | "value": "={{ $('Notion trigger').item.json.id }}", 80 | "mode": "id", 81 | "__regex": "^([0-9a-f]{8}-?[0-9a-f]{4}-?4[0-9a-f]{3}-?[89ab][0-9a-f]{3}-?[0-9a-f]{12})" 82 | }, 83 | "propertiesUi": { 84 | "propertyValues": [ 85 | { 86 | "key": "Invoice number|title", 87 | "title": "={{ $json.invoice_number }}" 88 | }, 89 | { 90 | "key": "Customer name|rich_text", 91 | "textContent": "={{ $json.customer_name }}" 92 | }, 93 | { 94 | "key": "Date|date", 95 | "includeTime": false, 96 | "date": "={{ $json.date }}" 97 | }, 98 | { 99 | "key": "Due date|date", 100 | "includeTime": false, 101 | "date": "={{ $json.due_date }}" 102 | }, 103 | { 104 | "key": "Value|number", 105 | "numberValue": "={{ $json.total_amount }}" 106 | }, 107 | { 108 | "key": "Currency|rich_text", 109 | "textContent": "={{ $json.currency }}" 110 | } 111 | ] 112 | }, 113 | "options": {} 114 | }, 115 | "id": "6ba3b0ad-0b44-4c21-8e5c-d7dd78b4a302", 116 | "name": "Update records [NOTION]", 117 | "type": "n8n-nodes-base.notion", 118 | "typeVersion": 2, 119 | "position": [ 120 | 1060, 121 | 740 122 | ], 123 | "credentials": { 124 | "notionApi": { 125 | "id": "W4Bb643JwBHxezME", 126 | "name": "Notion API" 127 | } 128 | } 129 | }, 130 | { 131 | "parameters": { 132 | "pollTimes": { 133 | "item": [ 134 | { 135 | "mode": "everyMinute" 136 | } 137 | ] 138 | }, 139 | "event": "pagedUpdatedInDatabase", 140 | "databaseId": { 141 | "__rl": true, 142 | "value": "2601a29b-d10e-48c7-939e-daa9ff2cc831", 143 | "mode": "list", 144 | "cachedResultName": "OCR Assistant", 145 | "cachedResultUrl": "https://www.notion.so/2601a29bd10e48c7939edaa9ff2cc831" 146 | } 147 | }, 148 | "id": "80779bf7-ca27-41cb-8ed4-9a91b023a8f6", 149 | "name": "Notion trigger", 150 | "type": "n8n-nodes-base.notionTrigger", 151 | "typeVersion": 1, 152 | "position": [ 153 | 180, 154 | 740 155 | ], 156 | "credentials": { 157 | "notionApi": { 158 | "id": "W4Bb643JwBHxezME", 159 | "name": "Notion API" 160 | } 161 | } 162 | }, 163 | { 164 | "parameters": { 165 | "content": "## ⚠️ Note\n\n1. Complete video guide for this workflow is available [on my YouTube](https://www.youtube.com/watch?v=up2Wi3Y9a-4).\n2. Remember to add your credentials (covered in the video guide).\n3. Notion template (Social Image Generator) for this workflow available [here](https://shy-angelfish-d73.notion.site/2601a29bd10e48c7939edaa9ff2cc831?v=3cbbfacbe17c4074a7f7c1f0df027f75&pvs=4) (click \"duplicate\" to add template to your workspace).\n4. If you like this workflow, please subscribe to [my YouTube channel](https://www.youtube.com/@workfloows) and/or [my newsletter](https://workfloows.com/).\n\n**Thank you for your support!**", 166 | "height": 311.48468467358765, 167 | "width": 398.52076028843226 168 | }, 169 | "id": "ac310924-02da-42db-b51a-3ef1c829523e", 170 | "name": "Sticky Note5", 171 | "type": "n8n-nodes-base.stickyNote", 172 | "typeVersion": 1, 173 | "position": [ 174 | -300, 175 | 540 176 | ] 177 | }, 178 | { 179 | "parameters": { 180 | "content": "## Trigger\n\nWorkflow is activated every time database is updated (set polling time according to your needs). ", 181 | "height": 369.538552133761, 182 | "width": 178.9116807727541 183 | }, 184 | "id": "8283a0cf-699d-417e-a909-81044f3ecbcc", 185 | "name": "Sticky Note", 186 | "type": "n8n-nodes-base.stickyNote", 187 | "typeVersion": 1, 188 | "position": [ 189 | 140, 190 | 540 191 | ] 192 | }, 193 | { 194 | "parameters": { 195 | "content": "## Filter\n\nFilter out items that already include complete data. ", 196 | "height": 369.538552133761, 197 | "width": 178.9116807727541 198 | }, 199 | "id": "c8d7e4ae-a7b3-4ab4-89db-6fb6fc2182af", 200 | "name": "Sticky Note1", 201 | "type": "n8n-nodes-base.stickyNote", 202 | "typeVersion": 1, 203 | "position": [ 204 | 360, 205 | 540 206 | ] 207 | }, 208 | { 209 | "parameters": { 210 | "content": "## Perform doc reading and update record\n\nThis sequence makes a call to [Mindee](https://mindee.com/) API and updates specific row in Notion database.", 211 | "height": 371.5385521337611, 212 | "width": 434.1240424644708 213 | }, 214 | "id": "fbacd34c-b24d-48cb-93cc-8b9de09f9638", 215 | "name": "Sticky Note2", 216 | "type": "n8n-nodes-base.stickyNote", 217 | "typeVersion": 1, 218 | "position": [ 219 | 802.3559202466091, 220 | 540 221 | ] 222 | }, 223 | { 224 | "parameters": { 225 | "content": "## Download PDF\n\nGet PDF file from specific row of Notion database.", 226 | "height": 369.538552133761, 227 | "width": 178.9116807727541 228 | }, 229 | "id": "6fdad61d-f223-4691-93c8-bfb5784fffaa", 230 | "name": "Sticky Note3", 231 | "type": "n8n-nodes-base.stickyNote", 232 | "typeVersion": 1, 233 | "position": [ 234 | 580, 235 | 540 236 | ] 237 | }, 238 | { 239 | "parameters": { 240 | "content": "## 🌐 API\n\nThis workflow is using Mindee API - you can find documentation [here](https://developers.mindee.com/docs). ", 241 | "height": 126.83608073918806, 242 | "width": 398.52076028843226 243 | }, 244 | "id": "440384b8-d23b-46e3-a024-e38c46fcc197", 245 | "name": "Sticky Note6", 246 | "type": "n8n-nodes-base.stickyNote", 247 | "typeVersion": 1, 248 | "position": [ 249 | -300, 250 | 880 251 | ] 252 | } 253 | ], 254 | "pinData": {}, 255 | "connections": { 256 | "Get PDF": { 257 | "main": [ 258 | [ 259 | { 260 | "node": "Doc OCR [Mindee]", 261 | "type": "main", 262 | "index": 0 263 | } 264 | ] 265 | ] 266 | }, 267 | "Doc OCR [Mindee]": { 268 | "main": [ 269 | [ 270 | { 271 | "node": "Update records [NOTION]", 272 | "type": "main", 273 | "index": 0 274 | } 275 | ] 276 | ] 277 | }, 278 | "Filter out non-empty records": { 279 | "main": [ 280 | [ 281 | { 282 | "node": "Get PDF", 283 | "type": "main", 284 | "index": 0 285 | } 286 | ] 287 | ] 288 | }, 289 | "Notion trigger": { 290 | "main": [ 291 | [ 292 | { 293 | "node": "Filter out non-empty records", 294 | "type": "main", 295 | "index": 0 296 | } 297 | ] 298 | ] 299 | } 300 | }, 301 | "active": false, 302 | "settings": { 303 | "executionOrder": "v1" 304 | }, 305 | "versionId": "e30a66a6-f189-4258-ad66-dc89f3fcc166", 306 | "id": "EdzT31MLnmSzf73S", 307 | "meta": { 308 | "instanceId": "4e33b83e762d8bff5fa22051bf1548b418f041b56f6bd9b4536d58b3a7af1854" 309 | }, 310 | "tags": [] 311 | } -------------------------------------------------------------------------------- /notion-n8n-automations/social-image-generator-renderform.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Create images with NOTION and RENDERFORM", 3 | "nodes": [ 4 | { 5 | "parameters": { 6 | "pollTimes": { 7 | "item": [ 8 | { 9 | "mode": "everyMinute" 10 | } 11 | ] 12 | }, 13 | "event": "pagedUpdatedInDatabase", 14 | "databaseId": { 15 | "__rl": true, 16 | "value": "e6bba80d-b7ce-4e34-a418-058fd1d557ba", 17 | "mode": "list", 18 | "cachedResultName": "Social Image Generator", 19 | "cachedResultUrl": "https://www.notion.so/e6bba80db7ce4e34a418058fd1d557ba" 20 | } 21 | }, 22 | "id": "caa17d87-0a43-4ae5-8d02-b20a396424a2", 23 | "name": "Notion trigger", 24 | "type": "n8n-nodes-base.notionTrigger", 25 | "typeVersion": 1, 26 | "position": [ 27 | 340, 28 | 60 29 | ], 30 | "credentials": { 31 | "notionApi": { 32 | "id": "W4Bb643JwBHxezME", 33 | "name": "Notion API" 34 | } 35 | } 36 | }, 37 | { 38 | "parameters": { 39 | "conditions": { 40 | "string": [ 41 | { 42 | "value1": "={{ $json.Position }}", 43 | "operation": "isNotEmpty" 44 | }, 45 | { 46 | "value1": "={{ $json.Name }}", 47 | "operation": "isNotEmpty" 48 | }, 49 | { 50 | "value1": "={{ $json.Topic }}", 51 | "operation": "isNotEmpty" 52 | }, 53 | { 54 | "value1": "={{ $json.Image[0] }}", 55 | "operation": "isEmpty" 56 | } 57 | ] 58 | } 59 | }, 60 | "id": "92309c66-43be-428f-aaf6-2939a38029cd", 61 | "name": "Filter out empty and finished records", 62 | "type": "n8n-nodes-base.filter", 63 | "typeVersion": 1, 64 | "position": [ 65 | 560, 66 | 60 67 | ] 68 | }, 69 | { 70 | "parameters": { 71 | "method": "POST", 72 | "url": "https://get.renderform.io/api/v2/render", 73 | "authentication": "genericCredentialType", 74 | "genericAuthType": "httpHeaderAuth", 75 | "sendBody": true, 76 | "specifyBody": "json", 77 | "jsonBody": "={\"template\":\"dusty-tigers-sail-tensely-1990\",\"data\":{\"image.src\":\"{{ $json[\"Image\"][0] }}\",\"topic.text\":\"{{ $json[\"Topic\"] }}\",\"presenter.text\":\"{{ $json[\"Name\"] }}\",\"presenter_title.text\":\"{{ $json[\"Position\"] }}\"}}", 78 | "options": {} 79 | }, 80 | "id": "5c887b16-6cc3-4e4e-91c5-479c954f3c93", 81 | "name": "Generate image [RENDERFORM]", 82 | "type": "n8n-nodes-base.httpRequest", 83 | "typeVersion": 4.1, 84 | "position": [ 85 | 780, 86 | 60 87 | ], 88 | "credentials": { 89 | "httpHeaderAuth": { 90 | "id": "vsimCHiqWdZ5L4Zo", 91 | "name": "RenderForm API" 92 | } 93 | } 94 | }, 95 | { 96 | "parameters": { 97 | "resource": "databasePage", 98 | "operation": "update", 99 | "pageId": { 100 | "__rl": true, 101 | "value": "={{ $('Notion trigger').item.json[\"id\"] }}", 102 | "mode": "id", 103 | "__regex": "^([0-9a-f]{8}-?[0-9a-f]{4}-?4[0-9a-f]{3}-?[89ab][0-9a-f]{3}-?[0-9a-f]{12})" 104 | }, 105 | "propertiesUi": { 106 | "propertyValues": [ 107 | { 108 | "key": "Social|files", 109 | "fileUrls": { 110 | "fileUrl": [ 111 | { 112 | "name": "social", 113 | "url": "={{ $json.href }}" 114 | } 115 | ] 116 | } 117 | } 118 | ] 119 | }, 120 | "options": {} 121 | }, 122 | "id": "f05b5691-5566-4fda-bf86-969dfba16e89", 123 | "name": "Update records [NOTION]", 124 | "type": "n8n-nodes-base.notion", 125 | "typeVersion": 2, 126 | "position": [ 127 | 1000, 128 | 60 129 | ], 130 | "credentials": { 131 | "notionApi": { 132 | "id": "W4Bb643JwBHxezME", 133 | "name": "Notion API" 134 | } 135 | } 136 | }, 137 | { 138 | "parameters": { 139 | "content": "## ⚠️ Note\n\n1. Complete video guide for this workflow is available [on my YouTube](https://www.youtube.com/watch?v=up2Wi3Y9a-4).\n2. Remember to add your credentials (covered in the video guide).\n3. Notion template (Social Image Generator) for this workflow available [here](https://shy-angelfish-d73.notion.site/e6bba80db7ce4e34a418058fd1d557ba?v=925a2be608cb44219b5730b621756705&pvs=4) (click \"duplicate\" to add template to your workspace).\n4. If you like this workflow, please subscribe to [my YouTube channel](https://www.youtube.com/@workfloows) and/or [my newsletter](https://workfloows.com/).\n\n**Thank you for your support!**", 140 | "height": 320.8800052473881, 141 | "width": 398.52076028843226 142 | }, 143 | "id": "e0d7156d-4536-497f-98e2-2c55c5230f59", 144 | "name": "Sticky Note5", 145 | "type": "n8n-nodes-base.stickyNote", 146 | "typeVersion": 1, 147 | "position": [ 148 | -140, 149 | -126 150 | ] 151 | }, 152 | { 153 | "parameters": { 154 | "content": "## Trigger\n\nWorkflow is activated every time database is updated (set polling time according to your needs). ", 155 | "height": 369.538552133761, 156 | "width": 178.9116807727541 157 | }, 158 | "id": "9bfd451b-c018-432c-abd1-15d1a250e3bf", 159 | "name": "Sticky Note", 160 | "type": "n8n-nodes-base.stickyNote", 161 | "typeVersion": 1, 162 | "position": [ 163 | 300, 164 | -126 165 | ] 166 | }, 167 | { 168 | "parameters": { 169 | "content": "## Filter\n\nFilter out items that already have generated social image or don't include complete data. ", 170 | "height": 369.538552133761, 171 | "width": 178.9116807727541 172 | }, 173 | "id": "5bb5dfb1-4008-4882-af7c-e40115b61eeb", 174 | "name": "Sticky Note1", 175 | "type": "n8n-nodes-base.stickyNote", 176 | "typeVersion": 1, 177 | "position": [ 178 | 520, 179 | -126 180 | ] 181 | }, 182 | { 183 | "parameters": { 184 | "content": "## Generate image and update database row\n\nThis sequence makes a call to [RenderForm](https://renderform.io/) API and updates specific row in Notion database. Remember to update your credentials and template parameters.", 185 | "height": 371.5385521337611, 186 | "width": 432.9116807727541 187 | }, 188 | "id": "c52d764d-d6e7-47b9-ac2d-52e631ac3247", 189 | "name": "Sticky Note2", 190 | "type": "n8n-nodes-base.stickyNote", 191 | "typeVersion": 1, 192 | "position": [ 193 | 740, 194 | -127 195 | ] 196 | }, 197 | { 198 | "parameters": { 199 | "content": "## 🌐 API\n\nThis workflow is using RenderForm API - you can find documentation [here](https://renderform.io/docs/). ", 200 | "height": 127.88000524738811, 201 | "width": 398.52076028843226 202 | }, 203 | "id": "1e9ddcae-183f-4aae-8de1-5f69c2bd60e1", 204 | "name": "Sticky Note6", 205 | "type": "n8n-nodes-base.stickyNote", 206 | "typeVersion": 1, 207 | "position": [ 208 | -140, 209 | 220 210 | ] 211 | } 212 | ], 213 | "pinData": {}, 214 | "connections": { 215 | "Notion trigger": { 216 | "main": [ 217 | [ 218 | { 219 | "node": "Filter out empty and finished records", 220 | "type": "main", 221 | "index": 0 222 | } 223 | ] 224 | ] 225 | }, 226 | "Filter out empty and finished records": { 227 | "main": [ 228 | [ 229 | { 230 | "node": "Generate image [RENDERFORM]", 231 | "type": "main", 232 | "index": 0 233 | } 234 | ] 235 | ] 236 | }, 237 | "Generate image [RENDERFORM]": { 238 | "main": [ 239 | [ 240 | { 241 | "node": "Update records [NOTION]", 242 | "type": "main", 243 | "index": 0 244 | } 245 | ] 246 | ] 247 | } 248 | }, 249 | "active": false, 250 | "settings": { 251 | "executionOrder": "v1" 252 | }, 253 | "versionId": "c1c29f92-ba00-460f-911d-3db99510d479", 254 | "id": "BGMvEpqiIzUennYF", 255 | "meta": { 256 | "instanceId": "4e33b83e762d8bff5fa22051bf1548b418f041b56f6bd9b4536d58b3a7af1854" 257 | }, 258 | "tags": [] 259 | } -------------------------------------------------------------------------------- /notion-n8n-automations/stock-portfolio-tracker-alpha-vantage.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Stock tracker with NOTION and ALPHA VANTAGE", 3 | "nodes": [ 4 | { 5 | "parameters": { 6 | "resource": "databasePage", 7 | "operation": "getAll", 8 | "databaseId": { 9 | "__rl": true, 10 | "value": "76ac1d15-8bec-4533-807f-80f296e89b10", 11 | "mode": "list", 12 | "cachedResultName": "Stock Portfolio Tracker", 13 | "cachedResultUrl": "https://www.notion.so/76ac1d158bec4533807f80f296e89b10" 14 | }, 15 | "returnAll": true, 16 | "options": {} 17 | }, 18 | "id": "f800d3ce-5d4d-4aba-9fe5-d4d199d8f9e6", 19 | "name": "Get tickers [NOTION]", 20 | "type": "n8n-nodes-base.notion", 21 | "typeVersion": 2, 22 | "position": [ 23 | 20, 24 | 680 25 | ], 26 | "credentials": { 27 | "notionApi": { 28 | "id": "W4Bb643JwBHxezME", 29 | "name": "Notion API" 30 | } 31 | } 32 | }, 33 | { 34 | "parameters": { 35 | "resource": "databasePage", 36 | "operation": "update", 37 | "pageId": { 38 | "__rl": true, 39 | "value": "={{ $('Get tickers [NOTION]').item.json.id }}", 40 | "mode": "id", 41 | "__regex": "^([0-9a-f]{8}-?[0-9a-f]{4}-?4[0-9a-f]{3}-?[89ab][0-9a-f]{3}-?[0-9a-f]{12})" 42 | }, 43 | "propertiesUi": { 44 | "propertyValues": [ 45 | { 46 | "key": "Price|number", 47 | "numberValue": "={{ Number($json['Global Quote']['05. price']) }}" 48 | }, 49 | { 50 | "key": "Price date|date", 51 | "includeTime": false, 52 | "date": "={{ $json['Global Quote']['07. latest trading day'] }}", 53 | "timezone": "America/New_York" 54 | } 55 | ] 56 | }, 57 | "options": {} 58 | }, 59 | "id": "bf70fa6d-2a4e-486f-b58c-845407319515", 60 | "name": "Update rows [NOTION]", 61 | "type": "n8n-nodes-base.notion", 62 | "typeVersion": 2, 63 | "position": [ 64 | 880, 65 | 460 66 | ], 67 | "credentials": { 68 | "notionApi": { 69 | "id": "W4Bb643JwBHxezME", 70 | "name": "Notion API" 71 | } 72 | } 73 | }, 74 | { 75 | "parameters": {}, 76 | "id": "1e90021c-36de-41cb-a8e8-0611b54ce25f", 77 | "name": "No operation", 78 | "type": "n8n-nodes-base.noOp", 79 | "typeVersion": 1, 80 | "position": [ 81 | 440, 82 | 880 83 | ] 84 | }, 85 | { 86 | "parameters": { 87 | "batchSize": 1, 88 | "options": {} 89 | }, 90 | "id": "a76dc779-c3a3-46de-b4f2-bcf912a84f63", 91 | "name": "Split in batches", 92 | "type": "n8n-nodes-base.splitInBatches", 93 | "typeVersion": 2, 94 | "position": [ 95 | 240, 96 | 680 97 | ] 98 | }, 99 | { 100 | "parameters": { 101 | "url": "=https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol={{ $json[\"property_ticker\"] }}&apikey=[YOUR_API_KEY]", 102 | "options": {} 103 | }, 104 | "id": "2ff0d4ca-548f-4c91-9f7b-6670b8bc51c2", 105 | "name": "Quote endpoint [VANTAGE ALPHA]", 106 | "type": "n8n-nodes-base.httpRequest", 107 | "typeVersion": 4.1, 108 | "position": [ 109 | 660, 110 | 460 111 | ] 112 | }, 113 | { 114 | "parameters": { 115 | "content": "## ⚠️ Note\n\n1. Complete video guide for this workflow is available [on my YouTube](https://youtu.be/up2Wi3Y9a-4).\n2. Remember to add your credentials (covered in the video guide).\n3. Notion template (Stock Portfolio Tracker) for this workflow available [here](https://shy-angelfish-d73.notion.site/76ac1d158bec4533807f80f296e89b10?v=98e123608ad54d8198174907691c8ace&pvs=4) (click \"duplicate\" to add template to your workspace).\n4. If you like this workflow, please subscribe to [my YouTube channel](https://www.youtube.com/@workfloows) and/or [my newsletter](https://workfloows.com/).\n\n**Thank you for your support!**", 116 | "height": 311.3138775936101, 117 | "width": 398.52076028843226 118 | }, 119 | "id": "a3964007-7a46-43a8-9704-5300b02a4428", 120 | "name": "Sticky Note5", 121 | "type": "n8n-nodes-base.stickyNote", 122 | "typeVersion": 1, 123 | "position": [ 124 | -680, 125 | 520 126 | ] 127 | }, 128 | { 129 | "parameters": { 130 | "rule": { 131 | "interval": [ 132 | {} 133 | ] 134 | } 135 | }, 136 | "id": "d7c31990-f036-42ff-b9c4-f60cd1a5eebf", 137 | "name": "Schedule trigger", 138 | "type": "n8n-nodes-base.scheduleTrigger", 139 | "typeVersion": 1.1, 140 | "position": [ 141 | -200, 142 | 680 143 | ] 144 | }, 145 | { 146 | "parameters": { 147 | "content": "## Trigger\n\nWorkflow is activated everyday at specific time. ", 148 | "height": 323.538552133761, 149 | "width": 178.9116807727541 150 | }, 151 | "id": "8c74770f-d43b-4b26-b3ee-b469d8b1c665", 152 | "name": "Sticky Note", 153 | "type": "n8n-nodes-base.stickyNote", 154 | "typeVersion": 1, 155 | "position": [ 156 | -240, 157 | 520 158 | ] 159 | }, 160 | { 161 | "parameters": { 162 | "content": "## Get tickers\n\nReturn stock tickers from Notion database. ", 163 | "height": 323.538552133761, 164 | "width": 178.9116807727541 165 | }, 166 | "id": "5663fbe3-5537-40d0-a7a4-9658cd787ca9", 167 | "name": "Sticky Note1", 168 | "type": "n8n-nodes-base.stickyNote", 169 | "typeVersion": 1, 170 | "position": [ 171 | -20, 172 | 520 173 | ] 174 | }, 175 | { 176 | "parameters": { 177 | "content": "## Get prices and update database\n\nThis sequence gets current stock prices using [Alpha Vantage API](https://www.alphavantage.co/) and updates rows in Notion database. Free API key provides **5 API requests per minute**, so workflow sends request every 12 seconds.\n\n**Important:** remember to replace ```[YOUR_API_KEY]``` in field URL with your actual Alpha Vantage API key.", 178 | "height": 396.66293784941865, 179 | "width": 628.9480210610396 180 | }, 181 | "id": "72953b3d-ad5c-466e-870f-0dfe4c634641", 182 | "name": "Sticky Note2", 183 | "type": "n8n-nodes-base.stickyNote", 184 | "typeVersion": 1, 185 | "position": [ 186 | 400, 187 | 246.87561428434236 188 | ] 189 | }, 190 | { 191 | "parameters": { 192 | "amount": 12, 193 | "unit": "seconds" 194 | }, 195 | "id": "5c4b52da-90ff-41d5-bc4d-a7fc37f8a82e", 196 | "name": "Wait 12 second", 197 | "type": "n8n-nodes-base.wait", 198 | "typeVersion": 1, 199 | "position": [ 200 | 440, 201 | 460 202 | ], 203 | "webhookId": "2f1d1415-8666-4564-be5f-da72eadd3dc8" 204 | }, 205 | { 206 | "parameters": { 207 | "content": "## 🌐 API\n\nThis workflow is using Alpha Vantage API - you can find documentation [here](https://www.alphavantage.co/documentation/). ", 208 | "height": 127.88000524738811, 209 | "width": 398.52076028843226 210 | }, 211 | "id": "9aef4868-f443-41d0-939a-c78f7843670b", 212 | "name": "Sticky Note6", 213 | "type": "n8n-nodes-base.stickyNote", 214 | "typeVersion": 1, 215 | "position": [ 216 | -680, 217 | 860 218 | ] 219 | } 220 | ], 221 | "pinData": {}, 222 | "connections": { 223 | "Get tickers [NOTION]": { 224 | "main": [ 225 | [ 226 | { 227 | "node": "Split in batches", 228 | "type": "main", 229 | "index": 0 230 | } 231 | ] 232 | ] 233 | }, 234 | "Split in batches": { 235 | "main": [ 236 | [ 237 | { 238 | "node": "Wait 12 second", 239 | "type": "main", 240 | "index": 0 241 | } 242 | ], 243 | [ 244 | { 245 | "node": "No operation", 246 | "type": "main", 247 | "index": 0 248 | } 249 | ] 250 | ] 251 | }, 252 | "Quote endpoint [VANTAGE ALPHA]": { 253 | "main": [ 254 | [ 255 | { 256 | "node": "Update rows [NOTION]", 257 | "type": "main", 258 | "index": 0 259 | } 260 | ] 261 | ] 262 | }, 263 | "Update rows [NOTION]": { 264 | "main": [ 265 | [ 266 | { 267 | "node": "Split in batches", 268 | "type": "main", 269 | "index": 0 270 | } 271 | ] 272 | ] 273 | }, 274 | "Schedule trigger": { 275 | "main": [ 276 | [ 277 | { 278 | "node": "Get tickers [NOTION]", 279 | "type": "main", 280 | "index": 0 281 | } 282 | ] 283 | ] 284 | }, 285 | "Wait 12 second": { 286 | "main": [ 287 | [ 288 | { 289 | "node": "Quote endpoint [VANTAGE ALPHA]", 290 | "type": "main", 291 | "index": 0 292 | } 293 | ] 294 | ] 295 | } 296 | }, 297 | "active": false, 298 | "settings": { 299 | "executionOrder": "v1" 300 | }, 301 | "versionId": "6a231d49-c6fc-4512-9132-e1bdf00b8b9a", 302 | "id": "Ra1stCrtV7yiFs34", 303 | "meta": { 304 | "instanceId": "4e33b83e762d8bff5fa22051bf1548b418f041b56f6bd9b4536d58b3a7af1854" 305 | }, 306 | "tags": [] 307 | } -------------------------------------------------------------------------------- /scrape-data-n8n-puppeteer/puppeteer-script/google-cloud-functions-adjusted/.puppeteerrc.cjs: -------------------------------------------------------------------------------- 1 | const {join} = require('path'); 2 | 3 | /** 4 | * @type {import("puppeteer").Configuration} 5 | */ 6 | module.exports = { 7 | // Changes the cache location for Puppeteer 8 | cacheDirectory: join(__dirname, '.cache', 'puppeteer'), 9 | }; 10 | -------------------------------------------------------------------------------- /scrape-data-n8n-puppeteer/puppeteer-script/google-cloud-functions-adjusted/index.js: -------------------------------------------------------------------------------- 1 | // This Puppeteer script is intended to deploy on Google Cloud Functions. 2 | // It enables you to retrieve text from all elements on the website. 3 | // After deploying, simply trigger the function including "name" parameter, which is URL of the website you want to scrape. 4 | // Example: https://us-central1-workfloows.cloudfunctions.net/getPageContent?name=[URL_OF_WEBSITE_TO_SCRAPE] 5 | 6 | // VIDEO TUTORIAL 7 | // Complete video guide available on my YouTube: https://youtu.be/YonNJqAAxdg 8 | 9 | // INFO 10 | // If you like my work, please subscirbe to my YouTube channel: https://www.youtube.com/@workfloows 11 | // And/or to my newsletter: https://workfloows.com/ 12 | 13 | // Thank you for your support! 14 | 15 | 16 | 17 | // Importing the necessary libraries 18 | const functions = require('@google-cloud/functions-framework'); 19 | const puppeteer = require('puppeteer'); 20 | 21 | // Function to get the content of a web page 22 | async function getPageContent(name) { 23 | 24 | // Launching a Puppeteer browser instance 25 | const browser = await puppeteer.launch({ 26 | args : [ 27 | '--no-sandbox' 28 | ] 29 | }); 30 | 31 | // Opening a new page in the browser 32 | const page = (await browser.pages())[0]; 33 | 34 | // Navigating to the specified URL 35 | await page.goto(name); 36 | 37 | // Extracting the inner text of all elements on the page 38 | const extractedText = await page.$eval('*', (el) => el.innerText); 39 | 40 | // Closing the browser instance 41 | await browser.close(); 42 | 43 | // Returning the extracted text 44 | return extractedText; 45 | 46 | }; 47 | 48 | // Exporting the function as a Google Cloud Function 49 | exports.getPageContent = async function(req, res) { 50 | 51 | // Retrieving the 'name' parameter from the request body or query string 52 | let name = req.body.name || req.query.name; 53 | 54 | // Setting the response status code to 200 and sending the page content 55 | res.status(200).send(await getPageContent(name)); 56 | } -------------------------------------------------------------------------------- /scrape-data-n8n-puppeteer/puppeteer-script/google-cloud-functions-adjusted/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "scripts": { 3 | "gcp-build": "node node_modules/puppeteer/install.js" 4 | }, 5 | "dependencies": { 6 | "@google-cloud/functions-framework": "^3.0.0", 7 | "puppeteer": "^19.8.0" 8 | } 9 | } -------------------------------------------------------------------------------- /scrape-data-n8n-puppeteer/puppeteer-script/index.js: -------------------------------------------------------------------------------- 1 | // This Puppeteer script enables you to retrieve text from all elements on the website. 2 | 3 | // VIDEO TUTORIAL 4 | // Complete video guide available on my YouTube: https://youtu.be/YonNJqAAxdg 5 | 6 | // INFO 7 | // If you like my work, please subscirbe to my YouTube channel: https://www.youtube.com/@workfloows 8 | // And/or to my newsletter: https://workfloows.com/ 9 | 10 | // Thank you for your support! 11 | 12 | 13 | 14 | // Importing the necessary libraries 15 | const puppeteer = require('puppeteer'); 16 | 17 | // Function to get the content of a web page 18 | async function getPageContent() { 19 | 20 | // Launching a Puppeteer browser instance 21 | const browser = await puppeteer.launch({ 22 | headless: 'new', 23 | args : [ 24 | '--no-sandbox' 25 | ] 26 | }); 27 | 28 | // Opening a new page in the browser 29 | const page = (await browser.pages())[0]; 30 | 31 | // Navigating to the specified URL 32 | await page.goto('https://google.com/'); 33 | 34 | // Extracting the inner text of all elements on the page 35 | const extractedText = await page.$eval('*', (el) => el.innerText); 36 | 37 | // Printing the extracted text to the console 38 | console.log(extractedText); 39 | 40 | // Closing the browser instance 41 | await browser.close(); 42 | 43 | }; 44 | 45 | // Calling the getPageContent function 46 | getPageContent(); -------------------------------------------------------------------------------- /scrape-data-n8n-puppeteer/retrieve-email-addresses.js: -------------------------------------------------------------------------------- 1 | // This JavaScript code retrieves email addresses from input string using regular expression. 2 | // Use it in "Function" node in n8n. 3 | 4 | // VIDEO TUTORIAL 5 | // Complete video guide available on my YouTube: https://youtu.be/YonNJqAAxdg 6 | 7 | // INFO 8 | // If you like my work, please subscirbe to my YouTube channel: https://www.youtube.com/@workfloows 9 | // And/or to my newsletter: https://workfloows.com/ 10 | 11 | // Thank you for your support! 12 | 13 | 14 | 15 | // Assigning the value of $json.data (output of previous node) to the variable 'str' 16 | let str = $json.data; 17 | 18 | // Creating a regular expression pattern to match email addresses 19 | let expression = new RegExp('\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}\\b', 'gm'); 20 | 21 | // Using the regular expression to find all matches in the 'str' string 22 | let found = Array.from(str.matchAll(expression)).flat().filter(n => n); 23 | 24 | // Removing duplicate email addresses using a Set 25 | let uniqueValues = [...new Set(found)]; 26 | 27 | // Returning an object containing the unique email addresses as 'foundEmails' property 28 | return { json: { foundEmails: uniqueValues } }; -------------------------------------------------------------------------------- /telegram-ai-bot.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Telegram AI bot", 3 | "nodes": [ 4 | { 5 | "parameters": { 6 | "conditions": { 7 | "number": [ 8 | { 9 | "value1": "={{ $json.message.chat.id }}", 10 | "operation": "equal" 11 | } 12 | ] 13 | } 14 | }, 15 | "id": "77736d3b-f067-433f-9e00-56aa0266dbd4", 16 | "name": "Check chat ID", 17 | "type": "n8n-nodes-base.if", 18 | "typeVersion": 1, 19 | "position": [ 20 | 100, 21 | 840 22 | ] 23 | }, 24 | { 25 | "parameters": { 26 | "amount": 3, 27 | "unit": "seconds" 28 | }, 29 | "id": "b6cbe9da-8a7b-4d0e-9335-a5ffe1865ed1", 30 | "name": "Wait 3 seconds", 31 | "type": "n8n-nodes-base.wait", 32 | "typeVersion": 1, 33 | "position": [ 34 | 580, 35 | 1000 36 | ], 37 | "webhookId": "5927178d-1fed-4ee6-bcad-c83fec83c92a" 38 | }, 39 | { 40 | "parameters": { 41 | "chatId": "={{ $node['Telegram trigger'].json.message.chat.id }}", 42 | "text": "I'm not authorized to speak with you. ", 43 | "additionalFields": {} 44 | }, 45 | "id": "7649186b-5981-4348-a8ea-a0c45bf31b2c", 46 | "name": "Send unauthorized info [TELEGRAM]", 47 | "type": "n8n-nodes-base.telegram", 48 | "typeVersion": 1, 49 | "position": [ 50 | 780, 51 | 1000 52 | ], 53 | "credentials": { 54 | "telegramApi": { 55 | "id": "1", 56 | "name": "Telegram (WorkfloowsAI)" 57 | } 58 | } 59 | }, 60 | { 61 | "parameters": { 62 | "chatId": "={{ $node['Check chat ID'].json.message.chat.id }}", 63 | "text": "={{$node['Generate answer [OPENAI]'].json.message.content }}", 64 | "additionalFields": {} 65 | }, 66 | "id": "e0e1cd0d-663a-4898-ba21-dd7f49e0c5d6", 67 | "name": "Send response [TELEGRAM]", 68 | "type": "n8n-nodes-base.telegram", 69 | "typeVersion": 1, 70 | "position": [ 71 | 780, 72 | 640 73 | ], 74 | "credentials": { 75 | "telegramApi": { 76 | "id": "1", 77 | "name": "Telegram (WorkfloowsAI)" 78 | } 79 | } 80 | }, 81 | { 82 | "parameters": { 83 | "resource": "chat", 84 | "prompt": { 85 | "messages": [ 86 | { 87 | "role": "assistant", 88 | "content": "You're an assistant called WorkfloowsAI. Your task is to help user with daily tasks." 89 | }, 90 | { 91 | "role": "assistant", 92 | "content": "=" 93 | }, 94 | { 95 | "content": "={{ $node[\"Telegram trigger\"].json[\"message\"][\"text\"] }}" 96 | } 97 | ] 98 | }, 99 | "options": {} 100 | }, 101 | "id": "22ef7ed6-74f6-4eab-b803-336867e96cb7", 102 | "name": "Generate answer [OPENAI]", 103 | "type": "n8n-nodes-base.openAi", 104 | "typeVersion": 1, 105 | "position": [ 106 | 580, 107 | 640 108 | ], 109 | "credentials": { 110 | "openAiApi": { 111 | "id": "2", 112 | "name": "OpenAi (Workfloows)" 113 | } 114 | } 115 | }, 116 | { 117 | "parameters": { 118 | "conditions": { 119 | "string": [ 120 | { 121 | "value1": "={{ $json.message.text }}", 122 | "value2": "/start" 123 | } 124 | ] 125 | } 126 | }, 127 | "id": "96e706b3-8861-4e69-b2ba-0848348f1d50", 128 | "name": "Check if start", 129 | "type": "n8n-nodes-base.if", 130 | "typeVersion": 1, 131 | "position": [ 132 | -120, 133 | 660 134 | ] 135 | }, 136 | { 137 | "parameters": {}, 138 | "id": "7205c215-0ee4-43f6-8ab6-e80069a544d2", 139 | "name": "No operation", 140 | "type": "n8n-nodes-base.noOp", 141 | "typeVersion": 1, 142 | "position": [ 143 | 100, 144 | 440 145 | ] 146 | }, 147 | { 148 | "parameters": { 149 | "content": "## ⚠️ Note\n\n1. Complete video guide for this workflow is available [on my YouTube](https://www.youtube.com/watch?v=Gc2lW5BiGDQ). \n2. Remember to add your credentials and configure nodes (covered in the video guide).\n3. If you like this workflow, please subscribe to [my YouTube channel](https://www.youtube.com/@workfloows) and/or [my newsletter](https://workfloows.com/).\n\n**Thank you for your support!**", 150 | "height": 258.9141682442004, 151 | "width": 382.8182353336517 152 | }, 153 | "id": "8f56566e-b1f4-4beb-9e49-2efed78629f7", 154 | "name": "Sticky Note5", 155 | "type": "n8n-nodes-base.stickyNote", 156 | "typeVersion": 1, 157 | "position": [ 158 | -360, 159 | 220 160 | ] 161 | }, 162 | { 163 | "parameters": { 164 | "updates": [ 165 | "message" 166 | ], 167 | "additionalFields": {} 168 | }, 169 | "id": "3f0981f4-f2e7-402d-bec8-4f7bd51c171c", 170 | "name": "Telegram trigger", 171 | "type": "n8n-nodes-base.telegramTrigger", 172 | "typeVersion": 1, 173 | "position": [ 174 | -320, 175 | 660 176 | ], 177 | "webhookId": "64456f84-9a61-4ccc-a28c-3aca7a498103", 178 | "credentials": { 179 | "telegramApi": { 180 | "id": "1", 181 | "name": "Telegram (WorkfloowsAI)" 182 | } 183 | } 184 | }, 185 | { 186 | "parameters": { 187 | "content": "## Trigger\nRemember to add credentials of your Telegram bot.", 188 | "height": 339.51767272727324, 189 | "width": 182.4715262478496 190 | }, 191 | "id": "6b50c849-ad4b-4152-9b15-df2d214ba39a", 192 | "name": "Sticky Note6", 193 | "type": "n8n-nodes-base.stickyNote", 194 | "typeVersion": 1, 195 | "position": [ 196 | -360, 197 | 500 198 | ] 199 | }, 200 | { 201 | "parameters": { 202 | "content": "## Ignore start\nThis node will ignore initial ```/start``` message that is sent by first conversation with bot.", 203 | "height": 339.51767272727324, 204 | "width": 182.4715262478496 205 | }, 206 | "id": "3e36441b-5693-43a6-9a19-8411fb4d3473", 207 | "name": "Sticky Note7", 208 | "type": "n8n-nodes-base.stickyNote", 209 | "typeVersion": 1, 210 | "position": [ 211 | -160, 212 | 500 213 | ] 214 | }, 215 | { 216 | "parameters": { 217 | "content": "## Authorize\nChange default value ```0``` to your 10-digit chat ID to authorize conversation and disable other people to talk to your bot.", 218 | "height": 367.74256847311284, 219 | "width": 182.4715262478496 220 | }, 221 | "id": "8c1e7d14-c3a1-4f22-8d2f-d1db3e784740", 222 | "name": "Sticky Note8", 223 | "type": "n8n-nodes-base.stickyNote", 224 | "typeVersion": 1, 225 | "position": [ 226 | 60, 227 | 640 228 | ] 229 | }, 230 | { 231 | "parameters": { 232 | "operation": "sendChatAction", 233 | "chatId": "={{ $json.message.chat.id }}" 234 | }, 235 | "id": "811a12e8-b72b-488c-9b57-44aa4dfdf048", 236 | "name": "Send typing action [TELEGRAM] [1]", 237 | "type": "n8n-nodes-base.telegram", 238 | "typeVersion": 1, 239 | "position": [ 240 | 380, 241 | 640 242 | ], 243 | "credentials": { 244 | "telegramApi": { 245 | "id": "1", 246 | "name": "Telegram (WorkfloowsAI)" 247 | } 248 | } 249 | }, 250 | { 251 | "parameters": { 252 | "content": "## Send \"unauthorized\" message\nWhen unknown user (chat ID) wants to come into interaction with bot, workflow will send \"typing\" action, wait 3 seconds and respond: *\"I'm not authorized to speak with you\"*.", 253 | "height": 339.42690909090965, 254 | "width": 643.3545239632286 255 | }, 256 | "id": "b8a05571-ff64-45b8-a16b-cbfd06f5b8e0", 257 | "name": "Sticky Note9", 258 | "type": "n8n-nodes-base.stickyNote", 259 | "typeVersion": 1, 260 | "position": [ 261 | 320, 262 | 860 263 | ] 264 | }, 265 | { 266 | "parameters": { 267 | "content": "## Generate response\nThis sequence sends \"typing action\", gets answer from GPT and returns message to authorized user. Feel free to play with prompt, configuration etc.", 268 | "height": 339.42690909090965, 269 | "width": 643.3545239632286 270 | }, 271 | "id": "3d8eaff6-e9d1-45c7-ae24-917f6aa16290", 272 | "name": "Sticky Note11", 273 | "type": "n8n-nodes-base.stickyNote", 274 | "typeVersion": 1, 275 | "position": [ 276 | 320, 277 | 500 278 | ] 279 | }, 280 | { 281 | "parameters": { 282 | "operation": "sendChatAction", 283 | "chatId": "={{ $json.message.chat.id }}" 284 | }, 285 | "id": "74552b57-0e4e-45d8-ba5c-d5050b1f5e5e", 286 | "name": "Send typing action [TELEGRAM] [2]", 287 | "type": "n8n-nodes-base.telegram", 288 | "typeVersion": 1, 289 | "position": [ 290 | 380, 291 | 1000 292 | ], 293 | "credentials": { 294 | "telegramApi": { 295 | "id": "1", 296 | "name": "Telegram (WorkfloowsAI)" 297 | } 298 | } 299 | }, 300 | { 301 | "parameters": { 302 | "content": "## 🦜🔗 Add LangChain \n\n**This is just a basic workflow.** If you want to make your bot more powerful, consider installing [FlowiseAI](https://flowiseai.com/) (LangChain UI) on your server and connecting your bot via simple cURL (HTTP Request node). I cover example [in my YouTube video](https://www.youtube.com/watch?v=Gc2lW5BiGDQ).\n\nInstallation guides and other data about FlowiseAI can be found [here](https://github.com/FlowiseAI/Flowise).", 303 | "height": 258.16986559669937, 304 | "width": 345.7880926620822 305 | }, 306 | "id": "a09c623f-c5d6-466e-9065-625de611f4cd", 307 | "name": "Sticky Note", 308 | "type": "n8n-nodes-base.stickyNote", 309 | "typeVersion": 1, 310 | "position": [ 311 | -720, 312 | 220 313 | ] 314 | } 315 | ], 316 | "pinData": {}, 317 | "connections": { 318 | "Check chat ID": { 319 | "main": [ 320 | [ 321 | { 322 | "node": "Send typing action [TELEGRAM] [1]", 323 | "type": "main", 324 | "index": 0 325 | } 326 | ], 327 | [ 328 | { 329 | "node": "Send typing action [TELEGRAM] [2]", 330 | "type": "main", 331 | "index": 0 332 | } 333 | ] 334 | ] 335 | }, 336 | "Wait 3 seconds": { 337 | "main": [ 338 | [ 339 | { 340 | "node": "Send unauthorized info [TELEGRAM]", 341 | "type": "main", 342 | "index": 0 343 | } 344 | ] 345 | ] 346 | }, 347 | "Generate answer [OPENAI]": { 348 | "main": [ 349 | [ 350 | { 351 | "node": "Send response [TELEGRAM]", 352 | "type": "main", 353 | "index": 0 354 | } 355 | ] 356 | ] 357 | }, 358 | "Check if start": { 359 | "main": [ 360 | [ 361 | { 362 | "node": "No operation", 363 | "type": "main", 364 | "index": 0 365 | } 366 | ], 367 | [ 368 | { 369 | "node": "Check chat ID", 370 | "type": "main", 371 | "index": 0 372 | } 373 | ] 374 | ] 375 | }, 376 | "Telegram trigger": { 377 | "main": [ 378 | [ 379 | { 380 | "node": "Check if start", 381 | "type": "main", 382 | "index": 0 383 | } 384 | ] 385 | ] 386 | }, 387 | "Send typing action [TELEGRAM] [1]": { 388 | "main": [ 389 | [ 390 | { 391 | "node": "Generate answer [OPENAI]", 392 | "type": "main", 393 | "index": 0 394 | } 395 | ] 396 | ] 397 | }, 398 | "Send typing action [TELEGRAM] [2]": { 399 | "main": [ 400 | [ 401 | { 402 | "node": "Wait 3 seconds", 403 | "type": "main", 404 | "index": 0 405 | } 406 | ] 407 | ] 408 | } 409 | }, 410 | "active": true, 411 | "settings": {}, 412 | "versionId": "924f4094-f745-45d4-b306-5e28866759fa", 413 | "id": "1", 414 | "meta": { 415 | "instanceId": "482d8b7a90bbda02ea9b3ff2198024ecbcd2537233e23bbd6976d22fb56964f7" 416 | }, 417 | "tags": [] 418 | } -------------------------------------------------------------------------------- /telegram-memory-sessions-flowise-zep.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Memory sessions with FlowiseAI and Zep", 3 | "nodes": [ 4 | { 5 | "parameters": { 6 | "conditions": { 7 | "string": [ 8 | { 9 | "value1": "={{ $json.message.text }}", 10 | "value2": "/start" 11 | } 12 | ] 13 | } 14 | }, 15 | "id": "7e8b9a29-26f5-4d71-bc06-fe0c5039f297", 16 | "name": "Check if start", 17 | "type": "n8n-nodes-base.if", 18 | "typeVersion": 1, 19 | "position": [ 20 | -480, 21 | 1410 22 | ] 23 | }, 24 | { 25 | "parameters": { 26 | "chatId": "={{ $json.message.chat.id }}", 27 | "text": "Choose memory:\n\n/m1 - memory 1\n/m2 - memory 2\n/m3 - memory 3", 28 | "additionalFields": {} 29 | }, 30 | "id": "7b5f16b6-2a2a-4ecb-91d0-a4056b1beae1", 31 | "name": "Choose memory [TELEGRAM]", 32 | "type": "n8n-nodes-base.telegram", 33 | "typeVersion": 1, 34 | "position": [ 35 | -240, 36 | 1270 37 | ], 38 | "credentials": { 39 | "telegramApi": { 40 | "id": "na4U2hVORqwY6tGz", 41 | "name": "Telegram API" 42 | } 43 | } 44 | }, 45 | { 46 | "parameters": { 47 | "conditions": { 48 | "string": [ 49 | { 50 | "value1": "={{ $json.message.entities[0].type }}", 51 | "value2": "bot_command" 52 | } 53 | ] 54 | } 55 | }, 56 | "id": "87021758-37bd-4a00-87c9-02df118ed6bc", 57 | "name": "Check if command", 58 | "type": "n8n-nodes-base.if", 59 | "typeVersion": 1, 60 | "position": [ 61 | -240, 62 | 1530 63 | ] 64 | }, 65 | { 66 | "parameters": { 67 | "operation": "get", 68 | "propertyName": "currentMemory", 69 | "key": "={{ $json.message.chat.id }}", 70 | "options": {} 71 | }, 72 | "id": "bf5eb645-482c-4f8b-845a-636e507aa749", 73 | "name": "Get current memory [REDIS]", 74 | "type": "n8n-nodes-base.redis", 75 | "typeVersion": 1, 76 | "position": [ 77 | -20, 78 | 1990 79 | ], 80 | "alwaysOutputData": false, 81 | "credentials": { 82 | "redis": { 83 | "id": "Ab7RZterPo0pMSL3", 84 | "name": "Redis" 85 | } 86 | } 87 | }, 88 | { 89 | "parameters": { 90 | "updates": [ 91 | "message" 92 | ], 93 | "additionalFields": {} 94 | }, 95 | "id": "8c9bd217-2279-4ed9-a996-629e4d2bcb65", 96 | "name": "Telegram trigger", 97 | "type": "n8n-nodes-base.telegramTrigger", 98 | "typeVersion": 1, 99 | "position": [ 100 | -680, 101 | 1410 102 | ], 103 | "webhookId": "e51e1f63-a0d4-4cfe-9577-2328ea808a22", 104 | "credentials": { 105 | "telegramApi": { 106 | "id": "na4U2hVORqwY6tGz", 107 | "name": "Telegram API" 108 | } 109 | } 110 | }, 111 | { 112 | "parameters": { 113 | "operation": "get", 114 | "propertyName": "currentMemory", 115 | "key": "={{ $('Telegram trigger').item.json.message.chat.id }}", 116 | "options": {} 117 | }, 118 | "id": "3237b33b-0ba7-400a-b92c-b62d550a5f9d", 119 | "name": "Check current memory [REDIS]", 120 | "type": "n8n-nodes-base.redis", 121 | "typeVersion": 1, 122 | "position": [ 123 | 520, 124 | 580 125 | ], 126 | "credentials": { 127 | "redis": { 128 | "id": "Ab7RZterPo0pMSL3", 129 | "name": "Redis" 130 | } 131 | } 132 | }, 133 | { 134 | "parameters": { 135 | "chatId": "={{ $('Telegram trigger').item.json[\"message\"][\"chat\"][\"id\"] }}", 136 | "text": "=Current memory is {{ $json.currentMemory }}.", 137 | "additionalFields": {} 138 | }, 139 | "id": "b7f85152-2aeb-4efb-8f5f-cf7b96e27228", 140 | "name": "Send memory info [TELEGRAM]", 141 | "type": "n8n-nodes-base.telegram", 142 | "typeVersion": 1, 143 | "position": [ 144 | 720, 145 | 580 146 | ], 147 | "credentials": { 148 | "telegramApi": { 149 | "id": "na4U2hVORqwY6tGz", 150 | "name": "Telegram API" 151 | } 152 | } 153 | }, 154 | { 155 | "parameters": { 156 | "chatId": "={{ $('Telegram trigger').item.json[\"message\"][\"chat\"][\"id\"] }}", 157 | "text": "Command not recognized.", 158 | "additionalFields": {} 159 | }, 160 | "id": "ec5d8960-1362-48fb-9c79-af9ce3d5d41a", 161 | "name": "Command not recognized [TELEGRAM]", 162 | "type": "n8n-nodes-base.telegram", 163 | "typeVersion": 1, 164 | "position": [ 165 | 520, 166 | 1470 167 | ], 168 | "credentials": { 169 | "telegramApi": { 170 | "id": "na4U2hVORqwY6tGz", 171 | "name": "Telegram API" 172 | } 173 | } 174 | }, 175 | { 176 | "parameters": { 177 | "conditions": { 178 | "string": [ 179 | { 180 | "value1": "={{ $('Telegram trigger').item.json.message.text }}", 181 | "value2": "/currentmemory" 182 | } 183 | ] 184 | } 185 | }, 186 | "id": "302b36be-16a6-434e-a237-b57185955726", 187 | "name": "Check if current memory [TELEGRAM]", 188 | "type": "n8n-nodes-base.if", 189 | "typeVersion": 1, 190 | "position": [ 191 | 0, 192 | 1390 193 | ] 194 | }, 195 | { 196 | "parameters": { 197 | "conditions": { 198 | "string": [ 199 | { 200 | "value1": "={{ $json.currentMemory }}", 201 | "operation": "isEmpty" 202 | } 203 | ] 204 | } 205 | }, 206 | "id": "9a10a49f-78f5-410a-a6fe-f3809cd94303", 207 | "name": "Check if record [REDIS]", 208 | "type": "n8n-nodes-base.if", 209 | "typeVersion": 1, 210 | "position": [ 211 | 180, 212 | 1990 213 | ] 214 | }, 215 | { 216 | "parameters": { 217 | "chatId": "={{ $('Telegram trigger').item.json[\"message\"][\"chat\"][\"id\"] }}", 218 | "text": "The memory not set. Enter command /start to choose memory.", 219 | "additionalFields": {} 220 | }, 221 | "id": "c029102d-b5c0-482c-9943-ed43086cfa2f", 222 | "name": "Inform about empty record [TELEGRAM]", 223 | "type": "n8n-nodes-base.telegram", 224 | "typeVersion": 1, 225 | "position": [ 226 | 440, 227 | 1840 228 | ], 229 | "credentials": { 230 | "telegramApi": { 231 | "id": "na4U2hVORqwY6tGz", 232 | "name": "Telegram API" 233 | } 234 | } 235 | }, 236 | { 237 | "parameters": { 238 | "method": "POST", 239 | "url": "[URL_TO_YOUR_FLOWISE_CHATFLOW]", 240 | "sendBody": true, 241 | "specifyBody": "json", 242 | "jsonBody": "={\"question\": \"{{ $('Telegram trigger').item.json[\"message\"][\"text\"] }}\", \"overrideConfig\": {\"sessionId\": \"{{ $('Telegram trigger').item.json[\"message\"][\"chat\"][\"id\"] }}mslot1\" }}", 243 | "options": { 244 | "response": { 245 | "response": { 246 | "responseFormat": "text" 247 | } 248 | } 249 | } 250 | }, 251 | "id": "0f04a0f5-b2ad-47a5-a65d-a678a33f7878", 252 | "name": "Use M1 [FLOWISE/ZEP]", 253 | "type": "n8n-nodes-base.httpRequest", 254 | "typeVersion": 4.1, 255 | "position": [ 256 | 720, 257 | 2210 258 | ] 259 | }, 260 | { 261 | "parameters": { 262 | "method": "POST", 263 | "url": "[URL_TO_YOUR_FLOWISE_CHATFLOW]", 264 | "sendBody": true, 265 | "specifyBody": "json", 266 | "jsonBody": "={\"question\": \"{{ $('Telegram trigger').item.json[\"message\"][\"text\"] }}\", \"overrideConfig\": {\"sessionId\": \"{{ $('Telegram trigger').item.json[\"message\"][\"chat\"][\"id\"] }}mslot2\" }}", 267 | "options": { 268 | "response": { 269 | "response": { 270 | "responseFormat": "text" 271 | } 272 | } 273 | } 274 | }, 275 | "id": "f61058d1-414c-40cc-94d9-d75b5783f5c1", 276 | "name": "Use M2 [FLOWISE/ZEP]", 277 | "type": "n8n-nodes-base.httpRequest", 278 | "typeVersion": 4.1, 279 | "position": [ 280 | 720, 281 | 2390 282 | ] 283 | }, 284 | { 285 | "parameters": { 286 | "method": "POST", 287 | "url": "[URL_TO_YOUR_FLOWISE_CHATFLOW]", 288 | "sendBody": true, 289 | "specifyBody": "json", 290 | "jsonBody": "={\"question\": \"{{ $('Telegram trigger').item.json[\"message\"][\"text\"] }}\", \"overrideConfig\": {\"sessionId\": \"{{ $('Telegram trigger').item.json[\"message\"][\"chat\"][\"id\"] }}mslot3\" }}", 291 | "options": { 292 | "response": { 293 | "response": { 294 | "responseFormat": "text" 295 | } 296 | } 297 | } 298 | }, 299 | "id": "f07368c7-0955-4649-b03b-a696beb99bcc", 300 | "name": "Use M3 [FLOWISE/ZEP]", 301 | "type": "n8n-nodes-base.httpRequest", 302 | "typeVersion": 4.1, 303 | "position": [ 304 | 720, 305 | 2570 306 | ] 307 | }, 308 | { 309 | "parameters": { 310 | "chatId": "={{ $('Telegram trigger').item.json[\"message\"][\"chat\"][\"id\"] }}", 311 | "text": "={{ $json.data }}", 312 | "additionalFields": {} 313 | }, 314 | "id": "b59fc99e-faaf-44f1-bab1-452eada7a4f9", 315 | "name": "Respond M1 [TELEGRAM]", 316 | "type": "n8n-nodes-base.telegram", 317 | "typeVersion": 1, 318 | "position": [ 319 | 900, 320 | 2210 321 | ], 322 | "credentials": { 323 | "telegramApi": { 324 | "id": "na4U2hVORqwY6tGz", 325 | "name": "Telegram API" 326 | } 327 | } 328 | }, 329 | { 330 | "parameters": { 331 | "chatId": "={{ $('Telegram trigger').item.json[\"message\"][\"chat\"][\"id\"] }}", 332 | "text": "={{ $json.data }}", 333 | "additionalFields": {} 334 | }, 335 | "id": "4a3d2425-6136-4174-9184-860573dc4c6d", 336 | "name": "Respond M2 [TELEGRAM]", 337 | "type": "n8n-nodes-base.telegram", 338 | "typeVersion": 1, 339 | "position": [ 340 | 900, 341 | 2390 342 | ], 343 | "credentials": { 344 | "telegramApi": { 345 | "id": "na4U2hVORqwY6tGz", 346 | "name": "Telegram API" 347 | } 348 | } 349 | }, 350 | { 351 | "parameters": { 352 | "chatId": "={{ $('Telegram trigger').item.json[\"message\"][\"chat\"][\"id\"] }}", 353 | "text": "={{ $json.data }}", 354 | "additionalFields": {} 355 | }, 356 | "id": "16a70a19-66c1-4fe0-a153-4ec6c322ab58", 357 | "name": "Respond M3 [TELEGRAM]", 358 | "type": "n8n-nodes-base.telegram", 359 | "typeVersion": 1, 360 | "position": [ 361 | 900, 362 | 2570 363 | ], 364 | "credentials": { 365 | "telegramApi": { 366 | "id": "na4U2hVORqwY6tGz", 367 | "name": "Telegram API" 368 | } 369 | } 370 | }, 371 | { 372 | "parameters": { 373 | "chatId": "={{ $('Telegram trigger').item.json[\"message\"][\"chat\"][\"id\"] }}", 374 | "text": "An error occured. Please contact bot admin.", 375 | "additionalFields": {} 376 | }, 377 | "id": "ce10e084-3155-43a8-9304-a212dade6f3d", 378 | "name": "Send error [TELEGRAM]", 379 | "type": "n8n-nodes-base.telegram", 380 | "typeVersion": 1, 381 | "position": [ 382 | 720, 383 | 2790 384 | ], 385 | "credentials": { 386 | "telegramApi": { 387 | "id": "na4U2hVORqwY6tGz", 388 | "name": "Telegram API" 389 | } 390 | } 391 | }, 392 | { 393 | "parameters": { 394 | "operation": "sendChatAction", 395 | "chatId": "={{ $json.message.chat.id }}" 396 | }, 397 | "id": "e60167e5-b655-4406-ab53-6535efec1f2b", 398 | "name": "Send typing action [TELEGRAM]", 399 | "type": "n8n-nodes-base.telegram", 400 | "typeVersion": 1, 401 | "position": [ 402 | -480, 403 | 1610 404 | ], 405 | "credentials": { 406 | "telegramApi": { 407 | "id": "na4U2hVORqwY6tGz", 408 | "name": "Telegram API" 409 | } 410 | } 411 | }, 412 | { 413 | "parameters": { 414 | "content": "## ⚠️ Note\n\n1. Complete video guide for this workflow is available [on my YouTube](https://www.youtube.com/watch?v=Dfbpt_i4-68). \n2. Remember to add your credentials and configure nodes (covered in the video guide).\n3. If you like this workflow, please subscribe to [my YouTube channel](https://www.youtube.com/@workfloows) and/or [my newsletter](https://workfloows.com/). I invite you also to buy my product [on Gumroad](https://workfloows.gumroad.com/).\n\n**Thank you for your support!**", 415 | "height": 267.3518783538228, 416 | "width": 382.8182353336517 417 | }, 418 | "id": "f27fd7de-8e09-4daf-94ac-7096916e2fc8", 419 | "name": "Sticky Note5", 420 | "type": "n8n-nodes-base.stickyNote", 421 | "typeVersion": 1, 422 | "position": [ 423 | -720, 424 | 990 425 | ] 426 | }, 427 | { 428 | "parameters": { 429 | "content": "## 🦜🔗 Flowise (LangChain)\n\n**This workflow requires installing [FlowiseAI](https://flowiseai.com/) and [Zep](https://www.getzep.com/) on your server.** \n\nInstallation guides and other data about FlowiseAI can be found [here](https://github.com/FlowiseAI/Flowise). Guides for installation of Zep are available in [official documentation](https://docs.getzep.com/deployment/).", 430 | "height": 266.6075757063218, 431 | "width": 345.7880926620822 432 | }, 433 | "id": "de92ea67-ddcc-44dd-9523-e494ef0505f6", 434 | "name": "Sticky Note", 435 | "type": "n8n-nodes-base.stickyNote", 436 | "typeVersion": 1, 437 | "position": [ 438 | -1080, 439 | 990 440 | ] 441 | }, 442 | { 443 | "parameters": { 444 | "content": "## Trigger\nRemember to add credentials of your Telegram bot.", 445 | "height": 297.78936091241343, 446 | "width": 182.4715262478496 447 | }, 448 | "id": "36728ff0-9c7d-42ae-be6f-60bdc976f0dc", 449 | "name": "Sticky Note6", 450 | "type": "n8n-nodes-base.stickyNote", 451 | "typeVersion": 1, 452 | "position": [ 453 | -720, 454 | 1271.7283118148598 455 | ] 456 | }, 457 | { 458 | "parameters": { 459 | "content": "## Check if start\nThis node will check if user sends an initial ```/start``` message.", 460 | "height": 299.0166642010856, 461 | "width": 182.4715262478496 462 | }, 463 | "id": "85e81263-3408-4c66-bf54-216c67387fe4", 464 | "name": "Sticky Note7", 465 | "type": "n8n-nodes-base.stickyNote", 466 | "typeVersion": 1, 467 | "position": [ 468 | -520, 469 | 1270.501008526188 470 | ] 471 | }, 472 | { 473 | "parameters": { 474 | "content": "## Initial response\nIn response to ```/start``` message, this node sends list of available memory sessions (M1, M2, M3 etc.).", 475 | "height": 400.882837160891, 476 | "width": 182.4715262478496 477 | }, 478 | "id": "cdfdf99e-1d0b-4074-afa9-35528f1d66a0", 479 | "name": "Sticky Note9", 480 | "type": "n8n-nodes-base.stickyNote", 481 | "typeVersion": 1, 482 | "position": [ 483 | -280, 484 | 1068.1338270401945 485 | ] 486 | }, 487 | { 488 | "parameters": { 489 | "content": "## Check command\nNode checks if user sends command ```/currentmemory```.", 490 | "height": 345.2706568929251, 491 | "width": 182.4715262478496 492 | }, 493 | "id": "76582f57-e4ef-4a85-92f5-c007834c4deb", 494 | "name": "Sticky Note10", 495 | "type": "n8n-nodes-base.stickyNote", 496 | "typeVersion": 1, 497 | "position": [ 498 | -40, 499 | 1225.6121802679659 500 | ] 501 | }, 502 | { 503 | "parameters": { 504 | "content": "## Memory session info\nSequence gets current session from Redis database (```/m1```, ```/m2``` or ```/m3```) and returns information to the user.", 505 | "height": 295.4114607906109, 506 | "width": 445.19113647927463 507 | }, 508 | "id": "c4016f12-86af-4b99-a4ac-648f3e9a5663", 509 | "name": "Sticky Note11", 510 | "type": "n8n-nodes-base.stickyNote", 511 | "typeVersion": 1, 512 | "position": [ 513 | 460, 514 | 460 515 | ] 516 | }, 517 | { 518 | "parameters": { 519 | "content": "## Set memory session\nSequence sets/updates current session in Redis database according to input of the user (```/m1```, ```/m2``` or ```/m3```).", 520 | "height": 665.5201087808667, 521 | "width": 445.19113647927463 522 | }, 523 | "id": "34ae71dd-0cd7-450f-b289-0c68ff1f1745", 524 | "name": "Sticky Note12", 525 | "type": "n8n-nodes-base.stickyNote", 526 | "typeVersion": 1, 527 | "position": [ 528 | 460, 529 | 770 530 | ] 531 | }, 532 | { 533 | "parameters": { 534 | "operation": "set", 535 | "key": "={{ $('Telegram trigger').item.json[\"message\"][\"chat\"][\"id\"] }}", 536 | "value": "/m1" 537 | }, 538 | "id": "8555292c-eb7c-4c40-9992-e04297993943", 539 | "name": "Set memory session [REDIS] [1]", 540 | "type": "n8n-nodes-base.redis", 541 | "typeVersion": 1, 542 | "position": [ 543 | 520, 544 | 890 545 | ], 546 | "credentials": { 547 | "redis": { 548 | "id": "Ab7RZterPo0pMSL3", 549 | "name": "Redis" 550 | } 551 | } 552 | }, 553 | { 554 | "parameters": { 555 | "operation": "set", 556 | "key": "={{ $('Telegram trigger').item.json[\"message\"][\"chat\"][\"id\"] }}", 557 | "value": "/m2" 558 | }, 559 | "id": "70a2042a-5a1d-4b99-ae46-efa93d9698ec", 560 | "name": "Set memory session [REDIS] [2]", 561 | "type": "n8n-nodes-base.redis", 562 | "typeVersion": 1, 563 | "position": [ 564 | 520, 565 | 1070 566 | ], 567 | "credentials": { 568 | "redis": { 569 | "id": "Ab7RZterPo0pMSL3", 570 | "name": "Redis" 571 | } 572 | } 573 | }, 574 | { 575 | "parameters": { 576 | "operation": "set", 577 | "key": "={{ $('Telegram trigger').item.json[\"message\"][\"chat\"][\"id\"] }}", 578 | "value": "/m3" 579 | }, 580 | "id": "f1f66620-2ab0-4100-9abc-c773be169489", 581 | "name": "Set memory session [REDIS] [3]", 582 | "type": "n8n-nodes-base.redis", 583 | "typeVersion": 1, 584 | "position": [ 585 | 520, 586 | 1250 587 | ], 588 | "credentials": { 589 | "redis": { 590 | "id": "Ab7RZterPo0pMSL3", 591 | "name": "Redis" 592 | } 593 | } 594 | }, 595 | { 596 | "parameters": { 597 | "dataType": "string", 598 | "value1": "={{ $json.message.text }}", 599 | "rules": { 600 | "rules": [ 601 | { 602 | "value2": "/m1" 603 | }, 604 | { 605 | "value2": "/m2", 606 | "output": 1 607 | }, 608 | { 609 | "value2": "/m3", 610 | "output": 2 611 | } 612 | ] 613 | }, 614 | "fallbackOutput": 3 615 | }, 616 | "id": "908c0220-0ea6-44c3-a72d-c59d346deb47", 617 | "name": "Switch memory sessions [TELEGRAM] [1]", 618 | "type": "n8n-nodes-base.switch", 619 | "typeVersion": 1, 620 | "position": [ 621 | 240, 622 | 1530 623 | ] 624 | }, 625 | { 626 | "parameters": { 627 | "dataType": "string", 628 | "value1": "={{ $json.currentMemory }}", 629 | "rules": { 630 | "rules": [ 631 | { 632 | "value2": "/m1" 633 | }, 634 | { 635 | "value2": "/m2", 636 | "output": 1 637 | }, 638 | { 639 | "value2": "/m3", 640 | "output": 2 641 | } 642 | ] 643 | }, 644 | "fallbackOutput": 3 645 | }, 646 | "id": "33cdb2aa-092d-4b0e-bf90-fe0220246b63", 647 | "name": "Switch memory sessions [TELEGRAM] [2]", 648 | "type": "n8n-nodes-base.switch", 649 | "typeVersion": 1, 650 | "position": [ 651 | 440, 652 | 2150 653 | ] 654 | }, 655 | { 656 | "parameters": { 657 | "chatId": "={{ $('Telegram trigger').item.json[\"message\"][\"chat\"][\"id\"] }}", 658 | "text": "The memory has been changed to M1.", 659 | "additionalFields": {} 660 | }, 661 | "id": "3028983e-f065-4394-b86a-22df14ed9239", 662 | "name": "Session confirmation [TELEGRAM] [1]", 663 | "type": "n8n-nodes-base.telegram", 664 | "typeVersion": 1, 665 | "position": [ 666 | 720, 667 | 890 668 | ], 669 | "credentials": { 670 | "telegramApi": { 671 | "id": "na4U2hVORqwY6tGz", 672 | "name": "Telegram API" 673 | } 674 | } 675 | }, 676 | { 677 | "parameters": { 678 | "chatId": "={{ $('Telegram trigger').item.json[\"message\"][\"chat\"][\"id\"] }}", 679 | "text": "The memory has been changed to M2.", 680 | "additionalFields": {} 681 | }, 682 | "id": "204b8b3c-112a-46db-a451-dd96d3674d94", 683 | "name": "Session confirmation [TELEGRAM] [2]", 684 | "type": "n8n-nodes-base.telegram", 685 | "typeVersion": 1, 686 | "position": [ 687 | 720, 688 | 1070 689 | ], 690 | "credentials": { 691 | "telegramApi": { 692 | "id": "na4U2hVORqwY6tGz", 693 | "name": "Telegram API" 694 | } 695 | } 696 | }, 697 | { 698 | "parameters": { 699 | "chatId": "={{ $('Telegram trigger').item.json[\"message\"][\"chat\"][\"id\"] }}", 700 | "text": "The memory has been changed to M3.", 701 | "additionalFields": {} 702 | }, 703 | "id": "dd9c8690-f9ab-4663-b6a4-9c20be61a491", 704 | "name": "Session confirmation [TELEGRAM] [3]", 705 | "type": "n8n-nodes-base.telegram", 706 | "typeVersion": 1, 707 | "position": [ 708 | 720, 709 | 1250 710 | ], 711 | "credentials": { 712 | "telegramApi": { 713 | "id": "na4U2hVORqwY6tGz", 714 | "name": "Telegram API" 715 | } 716 | } 717 | }, 718 | { 719 | "parameters": { 720 | "content": "## Get memory session\nThe sequence gets memory session connected with chat ID from Redis database and checks if it is empty.", 721 | "height": 301.7070028125353, 722 | "width": 405.1821718020519 723 | }, 724 | "id": "6c959979-1ffe-4d06-8599-10b94830316a", 725 | "name": "Sticky Note13", 726 | "type": "n8n-nodes-base.stickyNote", 727 | "typeVersion": 1, 728 | "position": [ 729 | -60, 730 | 1869.1758343483557 731 | ] 732 | }, 733 | { 734 | "parameters": { 735 | "content": "## Conversation\nAccording to current memory session (```/m1```, ```/m2``` or ```/m3```) the specific call to FlowiseAI is triggered. **Remember to replace placeholder ```[URL_TO_YOUR_FLOWISE_CHATFLOW]``` with your actual Flowise chatflow URL.** Feel free to modify format of ```sessionId``` parameter (I used combination of Telegram chat ID and suffix ```mslot1```, ```mslot2```, ```mslot3``` - your ID can look totally different depending on the use case).", 736 | "height": 756.3636654191122, 737 | "width": 445.19113647927463 738 | }, 739 | "id": "28bdfe03-c7b3-46ac-9cf8-5192b4db907e", 740 | "name": "Sticky Note14", 741 | "type": "n8n-nodes-base.stickyNote", 742 | "typeVersion": 1, 743 | "position": [ 744 | 660, 745 | 2001.7620462850182 746 | ] 747 | } 748 | ], 749 | "pinData": {}, 750 | "connections": { 751 | "Check if start": { 752 | "main": [ 753 | [ 754 | { 755 | "node": "Choose memory [TELEGRAM]", 756 | "type": "main", 757 | "index": 0 758 | } 759 | ], 760 | [ 761 | { 762 | "node": "Check if command", 763 | "type": "main", 764 | "index": 0 765 | } 766 | ] 767 | ] 768 | }, 769 | "Check if command": { 770 | "main": [ 771 | [ 772 | { 773 | "node": "Check if current memory [TELEGRAM]", 774 | "type": "main", 775 | "index": 0 776 | } 777 | ], 778 | [ 779 | { 780 | "node": "Get current memory [REDIS]", 781 | "type": "main", 782 | "index": 0 783 | } 784 | ] 785 | ] 786 | }, 787 | "Get current memory [REDIS]": { 788 | "main": [ 789 | [ 790 | { 791 | "node": "Check if record [REDIS]", 792 | "type": "main", 793 | "index": 0 794 | } 795 | ] 796 | ] 797 | }, 798 | "Telegram trigger": { 799 | "main": [ 800 | [ 801 | { 802 | "node": "Check if start", 803 | "type": "main", 804 | "index": 0 805 | }, 806 | { 807 | "node": "Send typing action [TELEGRAM]", 808 | "type": "main", 809 | "index": 0 810 | } 811 | ] 812 | ] 813 | }, 814 | "Check current memory [REDIS]": { 815 | "main": [ 816 | [ 817 | { 818 | "node": "Send memory info [TELEGRAM]", 819 | "type": "main", 820 | "index": 0 821 | } 822 | ] 823 | ] 824 | }, 825 | "Check if current memory [TELEGRAM]": { 826 | "main": [ 827 | [ 828 | { 829 | "node": "Check current memory [REDIS]", 830 | "type": "main", 831 | "index": 0 832 | } 833 | ], 834 | [ 835 | { 836 | "node": "Switch memory sessions [TELEGRAM] [1]", 837 | "type": "main", 838 | "index": 0 839 | } 840 | ] 841 | ] 842 | }, 843 | "Check if record [REDIS]": { 844 | "main": [ 845 | [ 846 | { 847 | "node": "Inform about empty record [TELEGRAM]", 848 | "type": "main", 849 | "index": 0 850 | } 851 | ], 852 | [ 853 | { 854 | "node": "Switch memory sessions [TELEGRAM] [2]", 855 | "type": "main", 856 | "index": 0 857 | } 858 | ] 859 | ] 860 | }, 861 | "Use M1 [FLOWISE/ZEP]": { 862 | "main": [ 863 | [ 864 | { 865 | "node": "Respond M1 [TELEGRAM]", 866 | "type": "main", 867 | "index": 0 868 | } 869 | ] 870 | ] 871 | }, 872 | "Use M2 [FLOWISE/ZEP]": { 873 | "main": [ 874 | [ 875 | { 876 | "node": "Respond M2 [TELEGRAM]", 877 | "type": "main", 878 | "index": 0 879 | } 880 | ] 881 | ] 882 | }, 883 | "Use M3 [FLOWISE/ZEP]": { 884 | "main": [ 885 | [ 886 | { 887 | "node": "Respond M3 [TELEGRAM]", 888 | "type": "main", 889 | "index": 0 890 | } 891 | ] 892 | ] 893 | }, 894 | "Set memory session [REDIS] [1]": { 895 | "main": [ 896 | [ 897 | { 898 | "node": "Session confirmation [TELEGRAM] [1]", 899 | "type": "main", 900 | "index": 0 901 | } 902 | ] 903 | ] 904 | }, 905 | "Set memory session [REDIS] [2]": { 906 | "main": [ 907 | [ 908 | { 909 | "node": "Session confirmation [TELEGRAM] [2]", 910 | "type": "main", 911 | "index": 0 912 | } 913 | ] 914 | ] 915 | }, 916 | "Set memory session [REDIS] [3]": { 917 | "main": [ 918 | [ 919 | { 920 | "node": "Session confirmation [TELEGRAM] [3]", 921 | "type": "main", 922 | "index": 0 923 | } 924 | ] 925 | ] 926 | }, 927 | "Switch memory sessions [TELEGRAM] [1]": { 928 | "main": [ 929 | [ 930 | { 931 | "node": "Set memory session [REDIS] [1]", 932 | "type": "main", 933 | "index": 0 934 | } 935 | ], 936 | [ 937 | { 938 | "node": "Set memory session [REDIS] [2]", 939 | "type": "main", 940 | "index": 0 941 | } 942 | ], 943 | [ 944 | { 945 | "node": "Set memory session [REDIS] [3]", 946 | "type": "main", 947 | "index": 0 948 | } 949 | ], 950 | [ 951 | { 952 | "node": "Command not recognized [TELEGRAM]", 953 | "type": "main", 954 | "index": 0 955 | } 956 | ] 957 | ] 958 | }, 959 | "Switch memory sessions [TELEGRAM] [2]": { 960 | "main": [ 961 | [ 962 | { 963 | "node": "Use M1 [FLOWISE/ZEP]", 964 | "type": "main", 965 | "index": 0 966 | } 967 | ], 968 | [ 969 | { 970 | "node": "Use M2 [FLOWISE/ZEP]", 971 | "type": "main", 972 | "index": 0 973 | } 974 | ], 975 | [ 976 | { 977 | "node": "Use M3 [FLOWISE/ZEP]", 978 | "type": "main", 979 | "index": 0 980 | } 981 | ], 982 | [ 983 | { 984 | "node": "Send error [TELEGRAM]", 985 | "type": "main", 986 | "index": 0 987 | } 988 | ] 989 | ] 990 | } 991 | }, 992 | "active": false, 993 | "settings": {}, 994 | "versionId": "f0179d81-5cd9-4e4a-8a2b-2db48763fda8", 995 | "id": "fL4qcDqyNoNUkmVY", 996 | "meta": { 997 | "instanceId": "b21b670be57242c74bfdb80a938df3a351d045a7fb7c8d18ae5504d2a33209d9" 998 | }, 999 | "tags": [] 1000 | } --------------------------------------------------------------------------------