[2ff88f42] multiplikation vorbereitet
multiplikation vorbereitet
This commit is contained in:
150
sync_personas_to_notion.py
Normal file
150
sync_personas_to_notion.py
Normal file
@@ -0,0 +1,150 @@
|
||||
|
||||
import requests
|
||||
import json
|
||||
|
||||
# --- Configuration ---
|
||||
try:
|
||||
with open("notion_token.txt", "r") as f:
|
||||
NOTION_TOKEN = f.read().strip()
|
||||
except FileNotFoundError:
|
||||
print("Error: notion_token.txt not found.")
|
||||
exit(1)
|
||||
|
||||
NOTION_VERSION = "2022-06-28"
|
||||
NOTION_API_BASE_URL = "https://api.notion.com/v1"
|
||||
HEADERS = {
|
||||
"Authorization": f"Bearer {NOTION_TOKEN}",
|
||||
"Notion-Version": NOTION_VERSION,
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
|
||||
# DB: Sector & Persona Master
|
||||
DB_ID = "2e288f42-8544-8113-b878-ec99c8a02a6b"
|
||||
|
||||
# --- Data ---
|
||||
archetypes = [
|
||||
{
|
||||
"name": "Wirtschaftlicher Entscheider",
|
||||
"pains": [
|
||||
"Steigende operative Personalkosten und Fachkräftemangel gefährden die Profitabilität.",
|
||||
"Unklare Amortisation (ROI) und Risiko von Fehlinvestitionen bei neuen Technologien.",
|
||||
"Intransparente Folgekosten (TCO) und schwierige Budgetplanung über die Lebensdauer."
|
||||
],
|
||||
"gains": [
|
||||
"Nachweisbare Senkung der operativen Kosten (10-25%) und schnelle Amortisation.",
|
||||
"Sicherung der Wettbewerbsfähigkeit durch effizientere Kostenstrukturen.",
|
||||
"Volle Transparenz und Planbarkeit durch klare Service-Modelle (SLAs)."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Operativer Entscheider",
|
||||
"pains": [
|
||||
"Personelle Unterbesetzung führt zu Überstunden, Stress und Qualitätsmängeln.",
|
||||
"Wiederkehrende Routineaufgaben binden wertvolle Fachkräfte-Ressourcen.",
|
||||
"Schwierigkeit, gleichbleibend hohe Standards (Hygiene/Service) 24/7 zu garantieren."
|
||||
],
|
||||
"gains": [
|
||||
"Spürbare Entlastung des Teams von Routineaufgaben (20-40%).",
|
||||
"Garantierte, gleichbleibend hohe Ausführungsqualität unabhängig von der Tagesform.",
|
||||
"Stabilisierung der operativen Abläufe und Kompensation von Personalausfällen."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Infrastruktur-Verantwortlicher",
|
||||
"pains": [
|
||||
"Sorge vor komplexer Integration in bestehende IT- und Gebäudeinfrastruktur (WLAN, Türen, Aufzüge).",
|
||||
"Risiko von hohen Ausfallzeiten und aufwändiger Fehlerbehebung ohne internes Spezialwissen.",
|
||||
"Unklare Wartungsaufwände und Angst vor 'Insel-Lösungen' ohne Schnittstellen."
|
||||
],
|
||||
"gains": [
|
||||
"Reibungslose, fachgerechte Integration durch Experten-Support (Plug & Play).",
|
||||
"Maximale Betriebssicherheit durch proaktives Monitoring und schnelle Reaktionszeiten.",
|
||||
"Zentrales Management und volle Transparenz über Systemstatus und Wartungsbedarf."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Innovations-Treiber",
|
||||
"pains": [
|
||||
"Verlust der Attraktivität als moderner Arbeitgeber oder Dienstleister (Veraltetes Image).",
|
||||
"Fehlende 'Wow-Effekte' in der Kundeninteraktion und mangelnde Differenzierung vom Wettbewerb.",
|
||||
"Verpasste Chancen durch fehlende Datengrundlage für digitale Optimierungen."
|
||||
],
|
||||
"gains": [
|
||||
"Positionierung als Innovationsführer und Steigerung der Markenattraktivität.",
|
||||
"Schaffung einzigartiger Kundenerlebnisse durch sichtbare High-Tech-Lösungen.",
|
||||
"Gewinnung wertvoller Daten zur kontinuierlichen Prozessoptimierung und Digitalisierung."
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
# --- Helper Functions ---
|
||||
|
||||
def format_rich_text(text):
|
||||
return {"rich_text": [{"type": "text", "text": {"content": text}}]}
|
||||
|
||||
def format_title(text):
|
||||
return {"title": [{"type": "text", "text": {"content": text}}]}
|
||||
|
||||
def find_page(title):
|
||||
url = f"{NOTION_API_BASE_URL}/databases/{DB_ID}/query"
|
||||
payload = {
|
||||
"filter": {
|
||||
"property": "Name",
|
||||
"title": {"equals": title}
|
||||
}
|
||||
}
|
||||
resp = requests.post(url, headers=HEADERS, json=payload)
|
||||
resp.raise_for_status()
|
||||
results = resp.json().get("results")
|
||||
return results[0] if results else None
|
||||
|
||||
def create_page(properties):
|
||||
url = f"{NOTION_API_BASE_URL}/pages"
|
||||
payload = {
|
||||
"parent": {"database_id": DB_ID},
|
||||
"properties": properties
|
||||
}
|
||||
resp = requests.post(url, headers=HEADERS, json=payload)
|
||||
resp.raise_for_status()
|
||||
print("Created.")
|
||||
|
||||
def update_page(page_id, properties):
|
||||
url = f"{NOTION_API_BASE_URL}/pages/{page_id}"
|
||||
payload = {"properties": properties}
|
||||
resp = requests.patch(url, headers=HEADERS, json=payload)
|
||||
resp.raise_for_status()
|
||||
print("Updated.")
|
||||
|
||||
# --- Main Sync Loop ---
|
||||
|
||||
def main():
|
||||
print(f"Syncing {len(archetypes)} Personas to Notion DB {DB_ID}...")
|
||||
|
||||
for p in archetypes:
|
||||
print(f"Processing '{p['name']}'...")
|
||||
|
||||
# Format Pains/Gains as lists with bullets for Notion Text field
|
||||
pains_text = "\n".join([f"- {item}" for item in p["pains"]])
|
||||
gains_text = "\n".join([f"- {item}" for item in p["gains"]])
|
||||
|
||||
properties = {
|
||||
"Name": format_title(p["name"]),
|
||||
"Pains": format_rich_text(pains_text),
|
||||
"Gains": format_rich_text(gains_text),
|
||||
# Optional: Add a tag to distinguish them from Sectors if needed?
|
||||
# Currently just relying on Name uniqueness.
|
||||
}
|
||||
|
||||
existing_page = find_page(p["name"])
|
||||
|
||||
if existing_page:
|
||||
print(f" -> Found existing page {existing_page['id']}. Updating...")
|
||||
update_page(existing_page["id"], properties)
|
||||
else:
|
||||
print(" -> Creating new page...")
|
||||
create_page(properties)
|
||||
|
||||
print("Sync complete.")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user