{
"name": "My workflow 14",
"nodes": [
{
"parameters": {
"content": "# 📚 [Join our Skool community for support, premium content and more!](https://www.skool.com/ai-agents-az/about?w5)\n\n## Be part of a growing community and help us create more content like this",
"height": 220,
"width": 860,
"color": 6
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [140, -580],
"id": "44f740f1-7849-4d41-bf55-57bb89ad4c08",
"name": "Sticky Note6"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "5c28393f-6e8b-425b-babb-22eac9ad7238",
"name": "GOOGLE_API_KEY",
"value": "YOUR_GOOGLE_API_KEY_COMES_HERE",
"type": "string"
},
{
"id": "7f935132-6cb7-43a4-ae87-77336bd2cf82",
"name": "GOOGLE_CUSTOM_SEARCH",
"value": "YOUR_CUSTOM_SEARCH_ID_COMES_HERE",
"type": "string"
},
{
"id": "a848bf0c-0a5f-4acc-9412-aebd93c84380",
"name": "top_results",
"value": "={{ $json.top_results ?? 3 }}",
"type": "number"
},
{
"id": "c52bbef3-c0a6-4017-a403-abaaee216895",
"name": "context",
"value": "={{ $json.context }}",
"type": "string"
},
{
"id": "ae883a9e-7207-48ef-ad1f-9c86076e0308",
"name": "num_search_terms",
"value": "={{ $json.num_search_terms ?? 2 }}",
"type": "number"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [460, 180],
"id": "c726eafd-e10e-4432-a181-fcfdb62fdf93",
"name": "configuration"
},
{
"parameters": {
"schemaType": "manual",
"inputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"search_terms\": {\n \"type\": \"array\",\n \"description\": \"the google search terms\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n },\n \"required\": [\n \"search_terms\"\n ]\n}"
},
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"typeVersion": 1.2,
"position": [1000, 480],
"id": "f543a741-6965-4731-b571-aaf23e80c373",
"name": "Structured Output Parser"
},
{
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"typeVersion": 1.2,
"position": [2300, 680],
"id": "93a4e9a3-0783-42b6-9318-803e6a9db189",
"name": "OpenAI Chat Model",
"credentials": {
"openAiApi": {
"id": "9z2BF40dqIRV3ovL",
"name": "OpenAI"
}
}
},
{
"parameters": {
"fieldToSplitOut": "output.search_terms",
"options": {}
},
"type": "n8n-nodes-base.splitOut",
"typeVersion": 1,
"position": [1140, 180],
"id": "a79baa65-07dd-4775-b9f3-87561a92ec86",
"name": "Split Out"
},
{
"parameters": {
"fieldToSplitOut": "items",
"options": {}
},
"type": "n8n-nodes-base.splitOut",
"typeVersion": 1,
"position": [1580, 180],
"id": "5a8bef14-bad0-44bc-9765-cfadf11db3b3",
"name": "Split Out1"
},
{
"parameters": {
"operation": "extractHtmlContent",
"extractionValues": {
"values": [
{
"key": "data",
"cssSelector": "body",
"returnValue": "html"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.html",
"typeVersion": 1.2,
"position": [2460, 180],
"id": "5bd5a40d-8621-4c51-8e48-8dd06a1e0c3d",
"name": "HTML"
},
{
"parameters": {
"html": "={{ $json.data }}",
"options": {}
},
"type": "n8n-nodes-base.markdown",
"typeVersion": 1,
"position": [2680, 180],
"id": "8b241cdd-87a4-4eeb-9143-aaaf192c70f7",
"name": "Markdown"
},
{
"parameters": {
"schemaType": "manual",
"inputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"summary\": {\n \"type\": \"string\",\n \"description\": \"the summary of the content\"\n }\n },\n \"required\": [\n \"summary\"\n ]\n}"
},
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"typeVersion": 1.2,
"position": [3400, 540],
"id": "f42c7aee-2677-44dd-9453-7259235566b4",
"name": "Structured Output Parser1"
},
{
"parameters": {
"schemaType": "manual",
"inputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"relevant_to_context\": {\n \"type\": \"boolean\",\n \"description\": \"whether the researched content is relevant to the context\"\n }\n },\n \"required\": [\n \"relevant_to_article\"\n ]\n}"
},
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"typeVersion": 1.2,
"position": [3820, 520],
"id": "2833beb2-d1d7-419f-a627-19d8782e6185",
"name": "Structured Output Parser2"
},
{
"parameters": {
"aggregate": "aggregateAllItemData",
"destinationFieldName": "research_results",
"options": {}
},
"type": "n8n-nodes-base.aggregate",
"typeVersion": 1,
"position": [4500, 180],
"id": "88af4588-9c17-4f36-b643-f9bcc096b52c",
"name": "Aggregate"
},
{
"parameters": {
"workflowInputs": {
"values": [
{
"name": "top_results",
"type": "number"
},
{
"name": "context"
},
{
"name": "num_search_terms",
"type": "number"
}
]
}
},
"type": "n8n-nodes-base.executeWorkflowTrigger",
"typeVersion": 1.1,
"position": [140, 180],
"id": "afef74a8-211a-4611-b5ae-82db73065511",
"name": "When Executed by Another Workflow"
},
{
"parameters": {
"content": "# Configure\n\n- Google API key\n- Google custom search id",
"height": 400,
"color": 3
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [400, 0],
"id": "22befa61-ae21-4ab0-993d-bb0eccf250d2",
"name": "Sticky Note"
},
{
"parameters": {
"content": "# Google programmable search documentation\n\nhttps://developers.google.com/custom-search/v1/using_rest\nhttps://programmablesearchengine.google.com/controlpanel/all",
"height": 200,
"width": 620
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [140, -260],
"id": "aa5a02f9-a91e-4210-9cd1-8016fd6de74a",
"name": "Sticky Note2"
},
{
"parameters": {
"promptType": "define",
"text": "=<Context>\n{{ $json.context }}\n</Context>\n\n<Instructions>\nI want to run a research on Google on the context above. \nHelp me to come up with search terms I can use.\nI need exactly {{ $json.num_search_terms }} search term(s) - no more no less. \nMake sure to be creative, and give me different ones so I can get diverse search results.\n</Instructions>",
"hasOutputParser": true
},
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"typeVersion": 1.5,
"position": [780, 180],
"id": "896e1783-943a-4da7-a857-8636cc4c94c8",
"name": "create search terms"
},
{
"parameters": {
"url": "https://www.googleapis.com/customsearch/v1",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "key",
"value": "={{ $('configuration').item.json.GOOGLE_API_KEY }}"
},
{
"name": "cx",
"value": "={{ $('configuration').item.json.GOOGLE_CUSTOM_SEARCH }}"
},
{
"name": "q",
"value": "={{ $json['output.search_terms'] }}"
},
{
"name": "num",
"value": "={{ $('configuration').item.json.top_results }}"
},
{
"name": "siteSearch",
"value": "reddit.com"
},
{
"name": "siteSearchFilter",
"value": "e"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [1360, 180],
"id": "a343f52e-6c78-4ac5-a207-634e982c9ce9",
"name": "search on Google",
"retryOnFail": true
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "c18ff56b-39fa-477c-a48d-bc65ad0a510d",
"leftValue": "={{ $json.mime }}",
"rightValue": "",
"operator": {
"type": "string",
"operation": "notExists",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.filter",
"typeVersion": 2.2,
"position": [1800, 180],
"id": "13a7abf6-a018-4273-b39b-9ddf3e9865d6",
"name": "remove documents"
},
{
"parameters": {
"url": "={{ $json.link }}",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "user-agent",
"value": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [2020, 180],
"id": "55df3d86-881f-451a-abcc-9295dd6bcc8a",
"name": "get the content of the link",
"retryOnFail": false,
"onError": "continueErrorOutput"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "99cf6ac1-d77b-491c-86dc-44555032f5b0",
"leftValue": "={{ $json.error }}",
"rightValue": "",
"operator": {
"type": "object",
"operation": "notExists",
"singleValue": true
}
},
{
"id": "e6dd1301-acb8-4dc4-83d0-4d5b1a7f2036",
"leftValue": "={{ $json.data }}",
"rightValue": "",
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.filter",
"typeVersion": 2.2,
"position": [2240, 180],
"id": "f8405506-3b86-45a9-8f2d-7505dbc609c3",
"name": "filter out the errors"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "e70a34f7-b723-47fe-a62f-1a318c483959",
"leftValue": "={{ $json.data }}",
"rightValue": "",
"operator": {
"type": "string",
"operation": "notEmpty",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.filter",
"typeVersion": 2.2,
"position": [2900, 180],
"id": "cef9cf56-b5c2-491d-ab5d-14866010e03b",
"name": "filter empty results"
},
{
"parameters": {
"jsCode": "for (const item of $input.all()) {\n item.json.data = item.json.data.replace(/!\\[[^\\]]+\\]\\([^\\)]+\\)/g, \"\") // remove images\n item.json.data = item.json.data.replace(/\\[.*?\\]\\(.*?\\)/g, \"\") // remove links\n item.json.data = item.json.data.replace(/\\n{2,}/g, \"\") // remove extra new line characters\n}\n\nreturn $input.all();"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [3120, 180],
"id": "8f709a64-f739-4293-b352-ac6f232c5972",
"name": "cleanup the markdown"
},
{
"parameters": {
"promptType": "define",
"text": "=I've collected research content using Google search.\n\nRead the research content, and analyze whether it is relevant to the context below.\nMake sure it's also useful, and contains relevant information for my context.\n\n<Context>\n{{ $('configuration').item.json.context }}\n</Context>\n\n<ResearchContentSummary>\n{{ $json.output.summary }}\n</ResearchContentSummary>",
"hasOutputParser": true
},
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"typeVersion": 1.5,
"position": [3700, 180],
"id": "576c221c-d49a-49de-a077-70a7b24e8729",
"name": "is it relevant?",
"retryOnFail": true
},
{
"parameters": {
"promptType": "define",
"text": "=Please summarize the following content for me. Make sure to capture all the information in a concise format. Don't miss anything important.\nIgnore generic website elements like cookie policies, etc.\n\n<Content>\n{{ $json.data }}\n</Content>",
"hasOutputParser": true
},
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"typeVersion": 1.5,
"position": [3340, 180],
"id": "019a7aa7-29f6-4630-a3e2-73b9daa53546",
"name": "summarize",
"retryOnFail": true
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "a72e5161-9b19-45fb-bb4f-5ae28d3da266",
"leftValue": "={{ $json.output.relevant_to_context }}",
"rightValue": "",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.filter",
"typeVersion": 2.2,
"position": [4060, 180],
"id": "9a0a1023-df88-4892-a593-dcb00ed662d7",
"name": "filter irrelevant"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "53e16d12-8a90-4cf8-85e2-6aa2ef2ae3af",
"name": "summary",
"value": "={{ $('summarize').item.json.output.summary }}",
"type": "string"
},
{
"id": "1ca9f5a5-0e9a-47e6-9fef-079367dc4769",
"name": "title",
"value": "={{ $('remove documents').item.json.title }}",
"type": "string"
},
{
"id": "11c33d6b-d23c-4bc6-9003-b8ca022b3ada",
"name": "link",
"value": "={{ $('remove documents').item.json.link }}",
"type": "string"
},
{
"id": "eea8547b-2e21-4b71-a9dc-74639d658485",
"name": "snippet",
"value": "={{ $('remove documents').item.json.snippet }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [4280, 180],
"id": "a337f615-c5c3-4556-b0d6-b792cebedded",
"name": "set fields to return"
},
{
"parameters": {
"content": "# You can replace OpenAI with Ollama!",
"height": 320,
"width": 420
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [2160, 520],
"id": "a5544ca2-98f7-48f1-915b-f1e09952c610",
"name": "Sticky Note1"
}
],
"pinData": {},
"connections": {
"configuration": {
"main": [
[
{
"node": "create search terms",
"type": "main",
"index": 0
}
]
]
},
"Structured Output Parser": {
"ai_outputParser": [
[
{
"node": "create search terms",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "create search terms",
"type": "ai_languageModel",
"index": 0
},
{
"node": "summarize",
"type": "ai_languageModel",
"index": 0
},
{
"node": "is it relevant?",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Split Out": {
"main": [
[
{
"node": "search on Google",
"type": "main",
"index": 0
}
]
]
},
"Split Out1": {
"main": [
[
{
"node": "remove documents",
"type": "main",
"index": 0
}
]
]
},
"HTML": {
"main": [
[
{
"node": "Markdown",
"type": "main",
"index": 0
}
]
]
},
"Markdown": {
"main": [
[
{
"node": "filter empty results",
"type": "main",
"index": 0
}
]
]
},
"Structured Output Parser1": {
"ai_outputParser": [
[
{
"node": "summarize",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"Structured Output Parser2": {
"ai_outputParser": [
[
{
"node": "is it relevant?",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"When Executed by Another Workflow": {
"main": [
[
{
"node": "configuration",
"type": "main",
"index": 0
}
]
]
},
"create search terms": {
"main": [
[
{
"node": "Split Out",
"type": "main",
"index": 0
}
]
]
},
"search on Google": {
"main": [
[
{
"node": "Split Out1",
"type": "main",
"index": 0
}
]
]
},
"remove documents": {
"main": [
[
{
"node": "get the content of the link",
"type": "main",
"index": 0
}
]
]
},
"get the content of the link": {
"main": [
[
{
"node": "filter out the errors",
"type": "main",
"index": 0
}
]
]
},
"filter out the errors": {
"main": [
[
{
"node": "HTML",
"type": "main",
"index": 0
}
]
]
},
"filter empty results": {
"main": [
[
{
"node": "cleanup the markdown",
"type": "main",
"index": 0
}
]
]
},
"cleanup the markdown": {
"main": [
[
{
"node": "summarize",
"type": "main",
"index": 0
}
]
]
},
"is it relevant?": {
"main": [
[
{
"node": "filter irrelevant",
"type": "main",
"index": 0
}
]
]
},
"summarize": {
"main": [
[
{
"node": "is it relevant?",
"type": "main",
"index": 0
}
]
]
},
"filter irrelevant": {
"main": [
[
{
"node": "set fields to return",
"type": "main",
"index": 0
}
]
]
},
"set fields to return": {
"main": [
[
{
"node": "Aggregate",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "fbb39ad4-0234-4e49-a5a2-98965fe25683",
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "636db6b6ab21a21c6458e2137f340e33dc3e49f5a1c560c8d1e2372c227cf40e"
},
"id": "ucEHSGg73IPzhX1n",
"tags": []
}