{
  "name": "Online Course Price Tracker with Coupon Detection",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        -340,
        300
      ],
      "id": "3d9b49d4-bd5b-4907-a0f4-156f854f74c0",
      "name": "Schedule Trigger"
    },
    {
      "parameters": {
        "profileName": "udemy",
        "timeoutMinutes": 30,
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.airtop",
      "typeVersion": 1,
      "position": [
        -160,
        300
      ],
      "id": "2e75711b-af26-47fa-add4-c8b54bb5fa21",
      "name": "Create a session",
      "credentials": {
        "airtopApi": {
          "id": "UAkFxKM2w1j6Unyb",
          "name": "Airtop account 2"
        }
      }
    },
    {
      "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": "d6bce498-b6fb-4f17-8578-4638add674d7",
      "name": "Create a window",
      "credentials": {
        "airtopApi": {
          "id": "UAkFxKM2w1j6Unyb",
          "name": "Airtop account 2"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        840,
        200
      ],
      "id": "24bc8d00-6948-400c-a4ff-9cf80b578cd3",
      "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": "aecde908-8a4a-42b8-8432-1943366966d3",
      "name": "Close a window",
      "credentials": {
        "airtopApi": {
          "id": "UAkFxKM2w1j6Unyb",
          "name": "Airtop account 2"
        }
      }
    },
    {
      "parameters": {
        "operation": "terminate",
        "sessionId": "={{ $('Create a session').item.json.sessionId }}"
      },
      "type": "n8n-nodes-base.airtop",
      "typeVersion": 1,
      "position": [
        1280,
        -80
      ],
      "id": "1c203867-5463-49ec-96ce-5b55a32a295c",
      "name": "Terminate a session",
      "credentials": {
        "airtopApi": {
          "id": "UAkFxKM2w1j6Unyb",
          "name": "Airtop account 2"
        }
      }
    },
    {
      "parameters": {
        "fieldToSplitOut": "output.products",
        "options": {}
      },
      "type": "n8n-nodes-base.splitOut",
      "typeVersion": 1,
      "position": [
        420,
        300
      ],
      "id": "ad1e7cfd-d5c4-48a9-aaa6-0f0d379588e2",
      "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": "ef1b2daa-7eef-4bf5-9f98-3d3cd817ff68",
      "name": "Scrape course",
      "credentials": {
        "airtopApi": {
          "id": "UAkFxKM2w1j6Unyb",
          "name": "Airtop account 2"
        }
      }
    },
    {
      "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": "196e0431-5de8-4cfe-be4e-f34d5d828ba1",
      "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": "0a4dce7d-95e4-4146-b883-20b3ae529d26",
      "name": "Find discount"
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "1JQE5aW11UriY-jtybq9LTXqu-Un3khZuNp7SzSjXnVU",
          "mode": "list",
          "cachedResultName": "Online Course Price Tracker with Coupon Detection",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1JQE5aW11UriY-jtybq9LTXqu-Un3khZuNp7SzSjXnVU/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Sheet1",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1JQE5aW11UriY-jtybq9LTXqu-Un3khZuNp7SzSjXnVU/edit#gid=0"
        },
        "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": "4a509ea8-da93-4c4a-99f5-52a7b0b8cdb1",
      "name": "Append 50% up disc data",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "cOspDa8h1hkwDLvX",
          "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": "07306650-5126-4f82-9105-b63a07828cd6",
      "name": "Send notify course deal",
      "webhookId": "801f61c6-b30d-4ee0-ae6c-a112e06597a6",
      "credentials": {
        "telegramApi": {
          "id": "JmLVS90gYgUE5ty2",
          "name": "Telegram account 3"
        }
      }
    },
    {
      "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": "aaead545-2dea-4be0-8edc-7e01cfbbc09c",
      "name": "Check discount percentage 50%>"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        840,
        400
      ],
      "id": "95000016-08e5-4174-8584-b97572530ba5",
      "name": "No Operation, do nothing"
    },
    {
      "parameters": {
        "content": "## Online Course Price Tracker with Coupon Detection\n\nSample sheet:\nhttps://docs.google.com/spreadsheets/d/1JQE5aW11UriY-jtybq9LTXqu-Un3khZuNp7SzSjXnVU/edit?gid=0#gid=0\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": "9c622fa0-289f-40a2-9666-e0c58efc0861",
      "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": "c94323a6-7e85-4778-977f-e09686a826db",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "fcb622cbd5234c565b9b78babeaf0ea2455df9d2aad0d1adff7c1ef99583e685"
  },
  "id": "f4NybbHYIxG4mwCR",
  "tags": []
}