{
  "id": "GfM7GUjkno6Qd7He",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Decodo Content Analysis",
  "tags": [],
  "nodes": [
    {
      "id": "166af299-ded1-4c36-9a23-9bda5b558123",
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -944,
        16
      ],
      "parameters": {
        "options": {},
        "formTitle": "Web Competitor Analysis",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Brand",
              "requiredField": true
            },
            {
              "fieldLabel": "Brand Competitor",
              "placeholder": "e.g samsung",
              "requiredField": true
            }
          ]
        },
        "formDescription": "Please input your brand competitor"
      },
      "typeVersion": 2.3
    },
    {
      "id": "f281a187-d61a-43a7-9539-e79446e24f55",
      "name": "Append row in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2064,
        80
      ],
      "parameters": {
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultUrl": "",
          "cachedResultName": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "ff83a9a1-b33a-4056-8100-c895ca86410b",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1584,
        -256
      ],
      "parameters": {
        "width": 320,
        "height": 240,
        "content": "### AI Analysis\n\n- Gemini generates key points and takeaways of comparison from the cleaned content\n- Structured Output Parser ensures clean, sheet-ready output"
      },
      "typeVersion": 1
    },
    {
      "id": "478d2ab2-edc1-4aef-a20d-61c374fa15bf",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1600,
        -736
      ],
      "parameters": {
        "width": 624,
        "height": 848,
        "content": "## Analyze brand competitors using Decodo, Gemini, Telegram, and Google Sheets\n\nThis workflow helps you compare a brand and its competitor by automatically finding, extracting, and analyzing relevant web content. It is designed for competitor research, market analysis, and content intelligence without manual browsing or copy-pasting.\n\n## How it works\n- Submit a brand name and a competitor through a simple form.\n- Decodo runs Google searches for each brand to find relevant review and comparison pages.\n- The workflow selects top organic results and extracts full page content.\n- HTML is cleaned and converted into readable text.\n- Gemini analyzes both sources together and generates structured key points and comparison takeaways.\n- Results are saved to Google Sheets and shared to Telegram for quick visibility.\n\n## Setup steps\n- Add your Decodo API credentials to enable search and extraction.\n- Connect your Google Gemini API credentials for AI analysis.\n- Link Google Sheets OAuth to store results.\n- (Optional) Connect Telegram for notifications.\n- Submit a brand and competitor to run the workflow."
      },
      "typeVersion": 1
    },
    {
      "id": "c0fb9e90-6b06-4027-b458-c7193c51ecaf",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -752,
        -256
      ],
      "parameters": {
        "color": 7,
        "width": 352,
        "height": 240,
        "content": "### Brand & Competitor Search\n\n- Uses Decodo Google Search to find top review and comparison pages  \n- Runs separate searches for the brand and its competitor  \n- Selects the most relevant organic result for each  \n- Outputs clean URLs for downstream content extraction and analysis  "
      },
      "typeVersion": 1
    },
    {
      "id": "c1a74e53-8181-4adf-a203-536cfe484eab",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        -400
      ],
      "parameters": {
        "color": 7,
        "width": 1360,
        "height": 800,
        "content": "### Content Extraction\n\n- Decodo fetches the page for brand and competitor\n- HTML node extracts readable text from the page\n- Merge all the inputs become one output to cleaning the HTML content.\n- JavaScript cleans HTML tags and line breaks"
      },
      "typeVersion": 1
    },
    {
      "id": "253028a9-02ff-4bd9-85b0-582291e3e9a0",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1952,
        368
      ],
      "parameters": {
        "jsonSchemaExample": "{\n\t\"keypoints\": \"1. keypoint \\n\\n 2. keypoint \\n\\n\",\n\t\"takeaways\": \"1. takeaway \\n\\n 2. takeaway \\n\\n\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "21f80cbc-d393-4d42-9204-cdc6da699c52",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        1376,
        336
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f78f6fd5-d4c1-457b-b3ea-219be8f3be89",
      "name": "Construct Data",
      "type": "n8n-nodes-base.code",
      "position": [
        1104,
        80
      ],
      "parameters": {
        "jsCode": "const strCompetitor = $input.first().json.dataBrand.replace(/(<([^>]+)>)/gi, \"\").replace(/(\\r\\n|\\n|\\r)/gm, \"\")\n\nconst brand = $input.first().json.dataCompetitor.replace(/(<([^>]+)>)/gi, \"\").replace(/(\\r\\n|\\n|\\r)/gm, \"\")\n\nreturn {\n  strCompetitor,\n  brand\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "b7cb00f2-4658-45d9-ab4b-c02c2a7b61b0",
      "name": "Notify Group",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2336,
        80
      ],
      "parameters": {
        "text": "={{ $json.title }}\n\nKeypoints:\n{{ $json.keypoints.slice(0,300) }}\n\nTakeaways:\n{{ $json['key takeways'].slice(0,300) }}",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "2472e47b-2c29-48fa-a8e2-8081ca13c01c",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2048,
        -240
      ],
      "parameters": {
        "width": 320,
        "height": 240,
        "content": "### Save & Notify\n\n- Results are saved to Google Sheets for tracking and analysis\n- A short summary is sent to Telegram for quick review"
      },
      "typeVersion": 1
    },
    {
      "id": "10a22a6d-27f7-4cb4-8a76-54417e0b8442",
      "name": "Code in JavaScript",
      "type": "n8n-nodes-base.code",
      "position": [
        -288,
        16
      ],
      "parameters": {
        "jsCode": "return {\n  brand: $input.first().json.results[0].content.results.results.organic[0].url,\n  competitor: $('Competitor Brand Search').first().json.results[0].content.results.results.organic[0].url\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "12450735-d243-4b0d-97b1-bfd054f7194e",
      "name": "Brand Google Search",
      "type": "@decodo/n8n-nodes-decodo.decodo",
      "position": [
        -528,
        16
      ],
      "parameters": {
        "query": "={{ $('On form submission').item.json.Brand }} reviews",
        "operation": "google_search"
      },
      "credentials": {
        "decodoApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b409b5f9-f91c-4da4-9900-498c34c0b673",
      "name": "Competitor Brand Search",
      "type": "@decodo/n8n-nodes-decodo.decodo",
      "position": [
        -720,
        16
      ],
      "parameters": {
        "query": "={{ $json['Brand Competitor'] }} reviews",
        "operation": "google_search"
      },
      "credentials": {
        "decodoApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "5079a001-5bb0-4262-a271-0c4818b6effe",
      "name": "Brand Page Extractor",
      "type": "@decodo/n8n-nodes-decodo.decodo",
      "position": [
        -16,
        -64
      ],
      "parameters": {
        "url": "={{ $json.brand }}"
      },
      "credentials": {
        "decodoApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "ade2850d-df36-417e-81d2-59457d7fddd4",
      "name": "Competitor Page Extractor",
      "type": "@decodo/n8n-nodes-decodo.decodo",
      "position": [
        -16,
        128
      ],
      "parameters": {
        "url": "={{ $json.competitor }}"
      },
      "credentials": {
        "decodoApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "67ebc7b4-d336-4f5d-99b0-d56aecd37afa",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        768,
        80
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combineBy": "combineByPosition"
      },
      "typeVersion": 3.2
    },
    {
      "id": "d44ec7da-7383-43da-9be3-b8d4e21d2576",
      "name": "Extract Competitor HTML Page Content",
      "type": "n8n-nodes-base.html",
      "position": [
        288,
        128
      ],
      "parameters": {
        "options": {
          "cleanUpText": false
        },
        "operation": "extractHtmlContent",
        "dataPropertyName": "=results[0].content",
        "extractionValues": {
          "values": [
            {
              "key": "dataCompetitor",
              "cssSelector": "body",
              "skipSelectors": "img"
            }
          ]
        }
      },
      "typeVersion": 1.2,
      "alwaysOutputData": false
    },
    {
      "id": "2f16f62e-d74c-406c-b906-5af062fc44ee",
      "name": "Extract Brand Page HTML Content",
      "type": "n8n-nodes-base.html",
      "position": [
        288,
        -128
      ],
      "parameters": {
        "options": {
          "cleanUpText": false
        },
        "operation": "extractHtmlContent",
        "dataPropertyName": "=results[0].content",
        "extractionValues": {
          "values": [
            {
              "key": "dataBrand",
              "cssSelector": "body",
              "skipSelectors": "img"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "a09be212-b4d0-4ec7-9aad-e842ee99b517",
      "name": "Summarizer & Reviewer Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1680,
        80
      ],
      "parameters": {
        "text": "=Article Brand: {{ $json.brand }}\nArticle Competitor: {{ $json.strCompetitor }}",
        "options": {
          "systemMessage": "# Role\n- act as an expert summarizer and reviewer\n\n# instructions\n- read the article, extract the keypoints information for each section\n- generate 4-6 key takeaways comparison\n\n# format\n- all the string should return fit for google sheets\n\n"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "dafc15d3-7452-4a43-b009-bfc9aca1be82",
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Construct Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notify Group": {
      "main": [
        []
      ]
    },
    "Construct Data": {
      "main": [
        [
          {
            "node": "Summarizer & Reviewer Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "Brand Page Extractor",
            "type": "main",
            "index": 0
          },
          {
            "node": "Competitor Page Extractor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Competitor Brand Search",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append row in sheet": {
      "main": [
        [
          {
            "node": "Notify Group",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Brand Google Search": {
      "main": [
        [
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Brand Page Extractor": {
      "main": [
        [
          {
            "node": "Extract Brand Page HTML Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Competitor Brand Search": {
      "main": [
        [
          {
            "node": "Brand Google Search",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Summarizer & Reviewer Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Summarizer & Reviewer Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Competitor Page Extractor": {
      "main": [
        [
          {
            "node": "Extract Competitor HTML Page Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Summarizer & Reviewer Agent": {
      "main": [
        [
          {
            "node": "Append row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Brand Page HTML Content": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Competitor HTML Page Content": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    }
  }
}