162 lines
5.9 KiB
Python
162 lines
5.9 KiB
Python
|
|
import requests
|
|
import json
|
|
import os
|
|
|
|
# --- 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: Personas / Roles
|
|
DB_ID = "30588f42854480c38919e22d74d945ea"
|
|
|
|
# --- Data for Archetypes ---
|
|
archetypes = [
|
|
{
|
|
"name": "Wirtschaftlicher Entscheider",
|
|
"pains": [
|
|
"Steigende Personalkosten im Reinigungs- und Servicebereich gefährden Profitabilität.",
|
|
"Fachkräftemangel und Schwierigkeiten bei der Stellenbesetzung.",
|
|
"Inkonsistente Qualitätsstandards schaden dem Ruf des Hauses.",
|
|
"Hoher Managementaufwand für manuelle operative Prozesse."
|
|
],
|
|
"gains": [
|
|
"Reduktion operativer Personalkosten um 10-25%.",
|
|
"Deutliche Abnahme der Überstunden (bis zu 50%).",
|
|
"Sicherstellung konstant hoher Qualitätsstandards.",
|
|
"Erhöhung der operativen Effizienz durch präzise Datenanalysen."
|
|
],
|
|
"kpis": "Betriebskosten pro Einheit, Gästezufriedenheit (NPS), Mitarbeiterfluktuation.",
|
|
"positions": "Direktor, Geschäftsführer, C-Level, Einkaufsleiter."
|
|
},
|
|
{
|
|
"name": "Operativer Entscheider",
|
|
"pains": [
|
|
"Team ist überlastet und gestresst (Gefahr hoher Fluktuation).",
|
|
"Zu viele manuelle Routineaufgaben wie Abräumen oder Materialtransport.",
|
|
"Mangelnde Personalverfügbarkeit in Stoßzeiten führt zu Engpässen."
|
|
],
|
|
"gains": [
|
|
"Signifikante Entlastung des Personals von Routineaufgaben (20-40% Zeitgewinn).",
|
|
"Garantierte Reinigungszyklen unabhängig von Personalausfällen.",
|
|
"Mehr Zeit für wertschöpfende Aufgaben (Gästebetreuung, Upselling)."
|
|
],
|
|
"kpis": "Zeitaufwand für Routineaufgaben, Abdeckungsrate der Zyklen, Servicegeschwindigkeit.",
|
|
"positions": "Leiter Housekeeping, F&B Manager, Restaurantleiter, Stationsleitung."
|
|
},
|
|
{
|
|
"name": "Infrastruktur-Verantwortlicher",
|
|
"pains": [
|
|
"Technische Komplexität der Integration in bestehende Infrastruktur (Aufzüge, WLAN).",
|
|
"Sorge vor hohen Ausfallzeiten und unplanmäßigen Wartungskosten.",
|
|
"Fehlendes internes Fachpersonal für die Wartung autonomer Systeme."
|
|
],
|
|
"gains": [
|
|
"Reibungslose Integration (20-30% schnellere Implementierung).",
|
|
"Minimierung von Ausfallzeiten um 80-90% durch proaktives Monitoring.",
|
|
"Planbare Wartung und transparente Kosten durch feste SLAs."
|
|
],
|
|
"kpis": "System-Uptime, Implementierungszeit, Wartungskosten (TCO).",
|
|
"positions": "Technischer Leiter, Facility Manager, IT-Leiter."
|
|
},
|
|
{
|
|
"name": "Innovations-Treiber",
|
|
"pains": [
|
|
"Verlust der Wettbewerbsfähigkeit durch veraltete Prozesse.",
|
|
"Schwierigkeit das Unternehmen als modernen Arbeitgeber zu positionieren.",
|
|
"Statische Informations- und Marketingflächen werden oft ignoriert."
|
|
],
|
|
"gains": [
|
|
"Positionierung als Innovationsführer am Markt.",
|
|
"Steigerung der Kundeninteraktion um 20-30%.",
|
|
"Gewinnung wertvoller Daten zur kontinuierlichen Prozessoptimierung.",
|
|
"Erhöhte Attraktivität für junge, technikaffine Talente."
|
|
],
|
|
"kpis": "Besucherinteraktionsrate, Anzahl Prozessinnovationen, Modernitäts-Sentiment.",
|
|
"positions": "Marketingleiter, Center Manager, CDO, Business Development."
|
|
}
|
|
]
|
|
|
|
# --- 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": "Role",
|
|
"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 Logic ---
|
|
|
|
def main():
|
|
print(f"Syncing {len(archetypes)} Personas to Notion DB {DB_ID}...")
|
|
|
|
for p in archetypes:
|
|
print(f"Processing '{p['name']}'...")
|
|
|
|
pains_text = "\n".join([f"- {item}" for item in p["pains"]])
|
|
gains_text = "\n".join([f"- {item}" for item in p["gains"]])
|
|
|
|
properties = {
|
|
"Role": format_title(p["name"]),
|
|
"Pains": format_rich_text(pains_text),
|
|
"Gains": format_rich_text(gains_text),
|
|
"KPIs": format_rich_text(p.get("kpis", "")),
|
|
"Typische Positionen": format_rich_text(p.get("positions", ""))
|
|
}
|
|
|
|
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()
|