{"id": "SHgOqN3ednIo5gNu", "name": "Find Top Keywords", "nodes": [{"id": "386c7972-34c2-4f51-9329-dee7f6a7511b", "name": "When clicking ‘Test workflow’", "type": "n8n-nodes-base.manualTrigger", "position": [-3440, 760], "parameters": {}, "typeVersion": 1}, {"id": "3ebf40fd-acfd-4424-99c9-95ddaac74de3", "name": "Schedule Trigger", "type": "n8n-nodes-base.scheduleTrigger", "position": [-3440, 1040], "parameters": {"rule": {"interval": [{"field": "cronExpression", "expression": "0 */4 * * *"}]}}, "typeVersion": 1.2}, {"id": "a24af92b-849d-48ee-aedd-6c7e75d9c902", "name": "Gen Time", "type": "n8n-nodes-base.code", "position": [-3160, 940], "parameters": {"jsCode": "// Get today's date\nconst today = new Date();\n\n// Subtract one day to get the previous day\nconst yesterday = new Date(today);\nyesterday.setDate(today.getDate() - 1);\n\n// Format the date as yyyy-mm-dd\nconst year = yesterday.getFullYear();\nconst month = String(yesterday.getMonth() + 1).padStart(2, '0'); // Month is zero-indexed\nconst day = String(yesterday.getDate()).padStart(2, '0');\n\nconst formattedDate = `${year}-${month}-${day}`;\n\n// Set the formatted date to be used in a later node\nreturn [{ json: { previousDay: formattedDate } }];"}, "typeVersion": 2}, {"id": "f0807e09-1f8f-45ba-a6d3-d14ee3f96a9f", "name": "Sticky Note", "type": "n8n-nodes-base.stickyNote", "position": [-3540, 600], "parameters": {"width": 520, "height": 780, "content": "## Create time for yesterday and today. This will be used to gather and search for news articles within a specific range."}, "typeVersion": 1}, {"id": "c97b391b-1da1-4c62-9394-e83a49dae788", "name": "Sticky Note1", "type": "n8n-nodes-base.stickyNote", "position": [-3020, 600], "parameters": {"color": 4, "width": 280, "height": 780, "content": "## Grab a list of base keywords from NocoDB"}, "typeVersion": 1}, {"id": "21e89f1c-7101-490a-89aa-a5a52e10d88a", "name": "Sticky Note2", "type": "n8n-nodes-base.stickyNote", "position": [-2740, 600], "parameters": {"width": 380, "height": 780, "content": "## Generate YouTube and Google Keywords from base keywords"}, "typeVersion": 1}, {"id": "3b6e8b0e-dfdc-41d0-a387-00872c92faa1", "name": "NocoDB", "type": "n8n-nodes-base.nocoDb", "position": [-2940, 940], "parameters": {"table": "mztryza8davdl48", "options": {"fields": ["keyword"]}, "operation": "getAll", "projectId": "pbwiwe87uf1cpgc", "returnAll": true, "authentication": "nocoDbApiToken"}, "credentials": {"nocoDbApiToken": {"id": "LAbGsn1RMARiq5Gy", "name": "NocoDB Token account"}}, "typeVersion": 3}, {"id": "fef9283e-886a-486b-a51f-0f459f4b18e0", "name": "Second Order Google Autocomplete Keywords", "type": "n8n-nodes-base.httpRequest", "position": [-2620, 800], "parameters": {"url": "http://192.168.1.110:8000/google-search/autocomplete-keywords", "options": {}, "sendQuery": true, "sendHeaders": true, "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "queryParameters": {"parameters": [{"name": "input_keyword", "value": "={{ $('NocoDB').item.json.keyword }}"}, {"name": "input_country", "value": "US"}, {"name": "use_proxy", "value": "true"}, {"name": "output", "value": "toolbar"}, {"name": "spell", "value": "1"}, {"name": "hl", "value": "en"}]}, "headerParameters": {"parameters": [{"name": "accept", "value": "application/json"}]}}, "credentials": {"httpHeaderAuth": {"id": "eNOOug9ODsbtfjBk", "name": "Social Flood API Key Local"}}, "executeOnce": false, "typeVersion": 4.2}, {"id": "fad88d1e-a14e-4cc1-9ac1-dcc6126355c4", "name": "Google Search Volume", "type": "n8n-nodes-base.httpRequest", "position": [-2020, 800], "parameters": {"url": "https://api.dataforseo.com/v3/keywords_data/google_ads/search_volume/live", "method": "POST", "options": {}, "jsonBody": "=[\n {\n \"location_code\": 2840,\n \"language_code\": \"en\",\n \"keywords\": [{{ $json.keywords }}],\n \"date_from\": \"2021-08-01\",\n \"search_partners\": false \n }\n]", "sendBody": true, "specifyBody": "json", "authentication": "genericCredentialType", "genericAuthType": "httpBasicAuth"}, "credentials": {"httpBasicAuth": {"id": "7k7huetjBCcDO7uR", "name": "Data for SEO Basic Auth"}}, "executeOnce": false, "typeVersion": 4.2}, {"id": "dac54baa-6166-4fb6-a705-a45a91b993ed", "name": "Sticky Note3", "type": "n8n-nodes-base.stickyNote", "position": [-2360, 600], "parameters": {"color": 4, "width": 500, "height": 780, "content": "## Query YouTube and Google Keyword search volume."}, "typeVersion": 1}, {"id": "753401aa-c78e-4dd1-b47f-b774bed8a6ce", "name": "Split Out Google Search", "type": "n8n-nodes-base.splitOut", "position": [-1740, 800], "parameters": {"options": {}, "fieldToSplitOut": "tasks[0].result"}, "executeOnce": false, "typeVersion": 1}, {"id": "12f53197-a03e-4862-a6cf-d4feffd49b29", "name": "YouTube Search Volume", "type": "n8n-nodes-base.httpRequest", "position": [-2020, 1120], "parameters": {"url": "https://api.dataforseo.com/v3/keywords_data/google_ads/search_volume/live", "method": "POST", "options": {}, "jsonBody": "=[\n {\n \"location_code\": 2840,\n \"language_code\": \"en\",\n \"keywords\": [{{ $json.keywords }}],\n \"date_from\": \"2021-08-01\",\n \"search_partners\": true,\n \"sort_by\": \"search_volume\"\n }\n]", "sendBody": true, "specifyBody": "json", "authentication": "genericCredentialType", "genericAuthType": "httpBasicAuth"}, "credentials": {"httpBasicAuth": {"id": "7k7huetjBCcDO7uR", "name": "Data for SEO Basic Auth"}}, "executeOnce": false, "typeVersion": 4.2}, {"id": "d0173c03-c803-4c64-9c87-48a47952085f", "name": "Second Order YouTube Autocomplete Keywords", "type": "n8n-nodes-base.httpRequest", "position": [-2620, 1120], "parameters": {"url": "http://192.168.1.110:8000/google-search/autocomplete-keywords", "options": {"redirect": {"redirect": {}}}, "sendQuery": true, "sendHeaders": true, "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "queryParameters": {"parameters": [{"name": "input_keyword", "value": "={{ $json.keyword }}"}, {"name": "input_country", "value": "US"}, {"name": "use_proxy", "value": "true"}, {"name": "output", "value": "toolbar"}, {"name": "spell", "value": "1"}, {"name": "hl", "value": "en"}, {"name": "ds", "value": "yt"}]}, "headerParameters": {"parameters": [{"name": "accept", "value": "application/json"}]}}, "credentials": {"httpHeaderAuth": {"id": "eNOOug9ODsbtfjBk", "name": "Social Flood API Key Local"}}, "executeOnce": false, "typeVersion": 4.2}, {"id": "dfa987d0-c18c-44c4-9796-942404f49630", "name": "Split Out YT Search", "type": "n8n-nodes-base.splitOut", "position": [-1740, 1120], "parameters": {"options": {}, "fieldToSplitOut": "tasks[0].result"}, "executeOnce": false, "typeVersion": 1}, {"id": "29196a5b-c46e-46f7-99ff-781a0d97c551", "name": "Google Filter", "type": "n8n-nodes-base.filter", "position": [-1520, 800], "parameters": {"options": {}, "conditions": {"options": {"version": 2, "leftValue": "", "caseSensitive": true, "typeValidation": "strict"}, "combinator": "and", "conditions": [{"id": "6e46fa28-2adf-47a0-bbf3-7a9b8b8413f7", "operator": {"type": "array", "operation": "exists", "singleValue": true}, "leftValue": "={{ $json.monthly_searches }}", "rightValue": ""}, {"id": "45bca7c3-eac2-44e8-9993-b53200174003", "operator": {"type": "number", "operation": "exists", "singleValue": true}, "leftValue": "={{ $json.cpc }}", "rightValue": ""}]}}, "typeVersion": 2.2}, {"id": "6b11b8e2-d6fb-45d7-817e-3e1038068696", "name": "YT Filter", "type": "n8n-nodes-base.filter", "position": [-1520, 1120], "parameters": {"options": {}, "conditions": {"options": {"version": 2, "leftValue": "", "caseSensitive": true, "typeValidation": "strict"}, "combinator": "and", "conditions": [{"id": "6e46fa28-2adf-47a0-bbf3-7a9b8b8413f7", "operator": {"type": "array", "operation": "exists", "singleValue": true}, "leftValue": "={{ $json.monthly_searches }}", "rightValue": ""}, {"id": "45bca7c3-eac2-44e8-9993-b53200174003", "operator": {"type": "number", "operation": "exists", "singleValue": true}, "leftValue": "={{ $json.cpc }}", "rightValue": ""}]}}, "typeVersion": 2.2}, {"id": "6d52836b-ce37-46c0-aa4b-7c2b917b9f1d", "name": "Add Second Tier YT Keyword Data", "type": "n8n-nodes-base.nocoDb", "position": [-440, 980], "parameters": {"table": "m8bp2fnwtqsd2m7", "fieldsUi": {"fieldValues": [{"fieldName": "=keyword", "fieldValue": "={{ $('Split Out YT Search').item.json.keyword }}"}, {"fieldName": "location_code", "fieldValue": "={{ $('Split Out YT Search').item.json.location_code }}"}, {"fieldName": "language_code", "fieldValue": "={{ $('Split Out YT Search').item.json.language_code }}"}, {"fieldName": "search_partners", "fieldValue": "={{ $('Split Out YT Search').item.json.search_partners }}"}, {"fieldName": "competition", "fieldValue": "={{ $('Split Out YT Search').item.json.competition }}"}, {"fieldName": "competition_index", "fieldValue": "={{ $('Split Out YT Search').item.json.competition_index }}"}, {"fieldName": "cpc", "fieldValue": "={{ $('Split Out YT Search').item.json.cpc }}"}, {"fieldName": "low_top_of_page_bid", "fieldValue": "={{ $('Split Out YT Search').item.json.low_top_of_page_bid }}"}, {"fieldName": "high_top_of_page_bid", "fieldValue": "={{ $('Split Out YT Search').item.json.high_top_of_page_bid }}"}, {"fieldName": "search_volume", "fieldValue": "={{ $('Split Out YT Search').item.json.search_volume }}"}]}, "operation": "create", "projectId": "pbwiwe87uf1cpgc", "authentication": "nocoDbApiToken"}, "credentials": {"nocoDbApiToken": {"id": "LAbGsn1RMARiq5Gy", "name": "NocoDB Token account"}}, "executeOnce": false, "retryOnFail": true, "typeVersion": 3}, {"id": "d4a72c2b-8c16-4f3e-80ad-1564ec8b33d4", "name": "Add Second Tier G Keyword Data", "type": "n8n-nodes-base.nocoDb", "position": [-440, 400], "parameters": {"table": "mjmbcomto18scyi", "fieldsUi": {"fieldValues": [{"fieldName": "=keyword", "fieldValue": "={{ $('Split Out Google Search').item.json.keyword }}"}, {"fieldName": "location_code", "fieldValue": "={{ $('Split Out Google Search').item.json.location_code }}"}, {"fieldName": "language_code", "fieldValue": "={{ $('Split Out Google Search').item.json.language_code }}"}, {"fieldName": "search_partners", "fieldValue": "={{ $('Split Out Google Search').item.json.search_partners }}"}, {"fieldName": "competition", "fieldValue": "={{ $('Split Out Google Search').item.json.competition }}"}, {"fieldName": "competition_index", "fieldValue": "={{ $('Split Out Google Search').item.json.competition_index }}"}, {"fieldName": "cpc", "fieldValue": "={{ $('Split Out Google Search').item.json.cpc }}"}, {"fieldName": "low_top_of_page_bid", "fieldValue": "={{ $('Split Out Google Search').item.json.low_top_of_page_bid }}"}, {"fieldName": "high_top_of_page_bid", "fieldValue": "={{ $('Split Out Google Search').item.json.high_top_of_page_bid }}"}, {"fieldName": "search_volume", "fieldValue": "={{ $('Split Out Google Search').item.json.search_volume }}"}]}, "operation": "create", "projectId": "pbwiwe87uf1cpgc", "authentication": "nocoDbApiToken"}, "credentials": {"nocoDbApiToken": {"id": "LAbGsn1RMARiq5Gy", "name": "NocoDB Token account"}}, "executeOnce": false, "retryOnFail": true, "typeVersion": 3}, {"id": "1fdaf0fc-5c11-406f-93fb-b4a7fd3b6eed", "name": "Format G Data", "type": "n8n-nodes-base.code", "position": [-240, 400], "parameters": {"jsCode": "// Get the monthly search data from the \"Loop Over Google Keywords\" node\nconst loopData = $node[\"Loop Over Google Keywords\"].json;\nif (!loopData