SS_solar_POC_ver-1.0 / services /salesforce_dispatcher.py
SathvikGanta's picture
Upload 16 files
197e2d4 verified
raw
history blame contribute delete
988 Bytes
# 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)