Rememby Bot is a Telegram bot designed to help you create, manage, and track reminders. It uses FastAPI as the backend framework and APScheduler for task scheduling.
- Create reminders with
/remind <message> <YYYY-MM-DD:HH:MM>
format. - Automatically schedules reminders and notifies you via Telegram.
- Persistent data storage using SQLite.
To set up and run this project locally, ensure you have the following installed:
- Python 3.8+ (compatible with
python-telegram-bot
andFastAPI
). - Pipenv or virtualenv (recommended for virtual environment management).
ngrok
or an alternative tunneling service for webhook testing.
git clone https://github.com/SaulEiros/Rememby.git
cd Rememby
Using venv
:
python3 -m venv rememby_env
source rememby_env/bin/activate # On Windows, use `rememby_env\Scripts\activate`
Install the required Python packages:
pip install -r requirements.txt
- Open the
.env
file in the project root. - Add your Telegram bot token:
TELEGRAM_BOT_TOKEN=your_bot_token_here
In order to get a bot token, you need to follow this guide.
- Ensure SQLite is installed (it comes pre-installed with Python).
- Ensure you have the
data
folder in the project root. A file namedreminders.db
should be inside that folder. - Run the database initialization script:
This script will create the necessary tables in the SQLite database.
python app/database.py
For ensure the status of this step, you can run the script database.py
for check that the tables are created.
Start the FastAPI server:
uvicorn app.main:app --host 0.0.0.0 --port 5001
Use Cloudflare Tunnel to expose your local server to the internet:
-
Install Cloudflare Tunnel:
brew install cloudflared # macOS sudo apt install cloudflared # Ubuntu
-
Run the Cloudflare Tunnel command:
cloudflared tunnel --url http://localhost:5001
-
Note the public URL provided by Cloudflare (e.g.,
https://your-cloudflare-url
).
In the utils
folder, there is a script called webhook.py
that automates setting up and verifying your Telegram bot's webhook.
The script performs the following:
- Sets your bot's webhook to the public URL provided by Cloudflare.
- Verifies the webhook setup by fetching the current webhook info.
- Replace
YOUR_TELEGRAM_TOKEN
in the script with your actual bot token. - Replace
YOUR_PUBLIC_URL
with the public URL from Cloudflare Tunnel. - Run the script:
python utils/webhook.py
- The script will output the result of the webhook setup and its current status.
- Open Telegram and search for your bot using its name or username.
- Test the
/remind
command:/remind "Buy groceries" 2025-01-26:15:00
- Confirm that the bot schedules the reminder and sends you a message at the specified time.
rememby/
├── app/
│ ├── __init__.py
│ ├── main.py # Entry point for the FastAPI server
│ ├── database.py # SQLite database initialization and connection
│ ├── scheduler.py # APScheduler configuration
│ ├── handlers/ # Telegram command handlers
│ ├── __init__.py
│ ├── start_handler.py # /start command
│ ├── remind_handler.py # /remind command
│ ├── help_handler.py # /help command
├── data/
│ ├── reminders.db # SQLite folder
├── utils/
│ ├── database.py # Script for checking database integrity
│ ├── webhook.py # Script for setting up Telegram webhook
├── .env # Environment variables
├── .gitignore # Git exclusions file
├── requirements.txt # Python dependencies
├── LICENSE # Project License
└── README.md # Project documentation
Feel free to contribute to this project! Please fork the repository, make your changes, and submit a pull request.
This project is licensed under the APACHE 2.0 License. See the LICENSE file for details.
If you encounter any issues, please open an issue on the GitHub repository.