{
  "name": "Course Discount Tracker (Browser Automation)",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        -340,
        300
      ],
      "id": "30e85557-de02-47f0-85c2-954914393d69",
      "name": "Schedule Trigger"
    },
    {
      "parameters": {
        "profileName": "udemy",
        "timeoutMinutes": 30,
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.airtop",
      "typeVersion": 1,
      "position": [
        -160,
        300
      ],
      "id": "589f82cb-d6c3-4579-a312-b8b5e7b4b013",
      "name": "Create a session",
      "credentials": {
        "airtopApi": {
          "id": "vvvkP5UNumqMrhVK",
          "name": "Airtop account"
        }
      }
    },
    {
      "parameters": {
        "resource": "window",
        "url": "https://www.udemy.com/courses/search/?q=n8n&src=sac",
        "getLiveView": true,
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.airtop",
      "typeVersion": 1,
      "position": [
        20,
        300
      ],
      "id": "5532a0a1-746c-4978-a035-353d60e391d1",
      "name": "Create a window",
      "credentials": {
        "airtopApi": {
          "id": "vvvkP5UNumqMrhVK",
          "name": "Airtop account"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        840,
        200
      ],
      "id": "54edbdd8-8bc2-49eb-9978-6844068e4844",
      "name": "Loop Over Items"
    },
    {
      "parameters": {
        "resource": "window",
        "operation": "close",
        "sessionId": "={{ $('Create a session').item.json.sessionId }}",
        "windowId": "={{ $('Create a window').item.json.data.windowId }}"
      },
      "type": "n8n-nodes-base.airtop",
      "typeVersion": 1,
      "position": [
        1060,
        -80
      ],
      "id": "9962e04f-a970-43b0-a1e3-5ca2839216c3",
      "name": "Close a window",
      "credentials": {
        "airtopApi": {
          "id": "vvvkP5UNumqMrhVK",
          "name": "Airtop account"
        }
      }
    },
    {
      "parameters": {
        "operation": "terminate",
        "sessionId": "={{ $('Create a session').item.json.sessionId }}"
      },
      "type": "n8n-nodes-base.airtop",
      "typeVersion": 1,
      "position": [
        1280,
        -80
      ],
      "id": "da857de1-50d9-41f4-af7a-bdb1536bef0a",
      "name": "Terminate a session",
      "credentials": {
        "airtopApi": {
          "id": "vvvkP5UNumqMrhVK",
          "name": "Airtop account"
        }
      }
    },
    {
      "parameters": {
        "fieldToSplitOut": "output.products",
        "options": {}
      },
      "type": "n8n-nodes-base.splitOut",
      "typeVersion": 1,
      "position": [
        420,
        300
      ],
      "id": "3d7c291b-bd3d-4d94-b570-047b83795922",
      "name": "Split course data"
    },
    {
      "parameters": {
        "resource": "extraction",
        "operation": "query",
        "prompt": "title, Current price, Original price, url, instructors name, rating, offerLeftTime(provided offerLeftTime is e.g,20 hours left at this price!)\n\nOriginal price is not available to \"\" blank output provide",
        "additionalFields": {
          "outputSchema": "{\n  \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n  \"type\": \"object\",\n  \"properties\": {\n    \"products\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"object\",\n        \"properties\": {\n          \"title\": { \"type\": \"string\" },\n        \"current_price\": { \"type\": \"string\" },\n        \"original_price\": { \"type\": \"string\" },\n        \"url\": { \"type\": \"string\" },\n        \"instructors_name\": { \"type\": \"string\" },\n          \"rating\": { \"type\": \"string\" },\n    \"offerLeftTime\": {\n      \"type\": \"string\"\n    }\n        },\n        \"required\": [\"title\", \"current_price\",\"original_price\", \"url\", \"instructors_name\", \"rating\",\"offerLeftTime\"]\n      }\n    }\n  },\n  \"required\": [\"products\"]\n}",
          "parseJsonOutput": true
        }
      },
      "type": "n8n-nodes-base.airtop",
      "typeVersion": 1,
      "position": [
        220,
        300
      ],
      "id": "c49753df-3f79-4d11-bf87-64b10c7f4966",
      "name": "Scrape course",
      "credentials": {
        "airtopApi": {
          "id": "vvvkP5UNumqMrhVK",
          "name": "Airtop account"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "d9b964ec-cb67-4c1f-aba5-0e8e4c5d241c",
              "leftValue": "={{ $json.original_price }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        620,
        300
      ],
      "id": "0f38c66c-ded8-45dc-8f04-eec64a9f5722",
      "name": "Check offer available or not"
    },
    {
      "parameters": {
        "jsCode": "// Get values from the input item\nconst currentPriceStr = $input.first().json.current_price;\nconst originalPriceStr = $input.first().json.original_price;\n\n// Detect currency symbol (assumes same for both)\nconst currencySymbol = currentPriceStr.trim().charAt(0);\n\n// Clean currency symbols and commas, then parse to float\nconst currentPrice = parseFloat(currentPriceStr.replace(/[^0-9.]/g, '').replace(/,/g, ''));\nconst originalPrice = parseFloat(originalPriceStr.replace(/[^0-9.]/g, '').replace(/,/g, ''));\n\n// Calculate discount\nconst discount = ((originalPrice - currentPrice) / originalPrice) * 100;\nconst discountPercentage = discount.toFixed(2);\n\n// Return output with original currency symbol\nreturn [\n  {\n    json: {\n      current_price: `${currencySymbol}${currentPrice}`,\n      original_price: `${currencySymbol}${originalPrice}`,\n      discount_percentage: `${discountPercentage}`\n    }\n  }\n];\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1060,
        120
      ],
      "id": "c56d4e01-4d40-44e6-b275-c88b3d1f4741",
      "name": "Find discount"
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "1JQE5aW11UriY-jtybq9LTXqu-Un3khZuNp7SzSjXnVU",
          "mode": "list",
          "cachedResultName": "Online Course Price Tracker with Coupon Detection"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Sheet1"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Title": "={{ $('Loop Over Items').item.json.title }}",
            "Url": "={{ $('Loop Over Items').item.json.url }}",
            "Current price": "={{ $json.current_price }}",
            "Discount": "={{ $json.discount_percentage }}% OFF",
            "Offer left": "={{ $('Loop Over Items').item.json.offerLeftTime }}",
            "Rating": "={{ $('Loop Over Items').item.json.rating }}",
            "Original price": "={{ $json.original_price }}",
            "Instructor Name": "={{ $('Loop Over Items').item.json.instructors_name }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "Instructor Name",
              "displayName": "Instructor Name",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Title",
              "displayName": "Title",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Url",
              "displayName": "Url",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Original price",
              "displayName": "Original price",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Discount",
              "displayName": "Discount",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Current price",
              "displayName": "Current price",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Offer left",
              "displayName": "Offer left",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Rating",
              "displayName": "Rating",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.6,
      "position": [
        1500,
        120
      ],
      "id": "2feb6373-dfd0-4d36-9ed0-d0d2d3b87e24",
      "name": "Append 50% up disc data",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "Pjxuoti0ywJ2OIzZ",
          "name": "Google Sheets account"
        }
      }
    },
    {
      "parameters": {
        "chatId": "chat_id",
        "text": "=🧠 Top Udemy Course Deal\n\n👨‍🏫 InstructorName: {{ $json[\"Instructor Name\"] }}\n🎓 Course: {{ $json.Title }}   \n💸 OriginalPrice: {{ $('Loop Over Items').item.json.original_price }} | {{ $json.Discount }} | CurrentPrice: {{ $json[\"Current price\"] }} \n🌐 {{ $json.Url }}\n⭐ Rating: {{ $json.Rating }}\n⏰ {{ $json[\"Offer left\"] }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        1720,
        180
      ],
      "id": "7f8e8629-6beb-430d-aaf4-9d0c13e512c0",
      "name": "Send notify course deal",
      "webhookId": "bb458922-dd70-4af1-a3c0-365a51254b07",
      "credentials": {
        "telegramApi": {
          "id": "bU8BFVjQWOVPPmn4",
          "name": "Telegram account"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "ff84d4e1-b9ac-4896-be90-2e5903d8d8b9",
              "leftValue": "={{ $json.discount_percentage }}",
              "rightValue": 50,
              "operator": {
                "type": "number",
                "operation": "gte"
              }
            }
          ],
          "combinator": "and"
        },
        "looseTypeValidation": true,
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        1280,
        120
      ],
      "id": "726c69bd-9d06-475a-95f3-85ae73127900",
      "name": "Check discount percentage 50%>"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        840,
        400
      ],
      "id": "701f9e8a-5db5-4320-adc0-c6849b4833b2",
      "name": "No Operation, do nothing"
    },
    {
      "parameters": {
        "content": "## Online Course Price Tracker with Coupon Detection\n\nSample sheet:\nCreate your own spreadsheet with these tabs/columns, then select it in the Google Sheets nodes:\n- **Online Course Price Tracker with Coupon Detection → Sheet1**: `Instructor Name`, `Title`, `Url`, `Original price`, `Discount`, `Current price`, `Offer left`, `Rating`\n\n1.Input course URLs with titles into browser window.\n\n2.Scrape multiple course-related titles.\n\n3.Loop through each course to check if an offer is available.\n\n4.Detect discounts ≥ 50% using logic filters.\n\n5.store valid discounts in Google Sheets for record-keeping.\n\n6.Send Telegram alerts when high-discount deals are found.\n\nIdeal for Udemy price monitoring.\n\nSchedule to run daily or hourly for fresh deals.",
        "height": 440,
        "width": 620
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -160,
        -180
      ],
      "typeVersion": 1,
      "id": "0bc5b843-a53c-4651-8214-24f697761524",
      "name": "Sticky Note"
    }
  ],
  "pinData": {},
  "connections": {
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Create a session",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a session": {
      "main": [
        [
          {
            "node": "Create a window",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a window": {
      "main": [
        [
          {
            "node": "Scrape course",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Close a window",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Find discount",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Close a window": {
      "main": [
        [
          {
            "node": "Terminate a session",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split course data": {
      "main": [
        [
          {
            "node": "Check offer available or not",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scrape course": {
      "main": [
        [
          {
            "node": "Split course data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check offer available or not": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find discount": {
      "main": [
        [
          {
            "node": "Check discount percentage 50%>",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append 50% up disc data": {
      "main": [
        [
          {
            "node": "Send notify course deal",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send notify course deal": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check discount percentage 50%>": {
      "main": [
        [
          {
            "node": "Append 50% up disc data",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "936dda36-42c9-4445-8f56-20ea6a0f33cc",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "f1c26778ec36097a9722a22c47c5e9c01f00b8862dadd0121ec118026a370fa6"
  },
  "id": "g7mzei0hUismB9lZ",
  "tags": []
}