feat: add Telegram notifications for user signup and Stripe events
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m34s

This commit is contained in:
2026-06-07 11:37:01 +02:00
parent 8659b6761f
commit 29753881a6
3 changed files with 122 additions and 0 deletions

View File

@@ -272,6 +272,21 @@ async def register_v1(request: Request):
try:
user = create_user(user_create)
# Alert admin via Telegram on signup
try:
from utils.telegram import send_telegram_notification
import asyncio
msg = (
f"👤 *Nouvelle inscription !*\n\n"
f"• *Email* : `{user.email}`\n"
f"• *Nom* : `{user.name or 'Non renseigné'}`\n"
f"• *ID* : `{user.id}`\n"
f"• *Forfait* : `{user.plan.value}`\n"
f"• *Date* : {datetime.now(timezone.utc).strftime('%d/%m/%Y %H:%M:%S')} UTC"
)
asyncio.create_task(send_telegram_notification(msg))
except Exception as tel_err:
logger.error(f"Failed to send telegram notification: {tel_err}")
except ValueError as exc:
msg = str(exc).strip().lower()
if "email already registered" in msg or "email already" in msg: