File size: 988 Bytes
197e2d4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# services/salesforce_dispatcher.py

import requests
import json

SALESFORCE_WEBHOOK_URL = "https://your-salesforce-instance/services/web-to-case"

def send_to_salesforce(payload):
    """
    FAKE Salesforce integration β€” DISABLED in HuggingFace Space demo.
    Replace SALESFORCE_WEBHOOK_URL later with real endpoint during production setup.
    """
    print("πŸš€ [Salesforce Dispatch Simulated] Would have sent:", payload)
    # Commenting actual POST request to avoid Space crash
    #
    # alert_type = "Intrusion" if any(d["label"] == "person" for d in payload["detections"]) else "Anomaly"
    # summary = {
    #     "Alert_Type__c": alert_type,
    #     "ThermalFlag__c": payload["thermal"],
    #     "ShadowFlag__c": payload["shadow_issue"],
    #     "Confidence_Score__c": max([d["score"] for d in payload["detections"]], default=0)
    # }
    # headers = {"Content-Type": "application/json"}
    # requests.post(SALESFORCE_WEBHOOK_URL, json=summary, headers=headers)