Spaces:
Runtime error
Runtime error
| # 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) | |