Prompt: Create an n8n automation that handles general automation

Response:
# Workflow Architecture

**Purpose**: General Automation

**Key Components**:
- Total Nodes: 19
- Node Types: n8n-nodes-base.splitOut, n8n-nodes-base.set, @n8n/n8n-nodes-langchain.memoryBufferWindow, @n8n/n8n-nodes-langchain.openAi, n8n-nodes-base.stickyNote, n8n-nodes-base.aggregate, n8n-nodes-base.httpRequest, @n8n/n8n-nodes-langchain.chatTrigger, n8n-nodes-base.code, n8n-nodes-base.markdown

**Logic Flow**:
1. **Trigger**: @n8n/n8n-nodes-langchain.chatTrigger - Initiates the workflow

## Complete Workflow JSON

```json
{
  "id": "5NAbfX550LJsfz6f",
  "meta": {
    "instanceId": "00493e38fecfc163cb182114bc2fab90114038eb9aad665a7a752d076920d3d5",
    "templateCredsSetupCompleted": true
  },
  "name": "Make OpenAI Citation for File Retrieval RAG",
  "tags": [
    {
      "id": "urxRtGxxLObZWPvX",
      "name": "sample",
      "createdAt": "2024-09-13T02:43:13.014Z",
      "updatedAt": "2024-09-13T02:43:13.014Z"
    },
    {
      "id": "nMXS3c9l1WqDwWF5",
      "name": "assist",
      "createdAt": "2024-12-23T16:09:38.737Z",
      "updatedAt": "2024-12-23T16:09:38.737Z"
    }
  ],
  "nodes": [
    {
      "id": "b9033511-3421-467a-9bfa-73af01b99c4f",
      "name": "Aggregate",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        740,
        120
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "a61dd9d3-4faa-4878-a6f3-ba8277279002",
      "name": "Window Buffer Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        980,
        -320
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "2daabca5-37ec-4cad-9157-29926367e1a7",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        220,
        320
      ],
      "parameters": {
        "color": 3,
        "width": 840,
        "height": 80,
        "content": "## Within N8N, there will be a chat button to test"
      },
      "typeVersion": 1
    },
    {
      "id": "bf4485b1-cd94-41c8-a183-bf1b785f2761",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -440,
        -520
      ],
      "parameters": {
        "color": 5,
        "width": 500,
        "height": 720,
        "content": "## Make OpenAI Citation for File Retrieval RAG\n\n## Use case\n\nIn this example, we will ensure that all texts from the OpenAI assistant search for citations and sources in the vector store files. We can also format the output for Markdown or HTML tags.\n\nThis is necessary because the assistant sometimes generates strange characters, and we can also use dynamic references such as citations 1, 2, 3, for example.\n\n## What this workflow does\n\nIn this workflow, we will use an OpenAI assistant created within their interface, equipped with a vector store containing some files for file retrieval.\n\nThe assistant will perform the file search within the OpenAI infrastructure and will return the content with citations.\n\n- We will make an HTTP request to retrieve all the details we need to format the text output.\n\n## Setup\n\nInsert an OpenAI Key\n\n## How to adjust it to your needs\n\nAt the end of the workflow, we have a block of code that will format the output, and there we can add Markdown tags to create links. Optionally, we can transform the Markdown formatting into HTML.\n\n\nby Davi Saranszky Mesquita\nhttps://www.linkedin.com/in/mesquitadavi/"
      },
      "typeVersion": 1
    },
    {
      "id": "539a4e40-9745-4a26-aba8-2cc2b0dd6364",
      "name": "Create a simple Trigger to have the Chat button within N8N",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "notes": "https://www.npmjs.com/package/@n8n/chat",
      "position": [
        260,
        -520
      ],
      "webhookId": "8ccaa299-6f99-427b-9356-e783893a3d0c",
      "parameters": {
        "options": {}
      },
      "notesInFlow": true,
      "typeVersion": 1.1
    },
    {
      "id": "aa5b2951-df32-43ac-9939-83b02d818e73",
      "name": "OpenAI Assistant with Vector Store",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        580,
        -520
      ],
      "parameters": {
        "options": {
          "preserveOriginalTools": false
        },
        "resource": "assistant",
        "assistantId": {
          "__rl": true,
          "mode": "list",
          "value": "asst_QAfdobVCVCMJz8LmaEC7nlId",
          "cachedResultName": "Teste"
        }
      },
      "credentials": {
        "openAiApi": {
          "id": "UfNrqPCRlD8FD9mk",
          "name": "OpenAi Lourival"
        }
      },
      "typeVersion": 1.7
    },
    {
      "id": "1817b673-6cb3-49aa-9f38-a5876eb0e6fa",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        560,
        -680
      ],
      "parameters": {
        "width": 300,
        "content": "## Setup\n\n- Configure OpenAI Key\n\n### In this step, we will use an assistant created within the OpenAI platform that contains a vector store a.k.a file retrieval"
      },
      "typeVersion": 1
    },
    {
      "id": "16429226-e850-4698-b419-fd9805a03fb7",
      "name": "Get ALL Thread Content",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1260,
        -520
      ],
      "parameters": {
        "url": "=https://api.openai.com/v1/threads/{{ $json.threadId }}/messages",
        "options": {},
        "sendHeaders": true,
        "authentication": "predefinedCredentialType",
        "headerParameters": {
          "parameters": [
            {
              "name": "OpenAI-Beta",
              "value": "assistants=v2"
            }
          ]
        },
        "nodeCredentialType": "openAiApi"
      },
      "credentials": {
        "openAiApi": {
          "id": "UfNrqPCRlD8FD9mk",
          "name": "OpenAi Lourival"
        }
      },
      "typeVersion": 4.2,
      "alwaysOutputData": true
    },
    {
      "id": "e8c88b08-5be2-4f7e-8b17-8cf804b3fe9f",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1160,
        -620
      ],
      "parameters": {
        "content": "### Retrieving all thread content is necessary because the OpenAI tool does not retrieve all citations upon request."
      },
      "typeVersion": 1
    },
    {
      "id": "0f51e09f-2782-4e2d-b797-d4d58fcabdaf",
      "name": "Split all message iterations from a thread",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        220,
        -300
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "data"
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "4d569993-1ce3-4b32-beaf-382feac25da9",
      "name": "Split all content from a single message",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        460,
        -300
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "content"
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "999e1c2b-1927-4483-aac1-6e8903f7ed25",
      "name": "Split all citations from a single message",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        700,
        -300
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "text.annotations"
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "98af62f5-adb0-4e07-a146-fc2f13b851ce",
      "name": "Retrieve file name from a file ID",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        220,
        120
      ],
      "parameters": {
        "url": "=https://api.openai.com/v1/files/{{ $json.file_citation.file_id }}",
        "options": {},
        "sendQuery": true,
        "authentication": "predefinedCredentialType",
        "queryParameters": {
          "parameters": [
            {
              "name": "limit",
              "value": "1"
            }
          ]
        },
        "nodeCredentialType": "openAiApi"
      },
      "credentials": {
        "openAiApi": {
          "id": "UfNrqPCRlD8FD9mk",
          "name": "OpenAi Lourival"
        }
      },
      "typeVersion": 4.2,
      "alwaysOutputData": true
    },
    {
      "id": "b11f0d3d-bdc4-4845-b14b-d0b0de214f01",
      "name": "Regularize output",
      "type": "n8n-nodes-base.set",
      "position": [
        480,
        120
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "2dcaafee-5037-4a97-942a-bcdd02bc2ad9",
              "name": "id",
              "type": "string",
              "value": "={{ $json.id }}"
            },
            {
              "id": "b63f967d-ceea-4aa8-98b9-91f5ab21bfe8",
              "name": "filename",
              "type": "string",
              "value": "={{ $json.filename }}"
            },
            {
              "id": "f611e749-054a-441d-8610-df8ba42de2e1",
              "name": "text",
              "type": "string",
              "value": "={{ $('Split all citations from a single message').item.json.text }}"
            }
          ]
        }
      },
      "typeVersion": 3.4,
      "alwaysOutputData": true
    },
    {
      "id": "0e999a0e-76ed-4897-989b-228f075e9bfb",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        440,
        -60
      ],
      "parameters": {
        "width": 200,
        "height": 220,
        "content": "### A file retrieval request contains a lot of information, and we want only the text that will be substituted and the file name.\n\n- id\n- filename\n- text\n"
      },
      "typeVersion": 1
    },
    {
      "id": "53c79a6c-7543-435f-b40e-966dff0904d4",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        700,
        -60
      ],
      "parameters": {
        "width": 200,
        "height": 220,
        "content": "### With the last three splits, we may have many citations and texts to substitute. By doing an aggregation, it will be possible to handle everything as a single request."
      },
      "typeVersion": 1
    },
    {
      "id": "381fb6d6-64fc-4668-9d3c-98aaa43a45ca",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        960,
        -60
      ],
      "parameters": {
        "height": 220,
        "content": "### This simple code will take all the previous files and citations and alter the original text, formatting the output. In this way, we can use Markdown tags to create links, or if you prefer, we can add an HTML transformation node."
      },
      "typeVersion": 1
    },
    {
      "id": "d0cbb943-57ab-4850-8370-1625610a852a",
      "name": "Optional Markdown to HTML",
      "type": "n8n-nodes-base.markdown",
      "disabled": true,
      "position": [
        1220,
        120
      ],
      "parameters": {
        "html": "={{ $json.output }}",
        "options": {},
        "destinationKey": "output"
      },
      "typeVersion": 1
    },
    {
      "id": "589e2418-5dec-47d0-ba08-420d84f09da7",
      "name": "Finnaly format the output",
      "type": "n8n-nodes-base.code",
      "position": [
        980,
        120
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "let saida = $('OpenAI Assistant with Vector Store').item.json.output;\n\nfor (let i of $input.item.json.data) {\n saida = saida.replaceAll(i.text, \" _(\"+ i.filename+\")_ \");\n}\n\n$input.item.json.output = saida;\nreturn $input.item;"
      },
      "typeVersion": 2
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "0e621a5a-d99d-4db3-9ae4-ea98c31467e9",
  "connections": {
    "Aggregate": {
      "main": [
        [
          {
            "node": "Finnaly format the output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Regularize output": {
      "main": [
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Window Buffer Memory": {
      "ai_memory": [
        [
          {
            "node": "OpenAI Assistant with Vector Store",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Get ALL Thread Content": {
      "main": [
        [
          {
            "node": "Split all message iterations from a thread",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Finnaly format the output": {
      "main": [
        [
          {
            "node": "Optional Markdown to HTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Retrieve file name from a file ID": {
      "main": [
        [
          {
            "node": "Regularize output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Assistant with Vector Store": {
      "main": [
        [
          {
            "node": "Get ALL Thread Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split all content from a single message": {
      "main": [
        [
          {
            "node": "Split all citations from a single message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split all citations from a single message": {
      "main": [
        [
          {
            "node": "Retrieve file name from a file ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split all message iterations from a thread": {
      "main": [
        [
          {
            "node": "Split all content from a single message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a simple Trigger to have the Chat button within N8N": {
      "main": [
        [
          {
            "node": "OpenAI Assistant with Vector Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
```

