File size: 599 Bytes
6654eed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 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}")