Skip to content

ClientXCMS/telegram-webhook-notifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📡 Telegram Webhook Notifier

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

📁 Structure du projet

/telegram-webhook-notifier/
│
├── bot.py      # Version Python + Flask
├── bot.js      # Version Node.js + Express
├── .env        # Configuration
└── README.md   # Documentation

🚀 1. Installation

Clone le dossier :

git clone https://github.com/ClientXCMS/telegram-webhook-notifier.git
cd telegram-webhook-notifier
cp .env.example .env

🔐 Variables d’environnement

À définir dans un .env :

TELEGRAM_BOT_TOKEN=xxxxxxxxxxxxxxxxxxxxxx
TELEGRAM_CHAT_ID=123456789
HOST=0.0.0.0
PORT=8001

🐍 Pour la version Python

python3.x
pip install flask requests python-dotenv

🟨 Pour la version Node.js

node >= 18
npm install express axios dotenv

🧪 2. Lancement local

Python

python3 bot.py

Node.js

node bot.js

Le bot écoute maintenant sur :

http://localhost:8001/webhook

⚙️ 3. Démarrage via Pterodactyl (recommandé)

3.1 Créer un nouveau serveur

Dans Pterodactyl :

Créer un serveur ➡ Sélectionner un egg Python 3 ou egg Node.js ➡ Définir ton port : 8001

3.2 Déposer les fichiers

Dans le gestionnaire de fichiers :

  • bot.py
  • bot.js
  • .env
  • requirements.txt (Python)
  • package.json + package-lock.json (Node)

3.3 Démarrage Python

Dans "Startup Command" :

python3 bot.py

3.4 Démarrage Node.js

node bot.js

Le webhook reste en ligne tant que le serveur tourne.


4. Démarrage via systemd (Linux)

Python

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.target

Activer :

systemctl daemon-reload
systemctl enable --now webhook-python

Node.js

/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.target

Activer :

systemctl daemon-reload
systemctl enable --now webhook-node

🔗 5. Configuration côté CLIENTXCMS

L’URL à mettre dans CLIENTXCMS est :

https://votre-domaine.tld/webhook

Ou :

http://IP:8001/webhook
``

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published