A web-based dashboard for managing and monitoring SMS messages, built with Flask and MySQL.
Project description
Gammu SMS Web Manager
A simple yet powerful Flask web application for managing SMS messages stored by Gammu in a MySQL database. This tool provides a modern, real-time web interface to view, manage, and receive notifications for incoming SMS.
Features
- Modern UI: A clean, responsive user interface built with Tailwind CSS.
- Real-Time Notifications: Get instant browser notifications when a new SMS arrives.
- Live UI Updates: The message list updates automatically, without needing a page refresh.
- Bulk Actions: Select multiple messages to mark as read or delete them all at once.
- Easy Setup: Single-file application with minimal dependencies.
- Custom Modals: A polished user experience with custom confirmation dialogs instead of native browser alerts.
Prerequisites
- Python 3.13.1+
- A GSM modem or mobile phone that can be connected to your server. (I used GPRS SIM800 Module)
- A MySQL server.
- Poetry For dependency management.
- asdf (optional)
Part 1: Gammu Installation and Configuration
Before setting up the web app, you need to install and configure Gammu (smsdrc) to store SMS messages in your MySQL database.
1. Install Gammu and SMSD
On Debian-based Linux distributions (like Ubuntu or Raspberry Pi OS), you can install Gammu and the Gammu SMS Daemon (SMSD) using the package manager.
sudo apt-get update
sudo apt-get install gammu gammu-smsd
2. Configure gammu-smsd to Connect to Your Modem
First, you need to configure Gammu to recognize your modem.
- Connect your modem to the server. It will usually be available at a path like
/dev/ttyUSB0or/dev/ttyACM0. - Create
/etc/gammu-smsdrcfile like below:
sudo nano /etc/gammu-smsdrc
This is an example of gammu-smsdrc config:
[gammu]
device = /dev/ttyUSB0
connection = at115200
[smsd]
service = mysql
driver = native_mysql
host = localhost
user = gammu_user
password = "<password>"
database = gammu_db
logfile = /var/log/gammu-smsd.log
loglevel = debug
3. Set Up the MySQL Database
The Gammu SMSD service needs a database to store messages.
- Log in to your MySQL server and create a new database and user for Gammu.
CREATE DATABASE gammu\_db;
CREATE USER 'gammu\_user'@'localhost' IDENTIFIED BY 'your\_secret\_password';
GRANT ALL PRIVILEGES ON gammu\_db.\* TO 'gammu\_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;
-
Gammu comes with a SQL script to create the necessary tables. Find and import it into your new database. The path may vary, but it's often found here:
# The path to mysql.sql might be different on your system.mysql \-u gammu\_user \-p gammu\_db \< /usr/share/doc/gammu/examples/sql/mysql.sql
Part 2: Web App Setup and Installation
Now that Gammu is configured, you can set up the web application to manage the messages.
1. Clone the Repository
git clone <your-repository-url>
cd <your-repository-directory>
2. Install Dependencies
Use Poetry to install the required Python packages from the pyproject.toml file.
poetry install
3. Configure Environment Variables
Create a .env file to hold your database credentials. These must match the credentials you used for Gammu SMSD.
# You can create this from scratch or copy an example if one exists
nano .env
Add the following content to the .env file:
# .env file
DB_HOST=localhost
DB_USER=gammu_user
DB_PASSWORD='your_secret_password'
DB_NAME=gammu_db
SECRET_KEY='A long random string for flask sessions'
Important: The SECRET_KEY is used by Flask to secure user sessions. For generating a long, random string use this command python -c "import secrets; print(secrets.token_hex(32))"
4. Running the Application
Development Mode
Once the setup is complete, you can run the Flask application:
poetry run python app.py
You will see output in your terminal indicating that the server is running:
Starting Flask server...
Access the app at http://127.0.0.1:5000
Open your web browser and navigate to http://127.0.0.1:5000 to start using the SMS manager.
Production Mode
For production deployments, it is recommended to use a production-ready WSGI server like Gunicorn.
First, install Gunicorn (if not already installed):
poetry add gunicorn
Then, run the application with Gunicorn:
poetry run gunicorn app:app
You can adjust the number of worker processes and bind to a specific address/port as needed:
poetry run gunicorn -w 4 -b 0.0.0.0:5000 app:app
For best results, consider running Gunicorn behind a reverse proxy such as Nginx for improved security and performance.
Running with systemd and Gunicorn
To run the web application as a background service, you can create a systemd unit file for Gunicorn.
-
Create a systemd service file (replace
<your-user>and<your-repository-directory>as needed):sudo nano /etc/systemd/system/gammu-sms-web.service
-
Add the following content:
[Unit] Description=Gammu SMS Web Manager (Gunicorn) After=network.target [Service] User=<your-user> Group=www-data WorkingDirectory=/home/<your-user>/<your-repository-directory> Restart=on-failure Environment=POETRY_VIRTUALENVS_IN_PROJECT=true ExecStart=/usr/bin/poetry run gunicorn -w 4 -b 0.0.0.0:5000 app:app [Install] WantedBy=multi-user.target
-
Reload systemd and start the service:
sudo systemctl daemon-reload sudo systemctl start gammu-sms-web sudo systemctl enable gammu-sms-web
-
Check the status:
sudo systemctl status gammu-sms-web
Your Flask app will now run as a service and restart automatically if it crashes or the server reboots.
License
This project is open-source and available under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sms_dashboard-0.1.0.tar.gz.
File metadata
- Download URL: sms_dashboard-0.1.0.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8cf5f405d0c574be1f9b2c6c52d158339c531360628d1227dce538e6607d8d18
|
|
| MD5 |
0d99fc299c26709d0f89d906811108cd
|
|
| BLAKE2b-256 |
3bbb80db125ff686d9c4880e30fd1c62dd69bf98b81831557cf76bf4d94493b8
|
Provenance
The following attestation bundles were made for sms_dashboard-0.1.0.tar.gz:
Publisher:
publish.yml on mohammad-ahmadi1/sms-dashboard
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sms_dashboard-0.1.0.tar.gz -
Subject digest:
8cf5f405d0c574be1f9b2c6c52d158339c531360628d1227dce538e6607d8d18 - Sigstore transparency entry: 404841577
- Sigstore integration time:
-
Permalink:
mohammad-ahmadi1/sms-dashboard@57ec03ed747e6e81c99851750d306cf6f1f05b85 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/mohammad-ahmadi1
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@57ec03ed747e6e81c99851750d306cf6f1f05b85 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sms_dashboard-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sms_dashboard-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a8ad67e797519f894549f5cc5fc4c47be33edbdb303b3973e924fe77c8e9e1b
|
|
| MD5 |
e1d1470ab91fe24789a9cafef7da2394
|
|
| BLAKE2b-256 |
d72c3fd6c4e57b209ec7cf518958ae49292e715e82b96fe0074748bce47aa9c5
|
Provenance
The following attestation bundles were made for sms_dashboard-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on mohammad-ahmadi1/sms-dashboard
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sms_dashboard-0.1.0-py3-none-any.whl -
Subject digest:
4a8ad67e797519f894549f5cc5fc4c47be33edbdb303b3973e924fe77c8e9e1b - Sigstore transparency entry: 404841581
- Sigstore integration time:
-
Permalink:
mohammad-ahmadi1/sms-dashboard@57ec03ed747e6e81c99851750d306cf6f1f05b85 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/mohammad-ahmadi1
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@57ec03ed747e6e81c99851750d306cf6f1f05b85 -
Trigger Event:
push
-
Statement type: