[ "pages" => ["WEVAL Consulting","WEVAL Life Sciences"], "profile" => "yacinemahboub", "api" => "linkedin.com/developers", "status" => "SCAN_SELENIUM", "scan_cmd" => "python3 /opt/weval-l99/social-scanner.py linkedin" ], "youtube" => [ "channel" => "WEVAL Consulting", "api" => "YouTube Data API v3", "key_location" => "/etc/weval/secrets.env", "status" => "API_READY", "scan_cmd" => "python3 /opt/weval-l99/social-scanner.py youtube" ], "instagram" => [ "account" => "@weval_consulting", "api" => "Instagram Graph API (via Meta Business)", "status" => "NEED_TOKEN", "scan_cmd" => "python3 /opt/weval-l99/social-scanner.py instagram" ], "tiktok" => [ "account" => "@weval", "api" => "TikTok Business API", "status" => "NEED_TOKEN", "scan_cmd" => "python3 /opt/weval-l99/social-scanner.py tiktok" ], "meta" => [ "page" => "WEVAL Consulting", "api" => "Meta Marketing API", "status" => "NEED_TOKEN", "scan_cmd" => "python3 /opt/weval-l99/social-scanner.py meta" ], "snapchat" => [ "account" => "@weval", "api" => "Snap Marketing API", "status" => "NEED_TOKEN", "scan_cmd" => "python3 /opt/weval-l99/social-scanner.py snapchat" ] ]; $diagnostic = [ "causes_racines_linkedin" => [ "1" => "Pages entreprise = -80% reach vs profil personnel", "2" => "13-15 hashtags = spam flag, reach cape", "3" => "Timing: heures bureau au lieu de 7h30/17h30", "4" => "Contenu produit, pas storytelling", "5" => "Zero question/CTA dans les posts", "6" => "Pas advocacy employes", "7" => "Videos longues, pas de hook 3s", "8" => "Culturel Maroc B2B: engagement public = prise position", "9" => "2 pages fragmentees", "10" => "Pas de reponse commentaires <30min" ], "causes_cross_platform" => [ "1" => "Pas de strategie cross-posting (LinkedIn->YouTube->Insta)", "2" => "Contenu non adapte par plateforme (meme format partout)", "3" => "Pas de calendrier editorial unifie", "4" => "Analytics fragmentes, pas de vue consolidee", "5" => "Pas de repurposing: 1 video longue = 10 shorts + 5 carrousels" ], "actions" => [ "A1" => "3-5 hashtags max (LinkedIn), trending hashtags (TikTok/Insta)", "A2" => "Cross-post adapte: LinkedIn=article, YouTube=demo, TikTok=short 30s, Insta=carousel", "A3" => "Calendrier editorial 4x/semaine: Lu=LinkedIn, Me=YouTube, Ve=Insta/TikTok, Sa=perso", "A4" => "Repurposing pipeline: 1 video demo -> 3 shorts + 1 carrousel + 1 article", "A5" => "Employee advocacy: chaque post reposte par 3+ personnes", "A6" => "Dashboard temps reel: toutes plateformes dans 1 ecran", "A7" => "Alertes engagement: notification si post depasse seuil", "A8" => "A/B testing: 2 versions par contenu, mesurer ce qui marche", "A9" => "Communaute: repondre a chaque commentaire en <30min", "A10" => "Budget boost: 50-100MAD/post sur les meilleurs performers" ], "kpi_cibles" => [ "linkedin" => ["engagement_rate" => ">3%", "comments" => ">5/post"], "youtube" => ["watch_time" => ">2min", "subscribers" => "+50/mois"], "instagram" => ["saves" => ">10/post", "reach" => ">1000/post"], "tiktok" => ["views" => ">1000/video", "completion_rate" => ">40%"] ] ]; // Cache du dernier scan $cache = @json_decode(@file_get_contents("/tmp/social-scan-cache.json"), true) ?: []; if ($action === "overview") { echo json_encode(["ok"=>true,"ts"=>date("c"),"platforms"=>$platforms,"diagnostic"=>$diagnostic,"last_scan"=>$cache], JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE); } elseif ($action === "scan") { $platform = $_GET["platform"] ?? "all"; $cmd = "nohup python3 /opt/weval-l99/social-scanner.py $platform > /tmp/social-scan.log 2>&1 & echo $!"; $pid = trim(shell_exec($cmd)); echo json_encode(["ok"=>true,"action"=>"scan_launched","platform"=>$platform,"pid"=>$pid]); } elseif ($action === "schedule") { echo json_encode(["ok"=>true,"schedule"=>[ "lundi_7h30"=>"LinkedIn: article/carrousel technique", "mardi_12h00"=>"YouTube: video demo 3-5min", "mercredi_17h30"=>"Instagram: carrousel behind-the-scenes", "jeudi_8h00"=>"LinkedIn: success story client", "vendredi_12h00"=>"TikTok: short 30s hook fort", "samedi_9h00"=>"Yacine perso: reflexion leadership" ]], JSON_PRETTY_PRINT); } elseif ($action === "reco") { // Recommendations IA via sovereign $ctx2 = stream_context_create(["http"=>["timeout"=>5,"method"=>"POST","header"=>"Content-Type: application/json","content"=>json_encode(["messages"=>[["role"=>"user","content"=>"Donne 5 idees de posts LinkedIn pour une entreprise de consulting IT au Maroc specialisee en IA souveraine et email marketing. Format: titre + hook 1 ligne + 3 hashtags"]],"max_tokens"=>300,"stream"=>false])]]); $resp = @file_get_contents("http://127.0.0.1:4000/v1/chat/completions", false, $ctx2); $r = @json_decode($resp, true); $ideas = $r["choices"][0]["message"]["content"] ?? "Sovereign indisponible"; echo json_encode(["ok"=>true,"recommendations"=>$ideas], JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE); } ?>