{
  "id": "aOP0D1cAqzGv7Xa8",
  "meta": {
    "instanceId": "workflow-3c303a2b",
    "versionId": "1.0.0",
    "createdAt": "2025-09-29T07:07:59.592250",
    "updatedAt": "2025-09-29T07:07:59.592264",
    "owner": "n8n-user",
    "license": "MIT",
    "category": "automation",
    "status": "active",
    "priority": "high",
    "environment": "production"
  },
  "name": "spy tool",
  "tags": [
    "automation",
    "n8n",
    "production-ready",
    "excellent",
    "optimized"
  ],
  "nodes": [
    {
      "id": "5690844d-5322-4c62-8c83-eb4d4dc9c481",
      "name": "OpenAI Chat Model",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1400,
        340
      ],
      "parameters": {
        "model": "gpt-4o",
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "ZOKbogCxHnP2W0H5",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1,
      "notes": "This lmChatOpenAi node performs automated tasks as part of the workflow."
    },
    {
      "id": "3b1c034f-501b-423c-844f-9cb607fa91e6",
      "name": "Gmail",
      "type": "n8n-nodes-base.gmailTool",
      "position": [
        1580,
        340
      ],
      "webhookId": "6a510528-22e0-4140-b987-770bb7a138de",
      "parameters": {
        "sendTo": "tom@sleak.chat",
        "message": "={{ $fromAI(\"change\", \"What relevant part has changed on the website?\") }}",
        "options": {
          "appendAttribution": false
        },
        "subject": "=Relevant changes on {{ $('parse results').item.json.website_url }}",
        "emailType": "text",
        "descriptionType": "manual",
        "toolDescription": "=Use this tool if you need to send an email, but only if the terms in the instructions mentioned explicitly state so\n"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "jtANm6k92Kl6ent1",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1,
      "notes": "This gmailTool node performs automated tasks as part of the workflow."
    },
    {
      "id": "4d448a02-4569-451e-8be5-59bfc48f36d8",
      "name": "parse results",
      "type": "n8n-nodes-base.code",
      "position": [
        1180,
        -160
      ],
      "parameters": {
        "jsCode": "const parsedObject = JSON.parse($('convert message to website url & instruction').first().json.choices[0].message.content);\n\nreturn parsedObject"
      },
      "typeVersion": 2,
      "notes": "This code node performs automated tasks as part of the workflow."
    },
    {
      "id": "238298c4-5bba-4ac1-b3cc-ab5a28888560",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1420,
        -120
      ],
      "parameters": {
        "width": 260,
        "height": 180,
        "content": "## Note: almost never works right away\nAdjust the prompts in the 'Tools agent' and 'Gmail' node as desired to steer the agent's behavior in the right direction"
      },
      "typeVersion": 1,
      "notes": "This stickyNote node performs automated tasks as part of the workflow."
    },
    {
      "id": "0d519c06-aa30-4a33-895f-9185936d27cf",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        100
      ],
      "parameters": {
        "width": 150,
        "height": 80,
        "content": "Connect your Firecrawl account"
      },
      "typeVersion": 1,
      "notes": "This stickyNote node performs automated tasks as part of the workflow."
    },
    {
      "id": "9e327bbe-0096-4a4d-aec2-2e4cae7d91bd",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1740,
        80
      ],
      "parameters": {
        "width": 150,
        "height": 80,
        "content": "Connect your own OpenAI account\n"
      },
      "typeVersion": 1,
      "notes": "This stickyNote node performs automated tasks as part of the workflow."
    },
    {
      "id": "30ce0e22-f536-462f-8f94-f3fd92ae036f",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1660,
        300
      ],
      "parameters": {
        "width": 150,
        "height": 80,
        "content": "Connect your own Gmail account\n"
      },
      "typeVersion": 1,
      "notes": "This stickyNote node performs automated tasks as part of the workflow."
    },
    {
      "id": "bc003781-3d91-49b6-b6bb-b2970b39256a",
      "name": "convert message to website url & instruction",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        940,
        -160
      ],
      "parameters": {
        "url": "{{ $env.API_BASE_URL }}",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"model\": \"gpt-4o-2024-08-06\",\n  \"messages\": [\n              {\n        \"role\": \"user\",\n        \"content\": \"convert the following message to a website url (just the plain text url, NOT formatted or in markdown) and prompt to AI. Make the prompt as verbose as possible. Message: {{ $('New espionage assignment').first().json.assignment_instructions }}\"\n    }\n  ],\n  \"response_format\": {\n    \"type\": \"json_schema\",\n    \"json_schema\": {\n      \"name\": \"variable_extraction\",\n      \"schema\": {\n        \"type\": \"object\",\n        \"properties\": {\n          \"website_url\": { \"type\": \"string\" },\n          \"prompt\": { \"type\": \"string\" }\n        },\n        \"required\": [\"website_url\", \"prompt\"],\n        \"additionalProperties\": false\n      },\n      \"strict\": true\n    }\n  }\n}\n",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "{{ $credentials.predefinedCredentialType }}",
        "nodeCredentialType": "YOUR_CREDENTIAL_HERE"
      },
      "credentials": {
        "openAiApi": {
          "id": "ZOKbogCxHnP2W0H5",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 4.2,
      "notes": "This httpRequest node performs automated tasks as part of the workflow."
    },
    {
      "id": "6a8c172d-ac39-4cb0-b601-39fc770695ed",
      "name": "New espionage assignment",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        700,
        -160
      ],
      "webhookId": "7470334f-93e1-47af-9521-d3a232c38b13",
      "parameters": {
        "options": {},
        "formTitle": "New espionage assignment",
        "formFields": {
          "values": [
            {
              "fieldLabel": "assignment_instructions"
            }
          ]
        }
      },
      "notesInFlow": false,
      "typeVersion": 2.2,
      "notes": "This formTrigger node performs automated tasks as part of the workflow."
    },
    {
      "id": "c5c64e5c-88de-45e3-bb9b-4096e74a6e83",
      "name": "wait 1 day",
      "type": "n8n-nodes-base.wait",
      "position": [
        940,
        80
      ],
      "webhookId": "22e689e4-b93d-4c59-81e5-43c070833454",
      "parameters": {
        "unit": "days",
        "amount": 1
      },
      "typeVersion": 1.1,
      "notes": "This wait node performs automated tasks as part of the workflow."
    },
    {
      "id": "62a278ff-ed00-4e54-a608-001237551113",
      "name": "scrape page - 1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        700,
        80
      ],
      "parameters": {
        "url": "{{ $env.API_BASE_URL }}",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"url\": \"{{ $('parse results').item.json.website_url }}\",\n  \"formats\": [\n    \"markdown\"\n  ],\n  \"onlyMainContent\": true,\n  \"waitFor\": 5000\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "{{ $credentials.genericCredentialType }}",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpBasicAuth": {
          "id": "h2XRcXzLcEfvDVKb",
          "name": "Unnamed credential"
        },
        "httpHeaderAuth": {
          "id": "FoyIka0WgFG4FPxA",
          "name": "Header Auth account 2"
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.2,
      "notes": "This httpRequest node performs automated tasks as part of the workflow."
    },
    {
      "id": "89c15d8f-7f8e-4391-b24a-07579964ca5c",
      "name": "scrape page - 2",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1180,
        80
      ],
      "parameters": {
        "url": "{{ $env.API_BASE_URL }}",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"url\": \"{{ $('parse results').item.json.website_url }}\",\n  \"formats\": [\n    \"markdown\"\n  ],\n  \"onlyMainContent\": true,\n  \"waitFor\": 5000\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "{{ $credentials.genericCredentialType }}",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "FoyIka0WgFG4FPxA",
          "name": "Header Auth account 2"
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.2,
      "notes": "This httpRequest node performs automated tasks as part of the workflow."
    },
    {
      "id": "7b148c5b-d4ae-498a-b7ef-2ed4ecc0a665",
      "name": "send e-mail?",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1420,
        80
      ],
      "parameters": {
        "text": "={{ $('parse results').item.json.prompt }}\n\nNOTE: ONLY send an email if the situation meets the above condition. Otherwise, do NOT use the tool\n\nNOTE: this concerns differences between the \"old version page\" (scrape from yesterday) and \"new version page\" (scrape from now)",
        "options": {
          "systemMessage": "=old version page: \\n\\n {{ JSON.stringify($('scrape page - 1').item.json[\"data\"][\"markdown\"]) }} \\n\\n /// \\n\\n new version page: \\n\\n {{ JSON.stringify($('scrape page - 1').item.json[\"data\"][\"markdown\"]) }}"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.7,
      "notes": "This agent node performs automated tasks as part of the workflow."
    },
    {
      "id": "7897d707-2c27-43bf-9ea0-90ab7996bf4a",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        920,
        -260
      ],
      "parameters": {
        "width": 150,
        "height": 80,
        "content": "Connect your own OpenAI account\n"
      },
      "typeVersion": 1,
      "notes": "This stickyNote node performs automated tasks as part of the workflow."
    }
  ],
  "active": true,
  "pinData": {},
  "settings": {
    "executionOrder": "v1",
    "saveManualExecutions": true,
    "callerPolicy": "workflowsFromSameOwner",
    "errorWorkflow": null,
    "timezone": "UTC",
    "executionTimeout": 3600,
    "maxExecutions": 1000,
    "retryOnFail": true,
    "retryCount": 3,
    "retryDelay": 1000
  },
  "versionId": "dec23eea-1590-4418-ab2b-1cb4a6ccfdc6",
  "connections": {
    "bc003781-3d91-49b6-b6bb-b2970b39256a": {
      "main": [
        [
          {
            "node": "error-handler-bc003781-3d91-49b6-b6bb-b2970b39256a",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-bc003781-3d91-49b6-b6bb-b2970b39256a-afe9eb96",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-bc003781-3d91-49b6-b6bb-b2970b39256a-39a008b8",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-bc003781-3d91-49b6-b6bb-b2970b39256a-7c33e8db",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-bc003781-3d91-49b6-b6bb-b2970b39256a-83463f60",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-bc003781-3d91-49b6-b6bb-b2970b39256a-409c417f",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-bc003781-3d91-49b6-b6bb-b2970b39256a-c154cd80",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-bc003781-3d91-49b6-b6bb-b2970b39256a-061403af",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-bc003781-3d91-49b6-b6bb-b2970b39256a-01b56745",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "62a278ff-ed00-4e54-a608-001237551113": {
      "main": [
        [
          {
            "node": "error-handler-62a278ff-ed00-4e54-a608-001237551113",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-62a278ff-ed00-4e54-a608-001237551113-c2d83c0c",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-62a278ff-ed00-4e54-a608-001237551113-b1a51b8c",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-62a278ff-ed00-4e54-a608-001237551113-040e47b5",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-62a278ff-ed00-4e54-a608-001237551113-519296ae",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-62a278ff-ed00-4e54-a608-001237551113-82fd111f",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-62a278ff-ed00-4e54-a608-001237551113-ee4d3ddc",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-62a278ff-ed00-4e54-a608-001237551113-f4a330f1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-62a278ff-ed00-4e54-a608-001237551113-2762ebbc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "89c15d8f-7f8e-4391-b24a-07579964ca5c": {
      "main": [
        [
          {
            "node": "error-handler-89c15d8f-7f8e-4391-b24a-07579964ca5c",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-89c15d8f-7f8e-4391-b24a-07579964ca5c-d6df499e",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-89c15d8f-7f8e-4391-b24a-07579964ca5c-501cc5bd",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-89c15d8f-7f8e-4391-b24a-07579964ca5c-b338a60c",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-89c15d8f-7f8e-4391-b24a-07579964ca5c-0a5d8c31",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-89c15d8f-7f8e-4391-b24a-07579964ca5c-43fbaec2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-89c15d8f-7f8e-4391-b24a-07579964ca5c-98e4a31d",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-89c15d8f-7f8e-4391-b24a-07579964ca5c-cacee123",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-89c15d8f-7f8e-4391-b24a-07579964ca5c-7ef86503",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "5690844d-5322-4c62-8c83-eb4d4dc9c481": {
      "main": [
        [
          {
            "node": "error-handler-5690844d-5322-4c62-8c83-eb4d4dc9c481-43b7c1c9",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "description": "Automated workflow: spy tool. This workflow integrates 9 different services: stickyNote, httpRequest, formTrigger, wait, code. It contains 21 nodes and follows best practices for error handling and security.",
  "notes": "Excellent quality workflow: spy tool. This workflow has been optimized for production use with comprehensive error handling, security, and documentation."
}