{
  "name": "Autonomous Marketing Agent",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks"
            }
          ]
        }
      },
      "id": "e4d6e10f-927e-44e6-9de7-5debf1b18f5d",
      "name": "Weekly trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.3,
      "position": [
        0,
        16
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "16ebbf6f-a521-4bf8-b472-0e18a503dc78",
              "name": "chatInput",
              "type": "string",
              "value": "You are a marketing agent for [YOUR PRODUCT]. Run the following cycle.\n\nTOOL USE IS MANDATORY. You have these tools: Lodd.dev (analytics), Google Search Console, Google Trends, Tavily (web search), Supadata (scraping), OpenAI tester, Perplexity. You MUST actually call the relevant tool for every section below. Do NOT answer from memory or prior knowledge. If you have not called a tool, you do not know the answer.\n\nEvery factual claim you make MUST be backed by raw evidence pulled from a tool call: an exact number, an exact date range, or a source URL. Bare statements like \"traffic is up\" or \"visibility unclear\" are forbidden. Show the numbers.\n\nIf a tool was not called, returned nothing, or errored, say so explicitly with the literal token TOOL NOT CALLED or NO DATA for that line. Never paper over a missing tool result with a guess.\n\nSENSE:\n- Call the Lodd.dev tools for the analytics snapshot and traffic sources for the last 7 days, then compare to the previous 7 days. Prefer the Lodd tools' relative period parameters (e.g. period \"7d\", \"30d\") over passing absolute dates, and let Lodd compute the comparison window. If a tool needs explicit dates, derive them from today's date given in the system message. Report exact visitor and pageview counts, which pages grew or declined (with numbers), new referral sources, and event counts (signups, key actions) with their numbers.\n- Call the Google Search Console tool for search performance over the last 28 days. Report the top queries by impressions with their exact impressions, CTR, and position. Flag any page with high impressions but low clicks (title/description problem) and name it.\n- Call the Google Trends tool for these target queries: [YOUR TARGET QUERIES]. Report whether each is trending UP, DOWN, or FLAT over the last 3 months, citing the tool result.\n\nMAINTAIN:\n- Call the web search tool for \"[YOUR PRODUCT]\" mentions in the last week. Include source URLs for anything you find, or say NO DATA.\n- Call the web search tool to pull the \"People Also Ask\" questions for the target queries above. List the actual PAA questions returned and flag which are not yet covered by existing [YOUR PRODUCT] content.\n- Call the OpenAI tool with \"What [YOUR CATEGORY] tools exist? List specific products.\" Quote the relevant part of its answer and state whether [YOUR PRODUCT] appears.\n- Call the Perplexity tool with the same question. Quote the relevant part and state whether [YOUR PRODUCT] appears.\n- Report exactly what each AI assistant said. Do not speculate about AI visibility without actually calling the tool.\n- For any competitor claim, include the source URL. If you cannot find a source, mark the claim as UNVERIFIED.\n\nIDEATE: Based ONLY on the tool results above, propose up to 3 specific marketing actions. Each must include: what to do, why (citing a specific number or finding from above), and estimated effort (quick/medium/significant). PAA questions not covered by existing content are strong candidates for new articles.\n\nRules:\n- Lead with findings, not process.\n- Every claim carries its evidence (number, date, or URL). No bare adjectives.\n- Never state competitor activity as fact without a source URL.\n- If a section genuinely has nothing, say \"all clear\" for that section, but only after the tool was actually called.\n- Keep the report under 500 words."
            },
            {
              "id": "5df5d8c1-ac58-4126-ba2a-e3bcd6e0e2ee",
              "name": "source",
              "type": "string",
              "value": "schedule"
            },
            {
              "id": "c464f0de-a7f7-4722-893a-53230cbedc35",
              "name": "channel",
              "type": "string",
              "value": "YOUR_SLACK_CHANNEL_ID"
            }
          ]
        },
        "options": {}
      },
      "id": "cc96363a-ed29-4b92-9db0-10aa1dd91405",
      "name": "Weekly marketing prompt",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        224,
        16
      ]
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.chatInput }}",
        "options": {
          "systemMessage": "=Today's date is {{ $now.toFormat('yyyy-MM-dd') }} ({{ $now.toFormat('cccc') }}). Use this as the reference point for every 'last 7 days', 'yesterday', and 'previous week' calculation. Never guess the current date. You must call tools to gather data; never fabricate analytics, search results, or AI-assistant answers. Don't use markdown formatting, as Slack does not parse it properly. Just emojiis"
        }
      },
      "id": "fe9fb891-3da5-4ff2-bd4b-4cb65cb5d476",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        896,
        112
      ]
    },
    {
      "parameters": {
        "model": "qwen/qwen3.7-max",
        "options": {}
      },
      "id": "7702f4b0-1881-4dae-bd85-4d2a01691223",
      "name": "OpenRouter Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "typeVersion": 1,
      "position": [
        448,
        336
      ]
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $json.sessionId || 'weekly-monitor' }}",
        "contextWindowLength": 10
      },
      "id": "864c836c-ba36-4f0d-8882-d5850257080e",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.4,
      "position": [
        576,
        336
      ]
    },
    {
      "parameters": {
        "endpointUrl": "https://api.lodd.dev/mcp",
        "authentication": "bearerAuth",
        "options": {}
      },
      "id": "99de12d9-3d4d-4c20-acfe-43a740f33ec4",
      "name": "Lodd.dev",
      "type": "@n8n/n8n-nodes-langchain.mcpClientTool",
      "typeVersion": 1.2,
      "position": [
        704,
        336
      ]
    },
    {
      "parameters": {
        "endpointUrl": "https://mcp.tavily.com/mcp/?tavilyApiKey=tvly-dev-YOUR_TAVILY_KEY",
        "options": {}
      },
      "id": "838e3c87-b222-4267-bf7e-63ebf7451b14",
      "name": "Tavily",
      "type": "@n8n/n8n-nodes-langchain.mcpClientTool",
      "typeVersion": 1.2,
      "position": [
        832,
        336
      ]
    },
    {
      "parameters": {
        "endpointUrl": "https://api.supadata.ai/mcp",
        "authentication": "headerAuth",
        "options": {}
      },
      "id": "7d7d0965-2bb6-40a6-978a-16bdb19eb9b4",
      "name": "Supadata",
      "type": "@n8n/n8n-nodes-langchain.mcpClientTool",
      "typeVersion": 1.2,
      "position": [
        960,
        336
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.openai.com/v1/chat/completions",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "openAiApi",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "{ \"model\": \"gpt-5.4-mini\", \"messages\": [{ \"role\": \"user\", \"content\": \"What [YOUR CATEGORY] tools exist? List specific products.\" }] }",
        "options": {}
      },
      "id": "24113b2c-360e-4843-bae6-e645ffd9dbcc",
      "name": "OpenAI tester",
      "type": "n8n-nodes-base.httpRequestTool",
      "typeVersion": 4.4,
      "position": [
        1088,
        336
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.perplexity.ai/chat/completions",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "perplexityApi",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "{ \"model\": \"sonar\", \"messages\": [{ \"role\": \"user\", \"content\": \"What [YOUR CATEGORY] tools exist? List specific products.\" }] }",
        "options": {}
      },
      "id": "205f3bed-ead0-4d43-bb0d-a5c06b1e6fd7",
      "name": "Perplexity",
      "type": "n8n-nodes-base.httpRequestTool",
      "typeVersion": 4.4,
      "position": [
        1216,
        336
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://searchconsole.googleapis.com/webmasters/v3/sites/sc-domain%3Ayourdomain.com/searchAnalytics/query",
        "authentication": "genericCredentialType",
        "genericAuthType": "oAuth2Api",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={ \"startDate\": \"{{ $today.minus(28, 'days').toFormat('yyyy-MM-dd') }}\", \"endDate\": \"{{ $today.toFormat('yyyy-MM-dd') }}\", \"dimensions\": [\"query\"], \"rowLimit\": 25 }",
        "options": {},
        "optimizeResponse": true
      },
      "id": "acbbcb79-e932-43b2-99c4-5e4aa9c80980",
      "name": "Google Search Console",
      "type": "n8n-nodes-base.httpRequestTool",
      "typeVersion": 4.4,
      "position": [
        1344,
        336
      ]
    },
    {
      "parameters": {
        "url": "https://serpapi.com/search",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpQueryAuth",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "engine",
              "value": "google_trends"
            },
            {
              "name": "q",
              "value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('queries', 'Comma-separated search terms to check Google Trends for, max 5') }}"
            },
            {
              "name": "data_type",
              "value": "TIMESERIES"
            },
            {
              "name": "date",
              "value": "today 3-m"
            }
          ]
        },
        "options": {},
        "optimizeResponse": true
      },
      "id": "d8fa94b0-c23d-41e0-8067-34ac857731b5",
      "name": "Google Trends",
      "type": "n8n-nodes-base.httpRequestTool",
      "typeVersion": 4.4,
      "position": [
        1472,
        336
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "61fd5773-8dc4-4b59-9053-23bcfdfc1430",
              "leftValue": "={{ $if($('Slack prompt').isExecuted, $('Slack prompt').item.json.source, 'schedule') }}",
              "rightValue": "slack",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "7b9619f7-cf57-4d8c-9242-53ead167006f",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        1680,
        112
      ]
    },
    {
      "parameters": {
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Slack prompt').item.json.channel }}"
        },
        "text": "={{ $json.output }}",
        "otherOptions": {
          "thread_ts": {
            "replyValues": {
              "thread_ts": "={{ $('Slack prompt').item.json.ts }}"
            }
          }
        }
      },
      "id": "99363b5d-f02e-4311-9eb7-178ac33ef0a3",
      "name": "Slack prompt1",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.4,
      "position": [
        1904,
        16
      ]
    },
    {
      "parameters": {
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Weekly marketing prompt').item.json.channel }}"
        },
        "text": "={{ $('AI Agent').item.json.output }}",
        "otherOptions": {}
      },
      "id": "552a62f5-d95f-4449-986d-027c41913834",
      "name": "Weekly marketing",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.4,
      "position": [
        1904,
        208
      ]
    },
    {
      "parameters": {
        "trigger": [
          "app_mention"
        ],
        "watchWorkspace": true,
        "options": {}
      },
      "id": "3cea1fd2-d63e-44b5-909a-d8780bce4cc9",
      "name": "Slack Trigger",
      "type": "n8n-nodes-base.slackTrigger",
      "typeVersion": 1,
      "position": [
        0,
        208
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "4fcf5b0a-2fbb-4421-a23b-e880f79956c0",
              "name": "chatInput",
              "type": "string",
              "value": "={{ $json.text.replace(/<@[A-Z0-9]+>\\s*/g, '') }}"
            },
            {
              "id": "fc27f277-5e9e-4df5-9353-daf17e1fa164",
              "name": "source",
              "type": "string",
              "value": "slack"
            },
            {
              "id": "3ecadb2b-438a-4a34-894e-0c05533590fd",
              "name": "channel",
              "type": "string",
              "value": "={{ $json.channel }}"
            },
            {
              "id": "d4bf9a97-22fd-40d6-a097-085044bf3218",
              "name": "ts",
              "type": "string",
              "value": "={{ $json.ts }}"
            }
          ]
        },
        "options": {}
      },
      "id": "4ee22969-037d-4b89-bd96-d316faa40f55",
      "name": "Slack prompt",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        224,
        208
      ]
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.4,
      "position": [
        672,
        -160
      ],
      "id": "ab610656-ad43-456a-99fd-ef178b2c1da7",
      "name": "When chat message received"
    }
  ],
  "pinData": {},
  "connections": {
    "Weekly trigger": {
      "main": [
        [
          {
            "node": "Weekly marketing prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Weekly marketing prompt": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Lodd.dev": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Tavily": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Supadata": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI tester": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Perplexity": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Google Search Console": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Google Trends": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "Slack prompt1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Weekly marketing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Slack Trigger": {
      "main": [
        [
          {
            "node": "Slack prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Slack prompt": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        []
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate",
    "timeSavedMode": "fixed",
    "callerPolicy": "workflowsFromSameOwner",
    "availableInMCP": true
  },
  "meta": {
    "aiBuilderAssisted": true,
    "builderVariant": "mcp"
  },
  "id": "",
  "tags": []
}