Make OpenAI Citation for File Retrieval RAG


Prompt: Show me an n8n workflow for open deep research   ai powered autonomous research workflow

Response:
# Workflow Architecture

**Purpose**: General Automation

**Key Components**:
- Total Nodes: 17
- Node Types: @n8n/n8n-nodes-langchain.agent, @n8n/n8n-nodes-langchain.memoryBufferWindow, n8n-nodes-base.splitInBatches, @n8n/n8n-nodes-langchain.toolWikipedia, n8n-nodes-base.stickyNote, n8n-nodes-base.httpRequest, n8n-nodes-base.code, @n8n/n8n-nodes-langchain.chainLlm, @n8n/n8n-nodes-langchain.lmChatOpenRouter, @n8n/n8n-nodes-langchain.chatTrigger

**Logic Flow**:
1. **Trigger**: @n8n/n8n-nodes-langchain.chatTrigger - Initiates the workflow

## Complete Workflow JSON

```json
{
  "id": "WLSqXECfQF7rOj2A",
  "meta": {
    "instanceId": "cba4a4a2eb5d7683330e2944837278938831ed3c042e20da6f5049c07ad14798"
  },
  "name": "Open Deep Research - AI-Powered Autonomous Research Workflow",
  "tags": [],
  "nodes": [
    {
      "id": "b7b70ba1-0267-4d2b-91f4-5cc4fd22fd03",
      "name": "Chat Message Trigger",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -1940,
        160
      ],
      "webhookId": "cb0b9dbe-1f35-441a-b062-29624b0ebc6a",
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "55a8a512-f2d4-4aed-93e5-dd9bfa2dcaad",
      "name": "Generate Search Queries using LLM",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -1760,
        160
      ],
      "parameters": {
        "text": "=User Query: {{ $('Chat Message Trigger').item.json.chatInput }}",
        "messages": {
          "messageValues": [
            {
              "message": "=You are an expert research assistant. Given a user's query, generate up to four distinct, precise search queries that would help gather comprehensive information on the topic. Return only a JSON list of strings, for example: ['query1', 'query2', 'query3']."
            }
          ]
        },
        "promptType": "define"
      },
      "typeVersion": 1.5
    },
    {
      "id": "5f92361a-b490-479d-8360-c87a100b470e",
      "name": "LLM Response Provider (OpenRouter)",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        -1760,
        700
      ],
      "parameters": {
        "model": "google/gemini-2.0-flash-001",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "id": "WZWYWCfluxuKxZzV",
          "name": "OpenRouter account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "4ab360eb-858f-48b8-a00d-71867d4f0c93",
      "name": "Parse and Chunk JSON Data",
      "type": "n8n-nodes-base.code",
      "position": [
        -1420,
        160
      ],
      "parameters": {
        "jsCode": "// Parse the input JSON string and split it into four chunks\nconst rawText = $json.text;\n\n// Remove Markdown JSON code blocks if present\nconst cleanedText = rawText.replace(/```json|```/g, '').trim();\n\ntry {\n const jsonArray = JSON.parse(cleanedText);\n if (!Array.isArray(jsonArray)) {\n throw new Error('The JSON is not an array.');\n }\n const chunkSize = Math.ceil(jsonArray.length / 4);\n const chunks = [];\n for (let i = 0; i < jsonArray.length; i += chunkSize) {\n chunks.push(jsonArray.slice(i, i + chunkSize));\n }\n return chunks.map(chunk => ({ json: { chunk } }));\n} catch (error) {\n return [{ json: { error: error.message } }];\n}\n"
      },
      "typeVersion": 2
    },
    {
      "id": "5a3ac393-8355-449f-93cb-b98e8bee9b80",
      "name": "Perform SerpAPI Search Request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -780,
        180
      ],
      "parameters": {
        "url": "https://serpapi.com/search",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "q",
              "value": "={{ $('Parse and Chunk JSON Data').item.json.chunk }}"
            },
            {
              "name": "api_key",
              "value": "={{ $credentials.SerpAPI.key }}"
            },
            {
              "name": "engine",
              "value": "google"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "dad82469-830d-40fb-9f6b-b9fefef41267",
      "name": "Perform Jina AI Analysis Request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        80,
        160
      ],
      "parameters": {
        "url": "=https://r.jina.ai/{{ $json.url }}",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "iseKF5sPsvwtJhgT",
          "name": "Jina AI"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "e21bbdf6-a903-491e-920c-ef7576f9ce80",
      "name": "Format SerpAPI Organic Results",
      "type": "n8n-nodes-base.code",
      "position": [
        -460,
        140
      ],
      "parameters": {
        "jsCode": "// Format the organic search results from SerpAPI\nconst results = $input.first().json.organic_results;\nif (results.length === 0) {\n return [{ json: { error: 'No search results found.' } }];\n}\nconst formattedResults = results.map(result => ({\n title: result.title || 'No title available',\n url: result.link || 'No link available',\n source: result.source || result.displayed_link || 'Unknown source'\n}));\nreturn formattedResults.map(result => ({ json: result }));\n"
      },
      "typeVersion": 2
    },
    {
      "id": "a856c8e8-5c3c-4a2f-9086-66deee1afd06",
      "name": "Extract Relevant Context via LLM",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -1280,
        520
      ],
      "parameters": {
        "text": "=User Queries: {{ $('Parse and Chunk JSON Data').all().map(item => item.json.chunk[0]).join(', ') }}\nWebpage Contents: \n\"\"\"\n{{ $json.data }}\n\"\"\"",
        "options": {
          "systemMessage": "=You are an expert information extractor. Given the user's query, the search query that led to this page, and the webpage content, extract all relevant pieces of information that are useful to answer the query. Return only the relevant context as plain text without any additional commentary."
        },
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "6d5c6698-0b4f-438c-91b9-3597f5d3e904",
      "name": "Generate Comprehensive Research Report",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -740,
        520
      ],
      "parameters": {
        "text": "=Extracted Contexts (Merged):\n\"\"\"\n{{ $json.output }}\n\"\"\"",
        "options": {
          "systemMessage": "You are an expert researcher and report writer. Based on the gathered contexts and the original user query, generate a comprehensive, well-structured report. Include all relevant insights and conclusions without unnecessary commentary.\n\nFormat the report in Markdown with clear headings. For example:\n\n# Research Report: [User Query]\n\n## Key Findings\n- Point 1\n- Point 2\n\n## Detailed Analysis\n### Aspect 1\nSummary of findings.\n_Source:_ [Source Name](URL)\n\n### Aspect 2\nSummary of findings.\n_Source:_ [Another Source](URL)\n\nNow, generate the complete report."
        },
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "05fea6a1-791e-4980-8f2a-2960455066d7",
      "name": "Split Data for SerpAPI Batching",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -1100,
        160
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "df00e7e8-99b8-484a-8047-869474fefee9",
      "name": "Split Data for Jina AI Batching",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -220,
        140
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "2edc683b-65f7-40c3-a22d-7fbf5b67de0a",
      "name": "LLM Memory Buffer (Input Context)",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -1160,
        740
      ],
      "parameters": {
        "sessionKey": "my_test_session",
        "sessionIdType": "customKey",
        "contextWindowLength": 20
      },
      "typeVersion": 1.3
    },
    {
      "id": "23017ae7-72a7-45c7-8edf-d0ba72220675",
      "name": "LLM Memory Buffer (Report Context)",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -620,
        760
      ],
      "parameters": {
        "sessionKey": "my_test_session",
        "sessionIdType": "customKey",
        "contextWindowLength": 20
      },
      "typeVersion": 1.3
    },
    {
      "id": "6bc9533b-e265-47b3-b93a-3a4f86ba0541",
      "name": "Fetch Wikipedia Information",
      "type": "@n8n/n8n-nodes-langchain.toolWikipedia",
      "position": [
        -580,
        920
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "b25c148e-047d-40a7-8818-94c3504828dd",
      "name": "Sticky Note: SerpAPI Setup",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -940,
        -20
      ],
      "parameters": {
        "color": 7,
        "width": 420,
        "height": 140,
        "content": "## SerpAPI Setup Instructions\n1. Obtain your API key from https://serpapi.com/manage-api-key.\n2. Save your API key securely in n8n credentials (do not use plain text)."
      },
      "typeVersion": 1
    },
    {
      "id": "e69c9a85-31e4-42b9-a09a-683ec5bb97d1",
      "name": "Sticky Note: Jina AI Setup",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -60,
        -40
      ],
      "parameters": {
        "color": 7,
        "width": 420,
        "height": 140,
        "content": "## Jina AI Setup Instructions\n1. Obtain your API key from https://jina.ai/api-dashboard/key-manager.\n2. Configure your Jina AI credential in n8n to ensure secure API access."
      },
      "typeVersion": 1
    },
    {
      "id": "dbd204e0-da8e-41d8-814b-f409a23e9573",
      "name": "Sticky Note: OpenRouter API Setup",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1680,
        460
      ],
      "parameters": {
        "color": 7,
        "width": 300,
        "height": 180,
        "content": "## OpenRouter API Setup Instructions\n1. Obtain your API key from https://openrouter.ai/settings/keys.\n2. Set up your OpenRouter credential in n8n for secure integration."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "aa857bb3-84c1-4fe6-9464-90fc09163960",
  "connections": {
    "Chat Message Trigger": {
      "main": [
        [
          {
            "node": "Generate Search Queries using LLM",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse and Chunk JSON Data": {
      "main": [
        [
          {
            "node": "Split Data for SerpAPI Batching",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Wikipedia Information": {
      "ai_tool": [
        [
          {
            "node": "Generate Comprehensive Research Report",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Format SerpAPI Organic Results": {
      "main": [
        [
          {
            "node": "Split Data for Jina AI Batching",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Perform SerpAPI Search Request": {
      "main": [
        [
          {
            "node": "Split Data for SerpAPI Batching",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Data for Jina AI Batching": {
      "main": [
        [
          {
            "node": "Extract Relevant Context via LLM",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Perform Jina AI Analysis Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Data for SerpAPI Batching": {
      "main": [
        [
          {
            "node": "Format SerpAPI Organic Results",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Perform SerpAPI Search Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Relevant Context via LLM": {
      "main": [
        [
          {
            "node": "Generate Comprehensive Research Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Perform Jina AI Analysis Request": {
      "main": [
        [
          {
            "node": "Split Data for Jina AI Batching",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Search Queries using LLM": {
      "main": [
        [
          {
            "node": "Parse and Chunk JSON Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "LLM Memory Buffer (Input Context)": {
      "ai_memory": [
        [
          {
            "node": "Extract Relevant Context via LLM",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "LLM Memory Buffer (Report Context)": {
      "ai_memory": [
        [
          {
            "node": "Generate Comprehensive Research Report",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "LLM Response Provider (OpenRouter)": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Search Queries using LLM",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "Extract Relevant Context via LLM",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "Generate Comprehensive Research Report",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}
```

