Get instant Telegram notifications for your private GitHub repository commits!
Never miss a commit again. This lightweight webhook server bridges GitHub push events directly to your Telegram chat with beautifully formatted notifications.
- 🔔 Instant notifications for every push to your repo
- 📝 Rich commit details including author, message, and direct links
- 🔐 Secure webhook verification with HMAC signatures
- 🎨 Beautiful Markdown formatting in Telegram messages
- 🚀 Lightweight & fast Flask-based server
- 🔧 Easy setup with environment variables
When someone pushes to your repo, you'll get a notification like this:
🔄 New Push to my-awesome-repo
📁 Repository: my-awesome-repo
🌿 Branch: main
👤 Pushed by: mars
📝 Commits: 2
• a1b2c3d Fix authentication bug - mars
• e4f5g6h Add new feature endpoint - mars
- Message @BotFather on Telegram
- Send
/newbotand follow the prompts - Save your bot token and username
- Start a chat with your bot and send any message
git clone <your-repo>
cd github-telegram-webhook
pip install -r requirements.txtCopy and customize the environment file:
cp .env.example .envEdit .env with your details:
GITHUB_WEBHOOK_SECRET=your_super_secret_key_here
TELEGRAM_BOT_TOKEN=1234567890:ABCdefGHIjklMNOpqrsTUVwxyz
TELEGRAM_BOT_USERNAME=YourBotUsername
TELEGRAM_CHAT_ID=123456789
PORT=5000# Development
python main.py
# Production (recommended)
pip install waitress
waitress-serve --host=0.0.0.0 --port=5000 webhook_server:app- Go to your repo → Settings → Webhooks → Add webhook
- Payload URL:
http://your-server-domain-or-ip.com:5000/webhook - Content type:
application/json - Secret: Same as your
GITHUB_WEBHOOK_SECRET - Events: Select "Just the push event"
- ✅ Active
| Variable | Description | Required | Example |
|---|---|---|---|
GITHUB_WEBHOOK_SECRET |
Secret key for webhook verification | ✅ | my_super_secret_123 |
TELEGRAM_BOT_TOKEN |
Your bot token from BotFather | ✅ | 1234567890:ABC... |
TELEGRAM_BOT_USERNAME |
Your bot's username (optional) | ❌ | MyAwesomeBot |
TELEGRAM_CHAT_ID |
Your chat ID for notifications | ✅ | 123456789 |
PORT |
Server port | ❌ | 5000 |
Test your webhook locally:
# Health check
curl http://localhost:5000/health🚫 Webhook not receiving requests
- Check if your server is accessible:
curl http://your-server:port/health - Verify firewall settings:
sudo ufw status - Check GitHub webhook delivery logs in repo settings
- Ensure webhook URL is correct and includes
/webhookpath
📱 Not receiving Telegram messages
- Verify bot token:
curl https://api.telegram.org/bot<TOKEN>/getMe - Check chat ID:
curl https://api.telegram.org/bot<TOKEN>/getUpdates - Ensure you've started a chat with your bot
- Check server logs for error messages
🔐 Signature verification failed
- Ensure
GITHUB_WEBHOOK_SECRETmatches webhook secret in GitHub - Check that content-type is
application/json - Verify webhook is sending to correct endpoint
MIT License - feel free to use this for your projects!
Made with ❤️ for developers who love staying updated
⭐ Star this repo if it helped you!