Spaces:
Runtime error
Runtime error
Update services/salesforce_dispatcher.py
Browse files
services/salesforce_dispatcher.py
CHANGED
|
@@ -1,15 +1,24 @@
|
|
|
|
|
|
|
|
| 1 |
import requests
|
| 2 |
import json
|
| 3 |
|
| 4 |
SALESFORCE_WEBHOOK_URL = "https://your-salesforce-instance/services/web-to-case"
|
| 5 |
|
| 6 |
def send_to_salesforce(payload):
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# services/salesforce_dispatcher.py
|
| 2 |
+
|
| 3 |
import requests
|
| 4 |
import json
|
| 5 |
|
| 6 |
SALESFORCE_WEBHOOK_URL = "https://your-salesforce-instance/services/web-to-case"
|
| 7 |
|
| 8 |
def send_to_salesforce(payload):
|
| 9 |
+
"""
|
| 10 |
+
FAKE Salesforce integration — DISABLED in HuggingFace Space demo.
|
| 11 |
+
Replace SALESFORCE_WEBHOOK_URL later with real endpoint during production setup.
|
| 12 |
+
"""
|
| 13 |
+
print("🚀 [Salesforce Dispatch Simulated] Would have sent:", payload)
|
| 14 |
+
# Commenting actual POST request to avoid Space crash
|
| 15 |
+
#
|
| 16 |
+
# alert_type = "Intrusion" if any(d["label"] == "person" for d in payload["detections"]) else "Anomaly"
|
| 17 |
+
# summary = {
|
| 18 |
+
# "Alert_Type__c": alert_type,
|
| 19 |
+
# "ThermalFlag__c": payload["thermal"],
|
| 20 |
+
# "ShadowFlag__c": payload["shadow_issue"],
|
| 21 |
+
# "Confidence_Score__c": max([d["score"] for d in payload["detections"]], default=0)
|
| 22 |
+
# }
|
| 23 |
+
# headers = {"Content-Type": "application/json"}
|
| 24 |
+
# requests.post(SALESFORCE_WEBHOOK_URL, json=summary, headers=headers)
|