This project is a Telegram Bot connected to a Telegram Channel that check Amazon offers and send them to your Channel.
Now you can run the script.sh
file from the terminal to install all dependencies, included paapi5 package. Open a terminal in the working directory, then type bash script.sh
and launch the command.
script.sh
method you can skip the following step.In order to use this bot you must complete the following steps:
Create a telegram bot (https://core.telegram.org/bots)
Create an Amazon Affiliation (https://programma-affiliazione.amazon.it/)
Put all of your keys (Amazon and Telegram API Keys) in the code, we are going to define how below
Install packages: In the root of the project run:
pip3 install -r requirements.txt
cd paapi5-python-sdk
python3 setup.py build
python3 setup.py install
cd ..
The project is organized like follow:
bot.py
consts.py
amazon_api.py
response_parser.py
create_messages
The bot is running in a while loop, you can define your favorite parameters for:
The bot is active if the time is between MIN_HOUR and MAX_HOUR (you can deactivate it during the night for example) , you can define these parameters in the code.
The do a break for defined PAUSE_MINUTE after sent a message.
You can also edit message body in create_messages.py
.
The bot make all http requests to Amazon API at start, save a list of all results in RAM and as long as there are items in results list it:
for all the activity time. When all results have been sent, it restart his loop.
bot.py
you need to specify your categories and a list of keywords for each category. The corresponding variable is categories
, it accept a dictionary like:{
"1_CATEGORY_NAME":[LIST OF KEYWORD],
"2_CATEGORY_NAME":[LIST OF KEYWORD]
}
After cloning the repository, define all parameters in the code, install all packages and then start bot with command:
python bot.py
or python3 bot.py
If you need support for the installation and usage of the library you can write to:
In order to mantain and improve the library consider to contribute:
This is a generated telegram channel message example, you can edit the message structure on create_messages.py
code.
Samir Salman