Skip to content

Product Notifier is a script that monitors product prices and sends notifications via Telegram. It leverages Node.js, Cheerio, and the Telegram API to extract product information, track price changes, and notify users about the updates.

Notifications You must be signed in to change notification settings

onlyonehas/Product-Notifier

Repository files navigation

⚡️ Product Notifier

Product Notifier is a script that monitors product prices and sends notifications via Telegram. It leverages Node.js to make HTTP requests, utilizes Cheerio for HTML parsing, and interacts with the Telegram API for sending notifications.

🌟 Features

  • Monitors the price of products.
  • Stores the monitored data in a JSON file.
  • Sends price change notifications via Telegram.
  • Prevents redundant monitoring by checking if the data has already been processed for the day.

🔧 Prerequisites

  • Node.js (Version 18 or higher)
  • AWS account and AWS CLI configured

🚀 Installation

  1. Clone the repository or download the script files to your local machine.
  2. Open a terminal and navigate to the directory where the script files are located.
  3. Install the dependencies by running the following command: npm install
  4. Create a config.json file in the root directory with the following structure:
{
"telegramBotToken": "YOUR_TELEGRAM_BOT_TOKEN",
"telegramChatId": "YOUR_TELEGRAM_CHAT_ID"
}

Replace YOUR_TELEGRAM_BOT_TOKEN with your actual Telegram bot token and YOUR_TELEGRAM_CHAT_ID with your actual Telegram chat ID.

  1. Save the changes in the config.json file.

💡 Usage

  1. Open the products.json file in a text editor.
  2. Define the products you want to monitor in the following format:
[
  {
    "productUrl": "PRODUCT_URL",
    "desiredPrice": DESIRED_PRICE,
    "monitorEnabled": true
  },
  ...
]
  1. Replace PRODUCT_URL with the URL of the product you want to monitor, DESIRED_PRICE with the desired price, and set monitorEnabled to true to enable monitoring for that product.

  2. Save the changes in the data.json file.

  3. Open a terminal and navigate to the directory where the script files are located.

  4. Run the script using the following command:

npm start

The script will monitor the product prices and send notifications via Telegram when there are price changes.

📋 Sample Output

Here's an example of the output generated by the script:

Extracted data:
{
  "title": "Product Title",
  "price": "$19.99"
}

Please note that scraping websites without permission may violate the terms of service of the website and may have legal implications

About

Product Notifier is a script that monitors product prices and sends notifications via Telegram. It leverages Node.js, Cheerio, and the Telegram API to extract product information, track price changes, and notify users about the updates.

Resources

Stars

Watchers

Forks