File size: 620 Bytes
9c1122b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import requests
import json

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

def send_to_salesforce(payload):
    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)