Skip to content

Latest commit

 

History

History

.github



A Telegram bot that send offers from Amazon.

View DemoReport BugRequest Feature


📌 NOTE 📌

The images in this readme are the result of further customization of this bot. In fact, as explained below, it is possible to customize various aspects of the product such as the image or title but this depends a lot on the result you want to obtain. For example, to personalize images, the use of an image storage system is required. However, the default version is more than sufficient to use the bot fully.



📔 Introduction

This bot is designed to send offers from Amazon to a Telegram channel. By providing different keywords, the bot will search for the best offers and return a series of products with the relative information. Then the information are parsed for extract only relevant information like:

  • Title
  • Bullet Points
  • Current Price
  • Original Price
  • Image
By using some basic algorithm the bot will select the best offers and send them to the channel. The diffent parameters are hihgly customizable and can be changed by the user. For Exaple you can change the number of products to send and when send it. The quantity of product to require through the Amazon Product Advertising API (PAAPI) and the working time. Also the image sended to the channel as a preview of the product can be changed.




The bot provide also a web page that show if the bot is still online and that provide a direct link to al the channels connected to the bot. You can find the web page localhost:8000 By default.

The background image of the product instead is highly costumazible. Also the font and the color of the text can be changed.


Web Page Personalized image example
Web Page Example Image


Important

  1. Since I haven't an account from another country I didn't test the bot in the different regions like UK, US, ESP, FR and so on. So I can't guarantee the bot will work in all the regions. But You can fix the problem in a couple of steps. Or you can report the problem here: Report Bug And I will fix it as soon as I wind an API Key for the tests.
  2. No responsibility is assumed for the use of the bot and the data it provides. The use of it at your own risk. To check the Amazon regulation about the PAAPI see the PAAPI Documentation section.
  3. To use this bot you need to have an Amazon account and an API key. You can require your API key here.
  4. The storage of any information returned by the PAAPI is NOT PERMITTED. To this reason it's difficult to know the difference between price of a product already send and the same product in the queue or other comparison. As mentioned here basically all the information returned by the PAAPI must be cancelled in a couple of hours (see here for more information). But the only data that is not mentioned so can assume it is possible to store is the product ASIN. This is used ONLY for preventing to send the same product more times in a certain period.
  5. If you want to support the project subscribe to one of the channel at this link: WebOfferte


🛠 Built in

This project is entirely written in Python and uses the Amazon Product Advertising API for the search of the products and the Telegram API to send the message. It use SQLite only for the part of the ASIN storage. There is also a part written in html and css for a web page to advice if the bot is still online and that provide a direct link to al the channels connected to the bot.


PythonSQLiteHTMLCSSBootStrapAmazon PAAPITelegram API


📋 Index


🧰 Prerequisites

There is two way to run the project:
  1. With Docker
  2. With the classic environment

If you want to use Docker you can skip this part and go to the next section. For the classic installation instead you need to install the required package. Start by creating the enviroment env.

    python3 -m venv env

You can Install all the requirement in one shot by using the following command:

    pip install -r requirements.txt

Alternatively you can install it one by one the package in the requirements.txt file.


⚙️ How to Start

Now we must set up the bot. There are different steps to follow to set up the bot. The steps must be followed in both cases, whether you are using Docker or the classic environment.

  1. Clone the repo

    git clone https://github.com/Piero24/TelegramBot-AmazonOffers.git
  2. Setup the api_Keys.py file with all the required from Amazon and Telegram. You can find an example here.

  3. Setup the settings.py file with all the required for running the bot. You can find an example here.

  4. Setup the category_keywords.py file with the categories and the keywords for the search. More information here.

  5. Facultative: There are many other parameters that can be changed. Here you can find more information about what you can do and where you can find it.


⚠️ ATTENTION ⚠️

Read the point 5 for more information for the personalized image.


At this moment all the parameters are set and the bot is ready to run. And the operations are different depending on whether you are using Docker or the classic environment.

Docker

Whit docker it's very easy to run the bot. You can run the bot with the following command:

  1. Open docker on your system (different for any platform) and run the following command via ssh or terminal:

    docker build -t REPO-NAME .

    Where REPO-NAME is the name of the repository. For example amazon-offers-bot. (Remember the dot at the end of the command).

  2. Run the bot with the following command:

    docker run -p 8000:8000 REPO-NAME

    Where REPO-NAME is the name of the repository. For example amazon-offers-bot.

Python Environment

  1. Open the terminal and go to the directory TelegramBot-AmazonOffers downloaded from the repository.

  2. Run the bot with the following command:

    python main.py

For any problem you can check the log file in the log folder.



📮 Responsible Disclosure

We assume no responsibility for an improper use of this code and everything related to it. We do not assume any responsibility for damage caused to people and / or objects in the use of the code.

By using this code even in a small part, the developers are declined from any responsibility.

It is possible to have more information by viewing the following links: Code of conductLicense


🐛 Bug and Feature

To report a bug or to request the implementation of new features, it is strongly recommended to use the ISSUES tool from Github »


Here you may already find the answer to the problem you have encountered, in case it has already happened to other people. Otherwise you can report the bugs found.


ATTENTION: To speed up the resolution of problems, it is recommended to answer all the questions present in the request phase in an exhaustive manner.

(Even in the phase of requests for the implementation of new functions, we ask you to better specify the reasons for the request and what final result you want to obtain).




🔍 License

APACHE LICENSE
Version 2.0, Jan 2004

"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.

"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License...

License Documentation »


📌 Third Party Licenses

In the event that the software uses third-party components for its operation,
the individual licenses are indicated in the following section.

Software list:

Software License owner License type Link
pyTelegramBotAPI eternnoir GPL-2.0 license here
flag cvzi MIT License here
python-holidays vacanza MIT License here


Copyrright (C) by Pietrobon Andrea
Released date: Jan 2024