TTOPM's picture
Upload 4 files
6654eed verified
raw
history blame contribute delete
599 Bytes
# src/protocol/security/alert_webhook.py
import requests
from datetime import datetime
class WebhookAlerter:
def __init__(self, webhook_url: str):
self.webhook_url = webhook_url
def send_alert(self, title: str, message: str):
payload = {
"content": f"๐Ÿšจ **{title}**\n๐Ÿ•’ {datetime.now().isoformat()}\n```\n{message}\n```"
}
try:
response = requests.post(self.webhook_url, json=payload)
response.raise_for_status()
except Exception as e:
print(f"[ALERT FAILURE] Could not send webhook alert: {e}")