SuriRaja commited on
Commit
d902917
·
1 Parent(s): b5e153c

Update services/salesforce_dispatcher.py

Browse files
Files changed (1) hide show
  1. services/salesforce_dispatcher.py +18 -9
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
- 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)
 
 
 
 
 
 
 
 
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)