Skip to content

A serverless notification bot to spot TooGoodToGo magic bags before everyone else, ensuring you never miss a deal! ๐Ÿš€

License

Notifications You must be signed in to change notification settings

jordantete/TooGoodNotify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

32 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

TooGoodNotify

License: MIT

MarineGEO circle logo

๐Ÿ“Œ Overview

TooGoodNotify is a customizable notification bot for TooGoodToGo (TGTG) deals, designed to monitor TGTG magic bags and notify users via Telegram. The bot is built with a modular architecture and is optimized for efficient event-driven operations, making it easy to deploy in a serverless environment on AWS Lambda or any other cloud provider (GCP, Azure, etc.). It is ready to be customized and adapted to fit your needs.

๐Ÿš€ Features

  • ๐Ÿ”„ Automated Monitoring: Tracks TGTG magic bags on a set schedule and sends timely notifications.
  • ๐Ÿ’ฌ Telegram Integration: Allows users to interact with the bot through Telegram commands.
  • ๐ŸŒ Multi-language Support: Available in English and French.
  • โ˜๏ธ Cloud Compatibility: Optimized for AWS Lambda, but easily customizable for other cloud providers like GCP and Azure.
  • ๐Ÿ› ๏ธ Modular Architecture: Easy to extend and adapt to new use cases.

๐Ÿง‘โ€๐Ÿ’ป Setup Instructions

๐Ÿ–ฅ๏ธ Prerequisites

  1. Cloud Account (AWS, GCP, Azure, etc.)

    • AWS: This bot is primarily designed for AWS Lambda. You will need an AWS account to deploy the bot, but it can also be customized for other cloud platforms like GCP or Azure. If you are using AWS, youโ€™ll need to configure your AWS credentials and region.
    • Other Cloud Providers: If you're using GCP or Azure, you'll need to update the serverless.yml configuration to match the settings for your chosen provider (e.g., gcp or azure).
  2. Telegram Bot Token & Chat ID

    • Telegram Bot Token: This bot requires a Telegram Bot Token to communicate with Telegram's API.
    • Chat ID: The bot needs the chat_id of the user or group to send notifications.

๐Ÿš€ Installation

  1. Clone the Repository:
git clone https://github.com/jordantete/TooGoodNotify.git
cd TooGoodNotify
  1. Set Up Conda Environment:
conda env create -f environment.yml
conda activate too_good_notify_env
  1. Configure Environment Variables in Conda:

To set multiple environment variables at once, use a .env file. This is faster and keeps your configuration organized.

At the root of the project, create a .env file and add the necessary environment variables:

# .env
USER_EMAIL=your_user_email@example.com
TELEGRAM_BOT_TOKEN=your_telegram_bot_token
TELEGRAM_CHAT_ID=your_telegram_chat_id
AWS_ACCOUNT_ID=your_aws_user_account_id
DEFAULT_AWS_REGION=your_aws_region
  1. Creating the Lambda Layer:

To create the Lambda layer, use the following commands:

cd lambda_layer
mkdir -p python
pip install \
    --platform manylinux2014_x86_64 \
    --target=python \
    --implementation cp \
    --python-version 3.10 \
    --only-binary=:all: \
    -r requirements_layer.txt
zip -r lambda_layer.zip python/
aws lambda publish-layer-version --layer-name TooGoodNotifyLayer --description "Layer for dependencies" --zip-file fileb://lambda_layer.zip --compatible-runtimes python3.10

โ˜๏ธ Cloud Deployment

AWS Setup

  • You must have an AWS account to deploy your bot. This bot uses AWS Lambda for serverless deployment, but it can be easily adapted to other cloud providers like GCP or Azure by updating the serverless.yml configuration file.

To deploy to AWS:

  1. Configure the AWS CLI

    aws configure
  2. Deploy with Serverless Framework

    • Install the Serverless framework if you havenโ€™t already:

      npm install -g serverless
    • Deploy the bot to AWS Lambda using the Serverless framework:

      serverless deploy --stage dev

    Customizing for GCP or Azure: You can easily adapt this project for GCP or Azure by modifying the serverless.yml file. Serverless makes it easy to switch providersโ€”just update the provider configuration.

๐Ÿ› ๏ธ Telegram Setup

To interact with the bot, you need to create a Telegram Bot and get its bot_token and your chat_id:

  1. Create a Telegram Bot

    • Open the Telegram app and search for the BotFather.
    • Start a chat with the BotFather and use the command /newbot.
    • Follow the instructions to create your bot and get the Bot Token.
  2. Get Your Chat ID

    • Send a message to your bot to start a conversation.
    • Use the following URL to find your chat ID:
      https://api.telegram.org/bot<YourBotToken>/getUpdates
      
    • This will return a JSON response containing your chat ID.

๐Ÿค Contributing

Contributions are welcome! If you have ideas, improvements, or bug fixes, feel free to submit an issue or a pull request. Please ensure that your contributions follow the projectโ€™s coding standards and include clear descriptions for any changes.

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for more details.

๐Ÿ‘€ Feedback

Have any questions or feedback? Feel free to reach out via the issues tab on GitHub. Weโ€™d love to hear from you!

โ— Disclaimer

TooGoodNotify is an independent project and is not affiliated with, endorsed by, or officially connected to TooGoodToGo (TGTG) or any of its subsidiaries or affiliates. All product names, logos, and brands are property of their respective owners.

About

A serverless notification bot to spot TooGoodToGo magic bags before everyone else, ensuring you never miss a deal! ๐Ÿš€

Topics

Resources

License

Stars

Watchers

Forks

Languages