Telefizz π€
A production-ready webhook relay that transforms Fizzy notifications into Telegram messages using Clean Architecture principles.
Overview
Telefizz listens for webhook events from Fizzy and instantly relays them to Telegram. Built with Clean Architecture for maintainability, it's designed to be self-hosted, scalable, and easy to understand.
Perfect for teams that want real-time Fizzy notifications without context-switching.
Features
β¨ Real-time Notifications - Instant Telegram alerts for Fizzy events
π Secure - HMAC-SHA256 signature verification for webhook authenticity
ποΈ Clean Architecture - Well-organized, testable, and maintainable codebase
π³ Containerized - Production-ready Docker setup with Kamal deployment
π Zero-Downtime Deploys - Automatic rolling updates via Kamal
β
Health Checks - Built-in /up endpoint for monitoring
Supported Events
- π Card Published
- π Card Board Changed
- π¬ Comment Created
- π€ Card Assigned / Unassigned
- π·οΈ Card Triaged
- β Card Closed / Reopened
- βΈοΈ Card Postponed
- π Card Sent Back to Triage
Quick Start
Local Development
-
Clone and install dependencies:
git clone <repository> cd telefizz bundle install
-
Configure environment variables:
Edit
.envwith your credentials:TELEGRAM_BOT_TOKEN=your_bot_token_here TELEGRAM_CHAT_ID=your_chat_id_here FIZZY_WEBHOOK_SECRET=your_webhook_secret_here
-
Run the application:
The app will be available at
http://localhost:9292 -
Run tests:
API Endpoints
| Method | Endpoint | Purpose |
|---|---|---|
GET |
/up |
Health check (returns 200 OK) |
POST |
/webhook |
Fizzy webhook receiver |
Deployment with Kamal
Telefizz is production-ready with Kamal, a zero-downtime deployment tool for containerized applications.
Prerequisites
- Docker installed on your deployment server
- SSH access to your server
- A domain name with DNS pointing to your server
Setup
-
Install Kamal:
-
Configure deployment:
Edit
config/deploy.yml:- Update
servers.webwith your server IP (or setSERVER_IPin.env) - Update
proxy.hostwith your domain (or setAPP_HOSTin.env) - Configure registry credentials if using a private registry
- Update
-
Create
.envfile with your secrets:cp .env.example .env # Edit .env with actual valuesπ‘ Tip: We recommend using the dotenv gem for to easily handle your credentials. Install it globally and use
dotenv kamal setupinstead ofkamal setupto automatically load your.envfile. Of course, you can also use a Password Manager as per Kamals Documentation. -
Deploy:
# With dotenv dotenv kamal setup # First-time setup dotenv kamal deploy # Deploy your app # Or without dotenv kamal setup kamal deploy
Kamal Commands
# View deployment status kamal status # View container logs kamal logs # Execute a command in the container kamal app exec "command" # Rollback to previous version kamal rollback # Stop the application kamal stop # Start the application kamal start # Redeploy current version kamal redeploy
SSL/TLS
Kamal automatically provisions free SSL certificates via Let's Encrypt. Update config/deploy.yml:
proxy: ssl: true host: your-domain.com
Architecture
Telefizz follows Clean Architecture principles for maximum maintainability:
lib/
βββ entities/ # Domain objects
β βββ event.rb # Webhook event representation
β βββ message.rb # Telegram message representation
βββ use_cases/ # Business logic
β βββ process_webhook_event.rb
βββ interfaces/ # Controllers and gateways
β βββ webhook_controller.rb
β βββ gateways/
β βββ message_gateway.rb
βββ infrastructure/ # External services
βββ telegram_message_gateway.rb
Key Concepts
- Entities: Pure domain objects with no external dependencies
- Use Cases: Application business logic, independent of delivery mechanism
- Interfaces: Controllers (HTTP handlers) and gateway interfaces
- Infrastructure: Concrete implementations of external integrations (Telegram API)
This structure allows you to:
- Test business logic without HTTP or external service mocking
- Easily swap implementations (e.g., different notification services)
- Understand the codebase at a glance
Development
Running Tests
Project Structure
telefizz/
βββ app.rb # Sinatra application entry point
βββ config.ru # Rack configuration
βββ Gemfile # Ruby dependencies
βββ Gemfile.lock # Locked dependency versions
βββ Dockerfile # Production container definition
βββ config/
β βββ deploy.yml # Kamal deployment configuration
βββ lib/ # Application code
βββ test/ # Test files
Configuration Reference
Environment Variables
| Variable | Required | Description |
|---|---|---|
TELEGRAM_BOT_TOKEN |
β | Your Telegram bot token from @BotFather |
TELEGRAM_CHAT_ID |
β | Chat ID where messages will be sent |
FIZZY_WEBHOOK_SECRET |
β | Secret key for webhook signature verification |
SERVER_IP |
(Kamal) | IP address of your deployment server |
APP_HOST |
(Kamal) | Domain name for your app |
Kamal Configuration
See config/deploy.yml for all available options. Key settings:
servers.web: Your deployment server(s)proxy.host: Your domain nameproxy.ssl: Enable HTTPS (default: true)env.secret: Environment variables to inject into containers
Monitoring
The /up endpoint provides a health check for monitoring solutions:
curl https://your-domain.com/up
# Returns: 200 OKUse this with Kamal's health checks, monitoring services, or load balancers to ensure your app stays running.
Security
- β Webhook signatures verified via HMAC-SHA256
- β Runs as non-root user in container
- β Environment secrets never committed to git
- β SSL/TLS encryption enabled by default
Troubleshooting
Webhook not receiving events
- Verify
FIZZY_WEBHOOK_SECRETmatches your Fizzy webhook configuration - Check logs:
kamal logs - Test webhook manually with cURL
SSL Certificate issues
Kamal automatically handles Let's Encrypt certificates. If issues persist:
kamal redeploy # Restart to refresh certificatesContributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
For issues, questions, or suggestions, please open an issue on GitHub.
Made with β€οΈ for real-time notifications