Open Deep Research - AI-Powered Autonomous Research Workflow


Prompt: How would you build: Query Perplexity Ai From Your N8N Workflows?

Response:
# Workflow Architecture

**Purpose**: General Automation

**Key Components**:
- Total Nodes: 6
- Node Types: n8n-nodes-base.set, n8n-nodes-base.manualTrigger, n8n-nodes-base.stickyNote, n8n-nodes-base.httpRequest

**Logic Flow**:
1. **Trigger**: n8n-nodes-base.manualTrigger - Initiates the workflow

## Complete Workflow JSON

```json
{
  "nodes": [
    {
      "id": "293b70f0-06e8-4db5-befd-bfaed1f3575a",
      "name": "When clicking ‘Test workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -460,
        80
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "1c473546-6280-412d-9f8e-b43962365d78",
      "name": "Set Params",
      "type": "n8n-nodes-base.set",
      "position": [
        -160,
        -60
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "8b5c6ca0-5ca8-4f67-abc1-44341cf419bc",
              "name": "system_prompt",
              "type": "string",
              "value": "You are an n8n fanboy."
            },
            {
              "id": "7c36c362-6269-4564-b6fe-f82126bc8f5e",
              "name": "user_prompt",
              "type": "string",
              "value": "What are the differences between n8n and Make?"
            },
            {
              "id": "4366d2b5-ad22-445a-8589-fddab1caa1ab",
              "name": "domains",
              "type": "string",
              "value": "n8n.io, make.com"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "894bd6a4-5db7-45fb-a8e0-1a81af068bbf",
      "name": "Clean Output",
      "type": "n8n-nodes-base.set",
      "position": [
        580,
        -100
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "5859093c-6b22-41db-ac6c-9a9f6f18b7e3",
              "name": "output",
              "type": "string",
              "value": "={{ $json.choices[0].message.content }}"
            },
            {
              "id": "13208fff-5153-45a7-a1cb-fe49e32d9a03",
              "name": "citations",
              "type": "array",
              "value": "={{ $json.citations }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "52d3a832-8c9b-4356-ad2a-377340678a58",
      "name": "Perplexity Request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        240,
        40
      ],
      "parameters": {
        "url": "https://api.perplexity.ai/chat/completions",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n \"model\": \"sonar\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"{{ $json.system_prompt }}\"\n },\n {\n \"role\": \"user\",\n \"content\": \"{{ $json.user_prompt }}\"\n }\n ],\n \"temperature\": 0.2,\n \"top_p\": 0.9,\n \"search_domain_filter\": {{ (JSON.stringify($json.domains.split(','))) }},\n \"return_images\": false,\n \"return_related_questions\": false,\n \"search_recency_filter\": \"month\",\n \"top_k\": 0,\n \"stream\": false,\n \"presence_penalty\": 0,\n \"frequency_penalty\": 1,\n \"response_format\": null\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpBasicAuth": {
          "id": "yEocL0NSpUWzMsHG",
          "name": "Perplexity"
        },
        "httpHeaderAuth": {
          "id": "TngzgS09J1YvLIXl",
          "name": "Perplexity"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "48657f2c-d1dd-4d7e-8014-c27748e63e58",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -140,
        -440
      ],
      "parameters": {
        "width": 480,
        "height": 300,
        "content": "## Credentials Setup\n\n1/ Go to the perplexity dashboard, purchase some credits and create an API Key\n\nhttps://www.perplexity.ai/settings/api\n\n2/ In the perplexity Request node, use Generic Credentials, Header Auth. \n\nFor the name, use the value \"Authorization\"\nAnd for the value \"Bearer pplx-e4...59ea\" (Your Perplexity Api Key)\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "e0daabee-c145-469e-93c2-c759c303dc2a",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        100,
        260
      ],
      "parameters": {
        "color": 5,
        "width": 480,
        "height": 120,
        "content": "**Sonar Pro** is the current top model used by perplexity. \nIf you want to use a different one, check this page: \n\nhttps://docs.perplexity.ai/guides/model-cards"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Set Params": {
      "main": [
        [
          {
            "node": "Perplexity Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Perplexity Request": {
      "main": [
        [
          {
            "node": "Clean Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Set Params",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
```

Query Perplexity AI from your n8n workflows


Prompt: How would you build: Reconcile Rent Payments With Local Excel Spreadsheet And Openai?

Response:
# Workflow Architecture

**Purpose**: Data Processing

**Key Components**:
- Total Nodes: 17
- Node Types: n8n-nodes-base.splitOut, n8n-nodes-base.set, @n8n/n8n-nodes-langchain.lmChatOpenAi, @n8n/n8n-nodes-langchain.agent, @n8n/n8n-nodes-langchain.toolCode, n8n-nodes-base.extractFromFile, n8n-nodes-base.stickyNote, @n8n/n8n-nodes-langchain.outputParserStructured, n8n-nodes-base.code, n8n-nodes-base.readWriteFile

