diff --git a/.dev_session/SESSION_INFO b/.dev_session/SESSION_INFO index 91b54e37..e95e5868 100644 --- a/.dev_session/SESSION_INFO +++ b/.dev_session/SESSION_INFO @@ -1 +1 @@ -{"task_id": "31888f42-8544-80c2-9851-fafa44290994", "token": "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", "readme_path": "content-engine/README.md", "session_start_time": "2026-03-03T10:40:18.337597"} \ No newline at end of file +{"task_id": "2ea88f42-8544-8005-9344-e85c9b2ef5ec", "token": "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", "readme_path": "MIGRATION_PLAN.md", "session_start_time": "2026-03-04T15:14:09.546338"} \ No newline at end of file diff --git a/connector-superoffice/register_webhook.py b/connector-superoffice/register_webhook.py index c64370de..441c859d 100644 --- a/connector-superoffice/register_webhook.py +++ b/connector-superoffice/register_webhook.py @@ -1,11 +1,17 @@ import sys import os -from superoffice_client import SuperOfficeClient +import os +import sys from dotenv import load_dotenv +# Load .env BEFORE importing SuperOfficeClient to ensure settings are correctly initialized +load_dotenv(os.path.join(os.path.dirname(__file__), "../.env"), override=True) + +from superoffice_client import SuperOfficeClient + # Configuration WEBHOOK_NAME = "Gemini Connector Production" -TARGET_URL = f"https://floke-ai.duckdns.org/connector/webhook?token={os.getenv('WEBHOOK_TOKEN', 'changeme')}" +TARGET_URL = f"https://floke-ai.duckdns.org/connector/webhook?token={os.getenv('WEBHOOK_TOKEN')}" EVENTS = [ "contact.created", "contact.changed", @@ -14,14 +20,17 @@ EVENTS = [ ] def register(): - load_dotenv("../.env") - print("🚀 Initializing SuperOffice Client...") + print(f"🚀 Initializing SuperOffice Client for Production...") try: client = SuperOfficeClient() except Exception as e: print(f"❌ Failed to connect: {e}") return + if not client.access_token: + print("❌ Auth failed. Check SO_CLIENT_ID and SO_REFRESH_TOKEN in .env") + return + print("🔎 Checking existing webhooks...") webhooks = client._get("Webhook") @@ -32,17 +41,26 @@ def register(): # Check if URL matches if wh['TargetUrl'] != TARGET_URL: - print(f" ⚠️ URL Mismatch! Deleting old webhook...") - # Warning: _delete is not implemented in generic client yet, skipping auto-fix + print(f" ⚠️ URL Mismatch!") + print(f" Existing: {wh['TargetUrl']}") + print(f" New: {TARGET_URL}") print(" Please delete it manually via API or extend client.") + else: + print(f" ✅ Webhook is up to date.") return print(f"✨ Registering new webhook: {WEBHOOK_NAME}") + + webhook_secret = os.getenv('WEBHOOK_SECRET') + if not webhook_secret: + print("❌ Error: WEBHOOK_SECRET missing in .env") + return + payload = { "Name": WEBHOOK_NAME, "Events": EVENTS, "TargetUrl": TARGET_URL, - "Secret": "changeme", # Used for signature calculation by SO + "Secret": webhook_secret, # Used for signature calculation by SO "State": "Active", "Type": "Webhook" } diff --git a/debug_notion_time.py b/debug_notion_time.py new file mode 100644 index 00000000..d486c2ef --- /dev/null +++ b/debug_notion_time.py @@ -0,0 +1,85 @@ +import os +import json +import requests +from dotenv import load_dotenv + +load_dotenv() + +SESSION_FILE = ".dev_session/SESSION_INFO" + +def debug_notion(): + if not os.path.exists(SESSION_FILE): + print("No session file found.") + return + + with open(SESSION_FILE, "r") as f: + data = json.load(f) + + task_id = data.get("task_id") + token = data.get("token") + + print(f"Debug Info:") + print(f"Task ID: {task_id}") + print(f"Token (first 4 chars): {token[:4]}...") + + url = f"https://api.notion.com/v1/pages/{task_id}" + headers = { + "Authorization": f"Bearer {token}", + "Notion-Version": "2022-06-28", + "Content-Type": "application/json" + } + + # 1. Fetch Page + print("\n--- Fetching Page Properties ---") + resp = requests.get(url, headers=headers) + if resp.status_code != 200: + print(f"Error fetching page: {resp.status_code}") + print(resp.text) + return + + page_data = resp.json() + properties = page_data.get("properties", {}) + + print(f"Found {len(properties)} properties:") + target_prop_name = "Total Duration (h)" + found_target = False + + for name, prop in properties.items(): + type_ = prop.get("type") + val = prop.get(type_) + print(f"- '{name}' ({type_}): {val}") + if name == target_prop_name: + found_target = True + + if not found_target: + print(f"\nCRITICAL: Property '{target_prop_name}' NOT found on this task!") + # Check for similar names + for name in properties.keys(): + if "duration" in name.lower() or "zeit" in name.lower() or "hours" in name.lower(): + print(f" -> Did you mean: '{name}'?") + return + + # 2. Try Update + print(f"\n--- Attempting Update of '{target_prop_name}' ---") + current_val = properties[target_prop_name].get("number") or 0.0 + print(f"Current Value: {current_val}") + + new_val = current_val + 0.01 + print(f"Updating to: {new_val}") + + update_payload = { + "properties": { + target_prop_name: {"number": new_val} + } + } + + patch_resp = requests.patch(url, headers=headers, json=update_payload) + if patch_resp.status_code == 200: + print("✅ Update Successful!") + print(f"New Value on Server: {patch_resp.json()['properties'][target_prop_name].get('number')}") + else: + print(f"❌ Update Failed: {patch_resp.status_code}") + print(patch_resp.text) + +if __name__ == "__main__": + debug_notion() diff --git a/env_old5 b/env_old5 new file mode 100644 index 00000000..7963dc26 --- /dev/null +++ b/env_old5 @@ -0,0 +1,35 @@ +# In diese Datei können sensible Umgebungsvariablen wie API-Schlüssel eingetragen werden. +# Sie wird von der Anwendung geladen, aber nicht in Git eingecheckt. + +GEMINI_API_KEY="AIzaSyBNg5yQ-dezfDs6j9DGn8qJ8SImNCGm9Ds" +GITEA_TOKEN="318c736205934dd066b6bbcb1d732931eaa7c8c4" +GITEA_USER="Floke" +NOTION_API_KEY="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" +SO_SOD="f8f918c67fc6bcd59b4a53707a6662a0" +SO_STAGE="e913252ce3fb6d8421df5893edf0973c" +SO_PRODUCTION="0fd8272803551846f7212a961a1a0046" +SO_CLIENT_SECRET="418c424681944ad4138788692dfd7ab2" +SO_REFRESH_TOKEN='1x4vJ2fL0Hje8s5RKHnyxtzRpmsJBE2Bf0MO1TPM9OuyHA7OTCKx9kdmkQCzKHHF' +SO_REFRESH_TOKEN_PROD="1x4vJ2fL0Hje8s5RKHnyxtzRpmsJBE2Bf0MO1TPM9OuyHA7OTCKx9kdmkQCzKHHF" +SO_SYSTEM_USER_TOKEN="" +SO_CONTEXT_IDENTIFIER='Cust26720' +SO_PRIVATE_KEY="MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBANz5YWSoodUvQCprDnJz7kuhXz8mHSoOpbQlMqbeBDotvvqDOTtumBcTgwbUBzvlJrBKDXM+l9gOQRPZL+MvF8r/oQ8UKx7Mmr65KtmJ+TH/wRQKrmLkaF+Rbbx+obfspZXwSULN8BPZvzvCyh6JihOR14mlf0DA0S6GHgMM0MHBAgMBAAECgYEAi8TdWprjSgHKF0qB59j2WDYpFbtY5RpAq3J/2FZD3DzFOJU55SKt5qK71NzV+oeV8hnU6hkkWE+j0BcnGA7Yf6xGIoVNVhrenU18hrd6vSUPDeOuerkv+u98pNEqs6jcfYwhKKEJ2nFl4AacdQ7RaQPEWb41pVYvP+qaX6PeQAECQQDx8ZGLzjp9EJtzyhpQafDV1HYFc6inPF8Ax4oQ4JR5E/9iPWRRxb2TjNR5oVza6md8B5RtffwGTlVbl50IMiMBAkEA6c/usvg8/4quH8Z70tSotmN+N6UxiuaTF51oOeTnIVUjXMqB3gc5sRCbipGj1u+DJUYh4LQLZp+W2LU7uCpewQJBAMtqvGFcIebW2KxwptEnUVqnCBerV4hMBOBF5DouaAaonpa9YSQzaiGtTVN6LPTOEfXA9bVdMFEo+TFJ9rhWVwECQQDJz37xnRBRZWsL5C8GeCWzX8cW0pAjmwdFL8lBh1D0VV8zfVuAv+3M5k/K2BB5ubwR1SnyoJTinEcAf9WvDWtBAkBVfhJHFVDXfR6cCrD0zQ3KX7zvm+aFzpxuwlBDcT98mNC+QHwSCPEGnolVN5jVTmBrnoe/OeCiaTffmkDqCWLQ" +SO_CLIENT_ID='0fd8272803551846f7212a961a1a0046' +SO_ENVIRONMENT='online3' +UDF_SUBJECT='SuperOffice:19' +UDF_INTRO='SuperOffice:20' +UDF_SOCIAL_PROOF='SuperOffice:21' +UDF_OPENER='SuperOffice:86' +UDF_OPENER_SECONDARY='SuperOffice:87' +UDF_VERTICAL='SuperOffice:83' +UDF_CAMPAIGN='SuperOffice:23' +UDF_UNSUBSCRIBE_LINK='SuperOffice:22' +PERSONA_MAP_JSON='{"Wirtschaftlicher Entscheider": 54, "Operativer Entscheider": 55, "Infrastruktur-Verantwortlicher": 56, "Innovations-Treiber": 57, "Influencer": 58}' +VERTICAL_MAP_JSON='{"Automotive - Dealer": 1613, "Corporate - Campus": 1614, "Energy - Grid & Utilities": 1615, "Energy - Solar/Wind": 1616, "Healthcare - Care Home": 1617, "Healthcare - Hospital": 1618, "Hospitality - Gastronomy": 1619, "Hospitality - Hotel": 1620, "Industry - Manufacturing": 1621, "Infrastructure - Communities": 1622, "Infrastructure - Parking": 1625, "Infrastructure - Public": 1623, "Infrastructure - Transport": 1624, "Leisure - Entertainment": 1626, "Leisure - Fitness": 1627, "Leisure - Indoor Active": 1628, "Leisure - Outdoor Park": 1629, "Leisure - Wet & Spa": 1630, "Logistics - Warehouse": 1631, "Others": 1632, "Reinigungsdienstleister": 1633, "Retail - Food": 1634, "Retail - Non-Food": 1635, "Retail - Shopping Center": 1636, "Tech - Data Center": 1637}' +UDF_SUMMARY='SuperOffice:84' +UDF_LAST_UPDATE='SuperOffice:85' +UDF_LAST_OUTREACH='SuperOffice:88' +INFO_Application_ID="68439166-5f50-477a-ab20-4b6d4585c0a7" +INFO_Tenant_ID="6d85a9ef-3878-420b-8f43-38d6cb12b665" +INFO_Secret="dlm8Q~KH5IzjChljiexb7NfSohp3M_~AuR8QqcXi" +SERP_API="cf637fabe4ca7147e8b6d40a451398b70b3e1c9c87790c29e2b62cd2cecce0aa" diff --git a/uploads_audio/chunks/10/chunk_000.mp3 b/uploads_audio/chunks/10/chunk_000.mp3 new file mode 100644 index 00000000..69406f33 Binary files /dev/null and b/uploads_audio/chunks/10/chunk_000.mp3 differ diff --git a/uploads_audio/chunks/11/chunk_000.mp3 b/uploads_audio/chunks/11/chunk_000.mp3 new file mode 100644 index 00000000..34b4c028 Binary files /dev/null and b/uploads_audio/chunks/11/chunk_000.mp3 differ diff --git a/uploads_audio/chunks/11/chunk_001.mp3 b/uploads_audio/chunks/11/chunk_001.mp3 new file mode 100644 index 00000000..00aff291 Binary files /dev/null and b/uploads_audio/chunks/11/chunk_001.mp3 differ diff --git a/uploads_audio/d00ccfca-0c0e-4a6c-9006-836a14484c9d.m4a b/uploads_audio/d00ccfca-0c0e-4a6c-9006-836a14484c9d.m4a new file mode 100644 index 00000000..e81f0502 Binary files /dev/null and b/uploads_audio/d00ccfca-0c0e-4a6c-9006-836a14484c9d.m4a differ diff --git a/uploads_audio/f9c2007f-7ccb-43cd-8e9f-19f86edb9c9d.m4a b/uploads_audio/f9c2007f-7ccb-43cd-8e9f-19f86edb9c9d.m4a new file mode 100644 index 00000000..24211b2a Binary files /dev/null and b/uploads_audio/f9c2007f-7ccb-43cd-8e9f-19f86edb9c9d.m4a differ