Spaces:
Build error
Build error
Update services/salesforce_dispatcher.py
Browse files
services/salesforce_dispatcher.py
CHANGED
@@ -4,12 +4,12 @@ import json
|
|
4 |
SALESFORCE_WEBHOOK_URL = "https://your-salesforce-instance/services/web-to-case"
|
5 |
|
6 |
def send_to_salesforce(payload):
|
7 |
-
|
8 |
summary = {
|
9 |
-
"Alert_Type__c":
|
10 |
-
"
|
11 |
-
"
|
12 |
-
"
|
13 |
}
|
14 |
headers = {"Content-Type": "application/json"}
|
15 |
-
requests.post(SALESFORCE_WEBHOOK_URL, json=summary, headers=headers)
|
|
|
4 |
SALESFORCE_WEBHOOK_URL = "https://your-salesforce-instance/services/web-to-case"
|
5 |
|
6 |
def send_to_salesforce(payload):
|
7 |
+
alert_type = "Intrusion" if any(d["label"] == "person" for d in payload["detections"]) else "Anomaly"
|
8 |
summary = {
|
9 |
+
"Alert_Type__c": alert_type,
|
10 |
+
"ThermalFlag__c": payload["thermal"],
|
11 |
+
"ShadowFlag__c": payload["shadow_issue"],
|
12 |
+
"Confidence_Score__c": max([d["score"] for d in payload["detections"]], default=0)
|
13 |
}
|
14 |
headers = {"Content-Type": "application/json"}
|
15 |
+
requests.post(SALESFORCE_WEBHOOK_URL, json=summary, headers=headers)
|