Envoi automatique d’alertes Telegram pour tous les événements CLIENTXCMS :
- 🟦 Helpdesk : création, réponses, fermeture
- 🟧 Services : renouvellement, upgrade
- 🟩 Paiements : commande payée
Ce projet fournit deux implémentations :
| Langage | Fichier | Description |
|---|---|---|
| 🐍 Python | bot.py |
Version Flask simple, performante, facile à héberger |
| 🟨 Node.js | bot.js |
Version Express avec logique identique |
/telegram-webhook-notifier/
│
├── bot.py # Version Python + Flask
├── bot.js # Version Node.js + Express
├── .env # Configuration
└── README.md # Documentation
Clone le dossier :
git clone https://github.com/ClientXCMS/telegram-webhook-notifier.git
cd telegram-webhook-notifier
cp .env.example .envÀ définir dans un .env :
TELEGRAM_BOT_TOKEN=xxxxxxxxxxxxxxxxxxxxxx
TELEGRAM_CHAT_ID=123456789
HOST=0.0.0.0
PORT=8001
python3.x
pip install flask requests python-dotenv
node >= 18
npm install express axios dotenv
python3 bot.pynode bot.jsLe bot écoute maintenant sur :
http://localhost:8001/webhook
Dans Pterodactyl :
➡ Créer un serveur ➡ Sélectionner un egg Python 3 ou egg Node.js ➡ Définir ton port : 8001
Dans le gestionnaire de fichiers :
bot.pybot.js.envrequirements.txt(Python)package.json+package-lock.json(Node)
Dans "Startup Command" :
python3 bot.py
node bot.js
Le webhook reste en ligne tant que le serveur tourne.
Créer /etc/systemd/system/webhook-python.service :
[Unit]
Description=CLIENTXCMS Webhook Bot (Python)
After=network.target
[Service]
User=root
WorkingDirectory=/opt/webhook-bot
ExecStart=/usr/bin/python3 /opt/webhook-bot/bot.py
Restart=always
EnvironmentFile=/opt/webhook-bot/.env
[Install]
WantedBy=multi-user.targetActiver :
systemctl daemon-reload
systemctl enable --now webhook-python/etc/systemd/system/webhook-node.service :
[Unit]
Description=CLIENTXCMS Webhook Bot (Node.js)
After=network.target
[Service]
User=root
WorkingDirectory=/opt/webhook-bot
ExecStart=/usr/bin/node /opt/webhook-bot/bot.js
Restart=always
EnvironmentFile=/opt/webhook-bot/.env
[Install]
WantedBy=multi-user.targetActiver :
systemctl daemon-reload
systemctl enable --now webhook-nodeL’URL à mettre dans CLIENTXCMS est :
https://votre-domaine.tld/webhook
Ou :
http://IP:8001/webhook
``