**Logic Flow**:
1. **Trigger**: n8n-nodes-base.localFileTrigger - Initiates the workflow

## Complete Workflow JSON

```json
{
  "meta": {
    "instanceId": "26ba763460b97c249b82942b23b6384876dfeb9327513332e743c5f6219c2b8e"
  },
  "nodes": [
    {
      "id": "bebbf9cf-8103-4694-a3be-ae3ee1e9ebaf",
      "name": "Watch For Bank Statements",
      "type": "n8n-nodes-base.localFileTrigger",
      "position": [
        780,
        400
      ],
      "parameters": {
        "path": "/home/node/host_mount/reconciliation_project",
        "events": [
          "add"
        ],
        "options": {
          "ignored": "!**/*.csv"
        },
        "triggerOn": "folder"
      },
      "typeVersion": 1
    },
    {
      "id": "eca26bed-ba44-4507-97d4-9154e26908a5",
      "name": "Get Tenant Details",
      "type": "@n8n/n8n-nodes-langchain.toolCode",
      "position": [
        1660,
        540
      ],
      "parameters": {
        "name": "get_tenant_details",
        "jsCode": "const xlsx = require('xlsx');\n\nconst { spreadsheet_location } = $('Set Variables').item.json;\nconst sheetName = 'tenants';\n\nconst wb = xlsx.readFile(spreadsheet_location, { sheets: [sheetName] });\nconst rows = xlsx.utils.sheet_to_json(wb.Sheets[sheetName], { raw: false });\n\nconst queryToList = [].concat(typeof query === 'string' ? query.split(',') : query);\n\nconst result = queryToList.map(q => (\n rows.find(row =>\n row['Tenant Name'].toLowerCase() === q.toLowerCase()\n || row['Tenant ID'].toLowerCase() === q.toString().toLowerCase()\n )\n));\n\nreturn result ? JSON.stringify(result) : `No results were found for ${query}`;",
        "description": "Call this tool to get a tenant's details which includes their tenancy terms, rent amount and any notes attached to their account. Pass in one or an array of either the tenant ID or the name of the tenant."
      },
      "typeVersion": 1.1
    },
    {
      "id": "76b68c2f-8d33-4f61-a442-732e784b733a",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1920,
        540
      ],
      "parameters": {
        "jsonSchemaExample": "[{\n \"tenant_id\": \"\",\n \"tenant_name\": \"\",\n \"property_id\": \"\",\n \"property_postcode\": \"\",\n \"action_required\": \"\",\n \"details\": \"\",\n \"date\": \"\"\n}]"
      },
      "typeVersion": 1.2
    },
    {
      "id": "be01720f-4617-4a2b-aaed-2474f9f0e25b",
      "name": "Get Bank Statement File",
      "type": "n8n-nodes-base.readWriteFile",
      "position": [
        1100,
        400
      ],
      "parameters": {
        "options": {},
        "fileSelector": "={{ $('Watch For Bank Statements').item.json.path }}"
      },
      "typeVersion": 1
    },
    {
      "id": "2aba5f6a-56b0-411f-9124-33025d90e325",
      "name": "Get CSV Data",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        1260,
        400
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "a60d5851-f938-4696-855b-1f0845ffbc6c",
      "name": "Alert Actions To List",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        2260,
        400
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "output"
      },
      "typeVersion": 1
    },
    {
      "id": "f804d9fb-f679-4e95-b70f-722e7c222c40",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        690.6721905682555,
        177.80249392766257
      ],
      "parameters": {
        "color": 7,
        "width": 748.2548372021405,
        "height": 457.6238063670572,
        "content": "## Step 1. Wait For Incoming Bank Statements\n[Read more about the local file triggers](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.localfiletrigger)\n\nFor this demo, we'll show that n8n is more than capable working with the local filesystem. This gives great benefits in terms of privacy and data security.\n\nFor our datastore, we're using a locally hosted XLSX Excel file which we'll query and update throughout this workflow."
      },
      "typeVersion": 1
    },
    {
      "id": "01e9c335-320c-4fff-9ade-ad1cf808db00",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1460,
        80
      ],
      "parameters": {
        "color": 7,
        "width": 634.3165117416636,
        "height": 675.2455596085985,
        "content": "## Step 2. Delegate to AI Agent to Quickly Identify Issues with Rental Payments\n[Read more about AI Agents](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent/)\n\nAn AI agent can not only check against agreed amounts and compare due dates but also consider contract exceptions and tenant notes before deciding to take action. In a scenario of 10+ of tenants, this can save a lot of admin time.\n\nFor this demo, we're using a remote LLM Model but this can easily be swapped out for other self-hosted LLMS models that support function calling."
      },
      "typeVersion": 1
    },
    {
      "id": "2456b1e5-ceec-45c3-91a7-52e21125e6e5",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2120,
        143.8836673253448
      ],
      "parameters": {
        "color": 7,
        "width": 618.3293247808133,
        "height": 473.7439917476675,
        "content": "## Step 3. Generate a Report to Action any Issues\n[Read more about using the Code Node](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.code)\n\nAfter the AI Agent has helped identify issues to action, we can generate a report and update a locally hosted xlsx file. This again helps keep workflows private to nothing senstive goes over the wire.\n\nThough n8n lacks a builtin node for editing local xlsx file, we can tap into the sheetJS library available to the \"Code\" node."
      },
      "typeVersion": 1
    },
    {
      "id": "7b32e8f9-b543-47e1-a08e-53ee47105966",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        260,
        80
      ],
      "parameters": {
        "width": 399.5148533727183,
        "height": 558.2628336538015,
        "content": "## Try It Out!\n### This workflow ingests bank statements to analyses them against a list of tenants using an AI Agent. The agent then flags any issues such as missing payments or incorrect amounts which are exported to a XLSX spreadsheet.\n\n### Note: This workflow is intended to work with a self-hosted version of n8n and has access to the local file system.\n\n* Watches for CSV files (bank statements)\n* Imports into AI agent for analysis.\n* AI agent will query the Excel spreadsheet for tenant and property details.\n* AI agent will generate report on discrepancies or issues and write them to the Excel file.\n\n\n### Need Help?\nJoin the [Discord](https://discord.com/invite/XPKeKXeB7d) or ask in the [Forum](https://community.n8n.io/)!\n\nHappy Hacking!"
      },
      "typeVersion": 1
    },
    {
      "id": "ba35ed0b-7ace-4b76-b915-0dc516a07fb1",
      "name": "Get Property Details",
      "type": "@n8n/n8n-nodes-langchain.toolCode",
      "position": [
        1800,
        540
      ],
      "parameters": {
        "name": "get_property_details",
        "jsCode": "const xlsx = require('xlsx');\n\nconst { spreadsheet_location } = $('Set Variables').item.json;\nconst sheetName = 'properties'\n\nconst wb = xlsx.readFile(spreadsheet_location, { sheets: [sheetName] });\nconst rows = xlsx.utils.sheet_to_json(wb.Sheets[sheetName], { raw: false });\n\nconst queryToList = [].concat(typeof query === 'string' ? query.split(',') :query);\n\nconst result = queryToList.map(q => rows.find(row => row['Property ID'] === q));\n\nreturn result ? JSON.stringify(result) : `No results were found for ${query}`;",
        "description": "Call this tool to get a property details which includes the address, postcode and type of the property. Pass in one or an array of Property IDs."
      },
      "typeVersion": 1.1
    },
    {
      "id": "8c85a2f5-6741-41f4-b377-c74a74b14d0f",
      "name": "Set Variables",
      "type": "n8n-nodes-base.set",
      "position": [
        940,
        400
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "bcd3dd04-0082-4da6-b36b-e5ad09c4de30",
              "name": "spreadsheet_location",
              "type": "string",
              "value": "/home/node/host_mount/reconciliation_project/reconcilation-workbook.xlsx"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "bd75bad8-caa3-48f1-8892-3d1221765564",
      "name": "Append To Spreadsheet",
      "type": "n8n-nodes-base.code",
      "position": [
        2480,
        400
      ],
      "parameters": {
        "jsCode": "const xlsx = require('xlsx');\n\nconst { spreadsheet_location } = $('Set Variables').first().json;\nconst sheetName = 'alerts';\n\nconst wb = xlsx.readFile(spreadsheet_location);\nxlsx.writeFile(wb, spreadsheet_location + '.bak.xlsx'); // create backup\n\nconst worksheet = wb.Sheets[sheetName];\n\nconst inputs = $input.all();\n\nfor (input of inputs) {\n xlsx.utils.sheet_add_aoa(worksheet, [\n [\n input.json.date,\n input.json[\"property_id\"],\n input.json[\"property_postcode\"],\n input.json[\"tenant_id\"],\n input.json[\"tenant_name\"],\n input.json[\"action_required\"],\n input.json[\"details\"],\n ]\n ], { origin: -1 });\n}\n\n// update sheet ref\nconst range = xlsx.utils.decode_range(worksheet['!ref']);\nconst rowIndex = range.e.r + 1; // The next row index to append\nworksheet['!ref'] = xlsx.utils.encode_range({\n s: range.s,\n e: { r: rowIndex, c: range.e.c }\n});\n\nxlsx.writeFile(wb, spreadsheet_location, {\n cellDates: true,\n cellStyles: true,\n bookType: 'xlsx',\n});\n\nreturn {\"json\": { \"output\": `${inputs.length} rows added` }}"
      },
      "typeVersion": 2
    },
    {
      "id": "c818ea7e-dc57-4680-b797-abb21cca87fb",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1540,
        540
      ],
      "parameters": {
        "model": "gpt-4o",
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "8gccIjcuf3gvaoEr",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b2a97514-6020-49a6-bbdb-ee1251eb6aed",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2280,
        640
      ],
      "parameters": {
        "color": 3,
        "width": 461.5505566920007,
        "height": 106.59049079746408,
        "content": "### 🚨Warning! Potentially Destructive Operations!\nWith code comes great responsibility! There is a risk you may overwrite/delete data you didn't intend. Always makes backups and test on a copy of your spreadsheets!"
      },
      "typeVersion": 1
    },
    {
      "id": "f869f6eb-cf19-4b14-bf3a-4db5d636646f",
      "name": "Reconcile Rental Payments",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1640,
        360
      ],
      "parameters": {
        "text": "=Bank Statement for {{ $input.first().json.date }} to {{ $input.last().json.date }}:\n|date|reference|money in|money out|\n|-|-|-|-|\n{{ $input.all().map(row => `|${row.json.date}|${row.json.reference}|${row.json.money_in || ''}|${row.json.money_out || ''}|`).join('\\n') }}",
        "options": {
          "systemMessage": "Your task is to help reconcile rent payments with the uploaded bank statement and alert only if there are any actions to be taken in regards to the tenants.\n* Identify and flag any tenants who have have missed their rent according to the month. Late payments which are within a few days of the due date are acceptable and should not be flagged.\n* Identify and flag if any tenants have not paid the correct ammount due, either less or more.\n* Identify and flag any tenants who are finishing their rentals within the time period of the current statement.\n* Identify and flag any remaining fees which are due and have not been paid from any tenant in the last month of their rental.\n\nIf the bank statement show incomplete months due to cut off, it is ok to assume the payment is pending and not actually missing.\n\nThe alert system requires a JSON formatted message. It is important that you format your response as follows:\n[{\n \"tenant_id\": \"\",\n \"tenant_name\": \"\",\n \"property_id\": \"\",\n \"property_postcode\": \"\",\n \"action required\": \"\",\n \"details\": \"\",\n \"date\": \"\"\n}]"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "executeOnce": true,
      "typeVersion": 1.6
    },
    {
      "id": "510dc73c-f267-41f3-a981-58f5bfc229a6",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        360,
        660
      ],
      "parameters": {
        "color": 5,
        "width": 302.6142384407349,
        "height": 86.00673806595168,
        "content": "### 💡I'm designed to work self-hosted!\nSome nodes in this workflow are only available to the self-hosted version of n8n."
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Get CSV Data": {
      "main": [
        [
          {
            "node": "Reconcile Rental Payments",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Variables": {
      "main": [
        [
          {
            "node": "Get Bank Statement File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Reconcile Rental Payments",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Get Tenant Details": {
      "ai_tool": [
        [
          {
            "node": "Reconcile Rental Payments",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get Property Details": {
      "ai_tool": [
        [
          {
            "node": "Reconcile Rental Payments",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Alert Actions To List": {
      "main": [
        [
          {
            "node": "Append To Spreadsheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Bank Statement File": {
      "main": [
        [
          {
            "node": "Get CSV Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Reconcile Rental Payments",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Reconcile Rental Payments": {
      "main": [
        [
          {
            "node": "Alert Actions To List",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Watch For Bank Statements": {
      "main": [
        [
          {
            "node": "Set Variables",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
```

Reconcile Rent Payments with Local Excel Spreadsheet and OpenAI


Prompt: Build a workflow for: Scrape Trustpilot Reviews With Deepseek, Analyze Sentiment With Openai

Response:
# Workflow Architecture

**Purpose**: General Automation

**Key Components**:
- Total Nodes: 20
- Node Types: n8n-nodes-base.splitOut, n8n-nodes-base.set, @n8n/n8n-nodes-langchain.lmChatOpenAi, n8n-nodes-base.limit, n8n-nodes-base.html, n8n-nodes-base.if, n8n-nodes-base.manualTrigger, n8n-nodes-base.stickyNote, @n8n/n8n-nodes-langchain.sentimentAnalysis, n8n-nodes-base.httpRequest

**Logic Flow**:
1. **Trigger**: n8n-nodes-base.manualTrigger - Initiates the workflow

## Complete Workflow JSON

```json
{
  "id": "w434EiZ2z7klQAyp",
  "meta": {
    "instanceId": "a4bfc93e975ca233ac45ed7c9227d84cf5a2329310525917adaf3312e10d5462",
    "templateCredsSetupCompleted": true
  },
  "name": "Scrape Trustpilot Reviews with DeepSeek, Analyze Sentiment with OpenAI",
  "tags": [
    {
      "id": "2VG6RbmUdJ2VZbrj",
      "name": "Google Drive",
      "createdAt": "2024-12-04T16:50:56.177Z",
      "updatedAt": "2024-12-04T16:50:56.177Z"
    },
    {
      "id": "paTcf5QZDJsC2vKY",
      "name": "OpenAI",
      "createdAt": "2024-12-04T16:52:10.768Z",
      "updatedAt": "2024-12-04T16:52:10.768Z"
    }
  ],
  "nodes": [
    {
      "id": "095a8e10-1630-4a1a-b6c9-7950ae1ed803",
      "name": "Split Out",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        320,
        -380
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "recensioni"
      },
      "typeVersion": 1
    },
    {
      "id": "6ff4dd9d-eedd-4d84-b13a-b3c0db717409",
      "name": "Information Extractor",
      "type": "@n8n/n8n-nodes-langchain.informationExtractor",
      "position": [
        -440,
        140
      ],
      "parameters": {
        "text": "=You need to extract the review from the following HTML: {{ $json.recensione }}",
        "options": {
          "systemPromptTemplate": "You are a review expert. You need to extract only the required information and report it without changing anything.\nAll the required information is in the text."
        },
        "attributes": {
          "attributes": [
            {
              "name": "autore",
              "required": true,
              "description": "Extract the name of the review author"
            },
            {
              "name": "valutazione",
              "type": "number",
              "required": true,
              "description": "Extract the rating given to the review (from 1 to 5)"
            },
            {
              "name": "data",
              "required": true,
              "description": "Extract review date in YYYY-MM-DD format"
            },
            {
              "name": "titolo",
              "required": true,
              "description": "Extract the review title"
            },
            {
              "name": "testo",
              "required": true,
              "description": "Extract the review text"
            },
            {
              "name": "n_recensioni",
              "type": "number",
              "required": true,
              "description": "Extract the total number of reviews made by the user"
            },
            {
              "name": "nazione",
              "required": true,
              "description": "Extract the country of the user who wrote the review. Must be two characters"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "0036f3b1-4832-4a35-8694-0893475a4119",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        60,
        -100
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "ab666549-4eec-40e2-a702-0575c094a2d4",
              "operator": {
                "type": "string",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $json.Valutazione }}",
              "rightValue": "={{ $('Split Out').item.json.recensioni.replace('/reviews/','') }}"
            }
          ]
        },
        "looseTypeValidation": true
      },
      "executeOnce": false,
      "typeVersion": 2.2
    },
    {
      "id": "5423b55d-eb6c-41c6-9b26-410e3c92b85d",
      "name": "When clicking ‘Test workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -700,
        -380
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "506cdaa1-e0ba-4f29-b137-69d321b13c94",
      "name": "Limit1",
      "type": "n8n-nodes-base.limit",
      "position": [
        540,
        -380
      ],
      "parameters": {
        "maxItems": 3
      },
      "typeVersion": 1
    },
    {
      "id": "40f1e30d-8aed-4995-b4e4-2239248bd6e7",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -460,
        -480
      ],
      "parameters": {
        "width": 212.25249169435213,
        "height": 245.55481727574733,
        "content": "Change to the name of the company registered on Trustpilot and the maximum number of pages to scrape"
      },
      "typeVersion": 1
    },
    {
      "id": "e6d2fec1-7255-4270-86b4-6d6f39f44ccb",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -460,
        80
      ],
      "parameters": {
        "width": 381,
        "height": 177,
        "content": "Extract all information with DeepSeek (remember to change base_url with https://api.deepseek.com/v1)"
      },
      "typeVersion": 1
    },
    {
      "id": "af5e962c-4faf-41cc-a8b8-2fbb145b7af6",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -240,
        -160
      ],
      "parameters": {
        "width": 501.28903654485043,
        "height": 195.84053156146172,
        "content": "Check if the review has already been saved to Google Drive"
      },
      "typeVersion": 1
    },
    {
      "id": "400dff0c-8b2e-4fe2-933e-1f4d14624ca1",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        40,
        80
      ],
      "parameters": {
        "width": 301.27574750830576,
        "height": 177.34219269102988,
        "content": "Analyze review sentiment"
      },
      "typeVersion": 1
    },
    {
      "id": "52757ade-4206-40f9-bf4f-c3aefb004d2e",
      "name": "Set Parameters",
      "type": "n8n-nodes-base.set",
      "position": [
        -440,
        -380
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "556e201d-242a-4c0e-bc13-787c2b60f800",
              "name": "company_id",
              "type": "string",
              "value": "COMPANY"
            },
            {
              "id": "a1f239df-df08-41d8-8b78-d6502266a581",
              "name": "max_page",
              "type": "number",
              "value": 2
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "cd7e9d36-7ecd-4d9c-b552-8f46b0cfcc03",
      "name": "Get reviews",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -200,
        -380
      ],
      "parameters": {
        "url": "=https://it.trustpilot.com/review/{{ $json.company_id }}",
        "options": {
          "pagination": {
            "pagination": {
              "parameters": {
                "parameters": [
                  {
                    "name": "page",
                    "value": "={{ $pageCount + 1 }}"
                  }
                ]
              },
              "maxRequests": "={{ $json.max_page }}",
              "requestInterval": 5000,
              "limitPagesFetched": true
            }
          }
        },
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "sort",
              "value": "recency"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "476ff7b6-ab30-4674-a7fe-b032128ee51a",
      "name": "Extract",
      "type": "n8n-nodes-base.html",
      "position": [
        60,
        -380
      ],
      "parameters": {
        "options": {},
        "operation": "extractHtmlContent",
        "extractionValues": {
          "values": [
            {
              "key": "recensioni",
              "attribute": "href",
              "cssSelector": "article section a",
              "returnArray": true,
              "returnValue": "attribute"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "a2a35455-7d3e-4c4c-aa66-6cbbd48d867a",
      "name": "Get rows",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -200,
        -100
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $('Split Out').item.json.recensioni.replace('/reviews/','') }}",
              "lookupColumn": "Id"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "Foglio1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1QZhQqg79-HVBQh8Y2ihMq67UIYIRrJFKLQalcFvtDaY",
          "cachedResultUrl": "",
          "cachedResultName": "Trustpilot Review"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "JYR6a64Qecd6t8Hb",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "2d507fe6-a4fc-42ff-97ff-dfd552c651ab",
      "name": "Get Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -440,
        -100
      ],
      "parameters": {
        "columns": {
          "value": {
            "Id": "={{ $('Split Out').item.json.recensioni.replace('/reviews/','') }}"
          },
          "schema": [
            {
              "id": "Id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Data",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Data",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Nome",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Nome",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Titolo",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Titolo",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Testo",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Testo",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Località",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Località",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "N. Recensioni",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "N. Recensioni",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "URL",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "URL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Valutazione",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Valutazione",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Sentiment",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Sentiment",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "Foglio1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1QZhQqg79-HVBQh8Y2ihMq67UIYIRrJFKLQalcFvtDaY",
          "cachedResultUrl": "",
          "cachedResultName": "Trustpilot Reviews"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "JYR6a64Qecd6t8Hb",
          "name": "Google Sheets account"
        }
      },
      "executeOnce": false,
      "typeVersion": 4.5
    },
    {
      "id": "0a1fab6e-96b7-403b-884e-f67be6e23fa5",
      "name": "Get Single review",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        320,
        -120
      ],
      "parameters": {
        "url": "=https://it.trustpilot.com{{ $('Split Out').item.json.recensioni }}",
        "options": {}
      },
      "typeVersion": 4.2,
      "alwaysOutputData": false
    },
    {
      "id": "7d322d76-1032-405a-9d46-2958761a184d",
      "name": "Extract review",
      "type": "n8n-nodes-base.html",
      "position": [
        540,
        -120
      ],
      "parameters": {
        "options": {},
        "operation": "extractHtmlContent",
        "extractionValues": {
          "values": [
            {
              "key": "recensione",
              "cssSelector": "article",
              "returnArray": true
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "952484e5-8e87-4eb3-99a6-5bf26c701ba8",
      "name": "Update sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        520,
        120
      ],
      "parameters": {
        "columns": {
          "value": {
            "Id": "={{ $('Split Out').item.json.recensioni.replace('/reviews/','') }}",
            "URL": "=https://it.trustpilot.com{{ $('Split Out').item.json.recensioni }}",
            "Data": "={{ $('Information Extractor').item.json.output.data }}",
            "Nome": "={{ $json.output.autore }}",
            "Testo": "={{ $('Information Extractor').item.json.output.testo }}",
            "Titolo": "={{ $('Information Extractor').item.json.output.titolo }}",
            "Località": "={{ $('Information Extractor').item.json.output.nazione }}",
            "Sentiment": "={{ $json.sentimentAnalysis.category }}",
            "Valutazione": "={{ $('Information Extractor').item.json.output.valutazione }}",
            "N. Recensioni": "={{ $('Information Extractor').item.json.output.n_recensioni }}"
          },
          "schema": [
            {
              "id": "Id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Data",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Data",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Nome",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Nome",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Titolo",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Titolo",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Testo",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Testo",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Località",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Località",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "N. Recensioni",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "N. Recensioni",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "URL",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "URL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Valutazione",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Valutazione",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Sentiment",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Sentiment",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "Foglio1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1QZhQqg79-HVBQh8Y2ihMq67UIYIRrJFKLQalcFvtDaY",
          "cachedResultUrl": "",
          "cachedResultName": "Trustpilot Reviews"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "JYR6a64Qecd6t8Hb",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "eb853885-816d-4df7-b5ac-900fa89d3df9",
      "name": "Sentiment Analysis",
      "type": "@n8n/n8n-nodes-langchain.sentimentAnalysis",
      "position": [
        60,
        140
      ],
      "parameters": {
        "options": {
          "categories": "Positive, Neutral, Negative",
          "systemPromptTemplate": "You are highly intelligent and accurate sentiment analyzer. Analyze the sentiment of the provided text. Categorize it into one of the following: {categories}. Use the provided formatting instructions. Only output the JSON."
        },
        "inputText": "={{ $json.output.testo }}"
      },
      "typeVersion": 1
    },
    {
      "id": "79f1b9ea-6297-4735-9c0f-9f28dd65efa0",
      "name": "DeepSeek Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -460,
        320
      ],
      "parameters": {
        "model": "deepseek-reasoner",
        "options": {
          "baseURL": "https://api.deepseek.com/v1"
        }
      },
      "credentials": {
        "openAiApi": {
          "id": "97Cz4cqyiy1RdcQL",
          "name": "DeepSeek"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "159cc88e-1dd3-4bba-a3c8-59a9aad14c88",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        40,
        320
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "CDX6QM4gLYanh0P4",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "43c8ee74-159c-4217-9cb4-554c63a3b183",
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Get Single review",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Limit1": {
      "main": [
        [
          {
            "node": "Get Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get rows": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "Limit1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get reviews": {
      "main": [
        [
          {
            "node": "Extract",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract review": {
      "main": [
        [
          {
            "node": "Information Extractor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Parameters": {
      "main": [
        [
          {
            "node": "Get reviews",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Google Sheets": {
      "main": [
        [
          {
            "node": "Get rows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Single review": {
      "main": [
        [
          {
            "node": "Extract review",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Sentiment Analysis",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Sentiment Analysis": {
      "main": [
        [
          {
            "node": "Update sheet",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Update sheet",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Update sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "DeepSeek Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Information Extractor",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Information Extractor": {
      "main": [
        [
          {
            "node": "Sentiment Analysis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Set Parameters",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
```

Scrape Trustpilot Reviews with DeepSeek, Analyze Sentiment with OpenAI


Prompt: Design a workflow using n8n-nodes-base.set, n8n-nodes-base.html, n8n-nodes-base.scheduleTrigger to news extraction

Response:
# Workflow Architecture

**Purpose**: General Automation

**Key Components**:
- Total Nodes: 36
- Node Types: n8n-nodes-base.set, n8n-nodes-base.html, n8n-nodes-base.scheduleTrigger, n8n-nodes-base.openAi, n8n-nodes-base.itemLists, n8n-nodes-base.stickyNote, n8n-nodes-base.code, n8n-nodes-base.httpRequest, n8n-nodes-base.nocoDb, n8n-nodes-base.merge

**Logic Flow**:
1. **Trigger**: n8n-nodes-base.scheduleTrigger - Initiates the workflow

## Complete Workflow JSON

```json
{
  "id": "xM8Z5vZVNTNjCySL",
  "meta": {
    "instanceId": "b8ef33547995f2a520f12118ac1f7819ea58faa7a1096148cac519fa08be8e99"
  },
  "name": "News Extraction",
  "tags": [],
  "nodes": [
    {
      "id": "97711d12-20de-40aa-b994-d2b10f20a5e5",
      "name": "Extract the HTML with the right css class",
      "type": "n8n-nodes-base.html",
      "position": [
        -500,
        0
      ],
      "parameters": {
        "options": {
          "trimValues": true
        },
        "operation": "extractHtmlContent",
        "extractionValues": {
          "values": [
            {
              "key": "data",
              "attribute": "href",
              "cssSelector": "=div:nth-child(9) > div:nth-child(3) > a:nth-child(2)",
              "returnArray": true,
              "returnValue": "attribute"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b874b570-daae-4878-b525-07ac30756eb1",
      "name": "Summary",
      "type": "n8n-nodes-base.openAi",
      "position": [
        -880,
        440
      ],
      "parameters": {
        "model": "gpt-4-1106-preview",
        "prompt": {
          "messages": [
            {
              "content": "=Create a summary in less than 70 words {{ $json[\"content\"] }}"
            }
          ]
        },
        "options": {},
        "resource": "chat"
      },
      "credentials": {
        "openAiApi": {
          "id": "0Vdk5RlVe7AoUdAM",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "72696278-2d44-4073-936a-6fe9df1bc7d8",
      "name": "Keywords",
      "type": "n8n-nodes-base.openAi",
      "position": [
        -880,
        620
      ],
      "parameters": {
        "model": "gpt-4-1106-preview",
        "prompt": {
          "messages": [
            {
              "content": "=name the 3 most important technical keywords in {{ $json[\"content\"] }} ? just name them without any explanations or other sentences"
            }
          ]
        },
        "options": {},
        "resource": "chat"
      },
      "credentials": {
        "openAiApi": {
          "id": "0Vdk5RlVe7AoUdAM",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "0bfdb3be-76ef-4bb3-902f-f0869342b83c",
      "name": "Rename keywords",
      "type": "n8n-nodes-base.set",
      "position": [
        -700,
        620
      ],
      "parameters": {
        "fields": {
          "values": [
            {
              "name": "keywords",
              "stringValue": "={{ $json[\"message\"][\"content\"] }}"
            }
          ]
        },
        "include": "none",
        "options": {}
      },
      "typeVersion": 3.1
    },
    {
      "id": "0387cf34-41c9-4729-8570-1db7b17c42f4",
      "name": "Rename Summary",
      "type": "n8n-nodes-base.set",
      "position": [
        -700,
        440
      ],
      "parameters": {
        "fields": {
          "values": [
            {
              "name": "=summary",
              "stringValue": "={{ $json[\"message\"][\"content\"] }}"
            }
          ]
        },
        "include": "none",
        "options": {}
      },
      "typeVersion": 3.1
    },
    {
      "id": "5fa1702c-f0bf-4524-bc8f-6f550dd83f1e",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        -480,
        560
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combinationMode": "mergeByPosition"
      },
      "typeVersion": 2.1
    },
    {
      "id": "25128a71-b0d5-49a4-adb8-c3fbe03c0a85",
      "name": "Extract date",
      "type": "n8n-nodes-base.html",
      "position": [
        -500,
        -160
      ],
      "parameters": {
        "options": {},
        "operation": "extractHtmlContent",
        "extractionValues": {
          "values": [
            {
              "key": "data",
              "cssSelector": "div:nth-child(9) > div:nth-child(2) > span:nth-child(1)",
              "returnArray": true
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "138b3bd6-494a-49b9-b5b8-c9febcfef9fb",
      "name": "Select posts of last 7 days",
      "type": "n8n-nodes-base.code",
      "position": [
        120,
        0
      ],
      "parameters": {
        "jsCode": "const currentDate = new Date();\nconst sevenDaysAgo = new Date(currentDate.setDate(currentDate.getDate() - 70)); // Change the number of days going back to your liking (e.g. from -7 to -1) -> BUT sync with the cron job (first node)\n\nconst filteredItems = items.filter(item => {\n const postDate = new Date(item.json[\"Date\"]); // Assuming \"Date\" is the field name in the extracted html\n return postDate >= sevenDaysAgo;\n});\n\nreturn filteredItems;\n"
      },
      "typeVersion": 2
    },
    {
      "id": "1ace953b-e298-4fc2-8970-327f736889ec",
      "name": "Merge date & links",
      "type": "n8n-nodes-base.merge",
      "position": [
        -100,
        0
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combinationMode": "mergeByPosition"
      },
      "typeVersion": 2.1
    },
    {
      "id": "bba692fc-c225-41be-a969-179d8b99c071",
      "name": "HTTP Request1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        320,
        0
      ],
      "parameters": {
        "url": "={{ $json[\"Link\"] }}",
        "options": {}
      },
      "typeVersion": 4.1
    },
    {
      "id": "26671065-631f-4684-9ee1-15f26b4cf1e4",
      "name": "Merge Content with Date & Link",
      "type": "n8n-nodes-base.merge",
      "position": [
        500,
        260
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combinationMode": "mergeByPosition"
      },
      "typeVersion": 2.1
    },
    {
      "id": "79beb744-97b8-4072-824a-6736b0a080ef",
      "name": "Extract individual posts",
      "type": "n8n-nodes-base.html",
      "position": [
        500,
        0
      ],
      "parameters": {
        "options": {},
        "operation": "extractHtmlContent",
        "extractionValues": {
          "values": [
            {
              "key": "title",
              "cssSelector": "h1.fl-heading > span:nth-child(1)"
            },
            {
              "key": "content",
              "cssSelector": ".fl-node-5c7574ae7d5c6 > div:nth-child(1)"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e89d9de5-875b-453e-825a-26f2bebcc8df",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        80,
        -107
      ],
      "parameters": {
        "width": 180.9747474601832,
        "height": 276.31054308676767,
        "content": "Select only the newest news: todays date going back xy days"
      },
      "typeVersion": 1
    },
    {
      "id": "8a603f2f-4208-48c7-b169-e5613f13fa7d",
      "name": "Merge ChatGPT output with Date & Link",
      "type": "n8n-nodes-base.merge",
      "position": [
        -180,
        560
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combinationMode": "mergeByPosition"
      },
      "typeVersion": 2.1
    },
    {
      "id": "e1036421-9ce1-4121-a692-602410ec7c95",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "disabled": true,
      "position": [
        -539.7802584556148,
        -4.722020203185366
      ],
      "parameters": {
        "width": 182.2748213508401,
        "height": 304.2550759710132,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nExtracting the individual links of the press release page in order to retrieve the individual posts on their respective **url**"
      },
      "typeVersion": 1
    },
    {
      "id": "3655ab22-6a17-429a-9d9b-d96bbcc78fee",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -538.404803912782,
        -304
      ],
      "parameters": {
        "width": 178.75185894039254,
        "height": 289.463147786618,
        "content": "Extracting the dates of the posts of the press release page.\nThe right CSS selector has to be chosen.\n[More info on datagrab.io](https://datagrab.io/blog/guide-to-css-selectors-for-web-scraping/)"
      },
      "typeVersion": 1
    },
    {
      "id": "2e27fb4c-426a-41e1-b5fb-9b2d78acd2a7",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1300,
        -299.82161760751774
      ],
      "parameters": {
        "width": 334.4404040637068,
        "height": 1127.2017245821128,
        "content": "# Scraping posts of a news site without RSS feed\n\n\nThe [News Site](https://www.colt.net/resources/type/news/) from Colt, a telecom company, does not offer an RSS feed, therefore web scraping is the \nchoice to extract and process the news.\n\nThe goal is to get only the newest posts, a summary of each post and their respective (technical) keywords.\n\nNote that the news site offers the links to each news post, but not the individual news. We collect first the links and dates of each post before extracting the newest ones.\n\nThe result is sent to a SQL database, in this case a NocoDB database.\n\nThis process happens each week thru a cron job.\n\n**Requirements**:\n- Basic understanding of CSS selectors and how to get them via browser (usually: right click → inspect)\n- ChatGPT API account - normal account is not sufficient\n- A NocoDB database - of course you may choose any type of output target\n\n**Assumptions**:\n- CSS selectors work on the news site\n- The post has a date with own CSS selector - meaning date is not part of the news content\n\n**\"Warnings\"**\n- Not every site likes to be scraped, especially not in high frequency\n- Each website is structured in different ways, the workflow may then need several adaptations.\n\n\nHappy about any suggestion to improve. You may contact me on **Mastodon**: https://bonn.social/@askans"
      },
      "typeVersion": 1
    },
    {
      "id": "d43bd5b7-2aff-4a07-8aca-ca4747ec6c4d",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -927.8447474890202,
        -80
      ],
      "parameters": {
        "width": 153.90180146729315,
        "height": 237.91333335255808,
        "content": "Weekly cron job"
      },
      "typeVersion": 1
    },
    {
      "id": "e732d136-fcf1-4fc3-8bb6-bdcea3c78d9e",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -760,
        -80
      ],
      "parameters": {
        "width": 185.41515152389002,
        "height": 241.454848504947,
        "content": "The html of the news site is being retrieved: https://www.colt.net/resources/type/news/"
      },
      "typeVersion": 1
    },
    {
      "id": "d5e29ec3-5ef2-42f3-b316-9350644dbba4",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -340,
        -306
      ],
      "parameters": {
        "width": 187.3613302133812,
        "height": 469.2923233086395,
        "content": "As the extraction are returned as arrays, they transformed into individual JSON items to enable looping with other nodes"
      },
      "typeVersion": 1
    },
    {
      "id": "1af15c45-32c0-4abf-a35d-be7206823569",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -120,
        -103.54151515238902
      ],
      "parameters": {
        "width": 150,
        "height": 274.50898992724416,
        "content": "The links of the individual posts and the dates of the posts "
      },
      "typeVersion": 1
    },
    {
      "id": "f7c42748-f227-42d0-a9e2-fcb16dbd0f75",
      "name": "Retrieve the web page for further processsing",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -720,
        0
      ],
      "parameters": {
        "url": "https://www.colt.net/resources/type/news/",
        "options": {
          "response": {
            "response": {
              "responseFormat": "text"
            }
          }
        }
      },
      "typeVersion": 4.1
    },
    {
      "id": "b2c36f26-8221-478f-a4b0-22758b1e5e58",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        292,
        -100
      ],
      "parameters": {
        "width": 155.0036363426638,
        "height": 272.1479798256519,
        "content": "Get the html of each individual **newest** post"
      },
      "typeVersion": 1
    },
    {
      "id": "6ae05c31-c09a-4b4e-a013-41571937bc39",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        460,
        -100
      ],
      "parameters": {
        "width": 184.07417896879767,
        "height": 269.2504410842093,
        "content": "Extracting the title & content (text) of each individual news post with the right CSS selector"
      },
      "typeVersion": 1
    },
    {
      "id": "e2da76d4-0c8c-4c61-924f-50aa9387e9ab",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        460,
        180
      ],
      "parameters": {
        "width": 191.87778190338406,
        "height": 234.13422787857044,
        "content": "Merge link to url, date with content (text) and title of each news psot"
      },
      "typeVersion": 1
    },
    {
      "id": "c124aaac-dce6-4658-9027-bdfe5c0c81e6",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -907.2264215202996,
        331.0681740778203
      ],
      "parameters": {
        "width": 150,
        "height": 256.2444361932317,
        "content": "Create a summary of each news post with ChatGPT. You need a ChatGPT API account for this"
      },
      "typeVersion": 1
    },
    {
      "id": "c9037e74-007b-4e44-b7f9-90e78b853eb5",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -909.595196087218,
        610.7495589157902
      ],
      "parameters": {
        "width": 152.85976723045226,
        "height": 218.52702200939785,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\nGet the 3 keywords of each news post"
      },
      "typeVersion": 1
    },
    {
      "id": "756397d9-de80-4114-9dee-b4f4b9593333",
      "name": "Sticky Note14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -740,
        340
      ],
      "parameters": {
        "width": 182.7735784797001,
        "height": 489.05192374172555,
        "content": "Just a renaming of data fields and eliminating unnecessary ones"
      },
      "typeVersion": 1
    },
    {
      "id": "a0dcb254-f064-45ed-8e22-30a6d079085b",
      "name": "Sticky Note15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -520,
        480
      ],
      "parameters": {
        "width": 169.7675735887227,
        "height": 254.94383570413422,
        "content": "Merge summary and keywords of each news post"
      },
      "typeVersion": 1
    },
    {
      "id": "82993166-b273-4b82-a954-554c6892f825",
      "name": "Schedule Trigger each week",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -900,
        0
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks",
              "triggerAtDay": [
                3
              ],
              "triggerAtHour": 4,
              "triggerAtMinute": 32
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "3d670eb9-5a36-4cd9-8d2c-40adf848485e",
      "name": "Sticky Note16",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -220,
        477.5081090810816
      ],
      "parameters": {
        "width": 180.1723775015045,
        "height": 260.5279202647822,
        "content": "Add title, link and date to summary and keywords of each news post"
      },
      "typeVersion": 1
    },
    {
      "id": "62021393-e988-4834-9fa2-75a957b42890",
      "name": "NocoDB news database",
      "type": "n8n-nodes-base.nocoDb",
      "position": [
        60,
        560
      ],
      "parameters": {
        "table": "mhbalmu9aaqcun6",
        "fieldsUi": {
          "fieldValues": [
            {
              "fieldName": "=News_Source",
              "fieldValue": "=Colt"
            },
            {
              "fieldName": "Title",
              "fieldValue": "={{ $json[\"title\"] }}"
            },
            {
              "fieldName": "Date",
              "fieldValue": "={{ $json[\"Date\"] }}"
            },
            {
              "fieldName": "Link",
              "fieldValue": "={{ $json[\"Link\"] }}"
            },
            {
              "fieldName": "Summary",
              "fieldValue": "={{ $json[\"summary\"] }}"
            },
            {
              "fieldName": "Keywords",
              "fieldValue": "={{ $json[\"keywords\"] }}"
            }
          ]
        },
        "operation": "create",
        "projectId": "prqu4e8bjj4bv1j",
        "authentication": "nocoDbApiToken"
      },
      "credentials": {
        "nocoDbApiToken": {
          "id": "gjNns0VJMS3P2RQ3",
          "name": "NocoDB Token account"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "e59e9fab-10a7-470b-afa6-e1d4b4e57723",
      "name": "Sticky Note17",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        280,
        480
      ],
      "parameters": {
        "width": 483.95825869942666,
        "height": 268.5678114630957,
        "content": "## News summaries and keywords → database\n\n[NocoDB](https://nocodb.com/) is an SQL database, here we store the news summaries and keywords for further processing. Any other output target can be chosen here, e.g. e-mail, Excel etc.\n\nYou need first have that database structured before appending the news summaries and additional fields. The you can shape this node.\n\nSome fields may be edited in the database itself (e.g. relevance of the news to you) and may be filled therefore with a default value or not at all"
      },
      "typeVersion": 1
    },
    {
      "id": "253b414b-9a5b-4a25-892b-9aa011d55d28",
      "name": "Sticky Note18",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        20,
        480
      ],
      "parameters": {
        "width": 262.99083066277313,
        "height": 268.56781146309544,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "438e8dde-ce0a-4e5e-8d62-d735d19ec189",
      "name": "Create single link items",
      "type": "n8n-nodes-base.itemLists",
      "position": [
        -300,
        0
      ],
      "parameters": {
        "options": {
          "destinationFieldName": "Link"
        },
        "fieldToSplitOut": "data"
      },
      "typeVersion": 3
    },
    {
      "id": "d721776b-fefc-4e72-91ef-6710f10b0393",
      "name": "Create single date items",
      "type": "n8n-nodes-base.itemLists",
      "position": [
        -300,
        -160
      ],
      "parameters": {
        "options": {
          "destinationFieldName": "Date"
        },
        "fieldToSplitOut": "data"
      },
      "typeVersion": 3
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "ff89d802-3bcf-4b34-9cd9-776b1f3b5eab",
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Merge ChatGPT output with Date & Link",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Summary": {
      "main": [
        [
          {
            "node": "Rename Summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Keywords": {
      "main": [
        [
          {
            "node": "Rename keywords",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract date": {
      "main": [
        [
          {
            "node": "Create single date items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request1": {
      "main": [
        [
          {
            "node": "Extract individual posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Rename Summary": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Rename keywords": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Merge date & links": {
      "main": [
        [
          {
            "node": "Select posts of last 7 days",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create single date items": {
      "main": [
        [
          {
            "node": "Merge date & links",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create single link items": {
      "main": [
        [
          {
            "node": "Merge date & links",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Extract individual posts": {
      "main": [
        [
          {
            "node": "Merge Content with Date & Link",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger each week": {
      "main": [
        [
          {
            "node": "Retrieve the web page for further processsing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Select posts of last 7 days": {
      "main": [
        [
          {
            "node": "Merge Content with Date & Link",
            "type": "main",
            "index": 1
          },
          {
            "node": "HTTP Request1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Content with Date & Link": {
      "main": [
        [
          {
            "node": "Summary",
            "type": "main",
            "index": 0
          },
          {
            "node": "Keywords",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge ChatGPT output with Date & Link",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge ChatGPT output with Date & Link": {
      "main": [
        [
          {
            "node": "NocoDB news database",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract the HTML with the right css class": {
      "main": [
        [
          {
            "node": "Create single link items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Retrieve the web page for further processsing": {
      "main": [
        [
          {
            "node": "Extract the HTML with the right css class",
            "type": "main",
            "index": 0
          },
          {
            "node": "Extract date",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
```