'ai_analysis', 'config' => json_encode(['prompt' => 'Enrich candidate data.'])], ['action_type' => 'create_task', 'config' => json_encode(['task_name' => 'Review new candidate profile', 'assign_to' => 'hiring_manager'])], ['action_type' => 'send_slack', 'config' => json_encode(['channel' => '#hr-alerts', 'message' => 'New candidate received.'])] ]; break; case 'interview_scheduling': $workflow_name = 'Interview Scheduling'; $trigger_event = 'candidate_status_changed'; $actions = [ ['action_type' => 'send_email', 'config' => json_encode(['to' => '{candidate_email}', 'subject' => 'Invitation to Interview', 'body' => 'Please schedule your interview...'])], ['action_type' => 'schedule_event', 'config' => json_encode(['calendar' => 'hiring_manager_calendar', 'title' => 'Interview with {candidate_name}'])] ]; break; case 'onboarding_automation': $workflow_name = 'Onboarding Automation'; $trigger_event = 'candidate_hired'; $actions = [ ['action_type' => 'create_task', 'config' => json_encode(['task_name' => 'Prepare welcome kit', 'assign_to' => 'hr_specialist'])], ['action_type' => 'create_task', 'config' => json_encode(['task_name' => 'Set up IT equipment', 'assign_to' => 'it_department'])], ['action_type' => 'send_email', 'config' => json_encode(['to' => '{candidate_email}', 'subject' => 'Welcome to the team!', 'body' => 'Your onboarding details...'])] ]; break; case 'weekly_reports': $workflow_name = 'Weekly Reports'; $trigger_event = 'schedule_weekly'; $actions = [ ['action_type' => 'add_to_report', 'config' => json_encode(['report_name' => 'Weekly Candidate Pipeline', 'data' => 'summary'])], ['action_type' => 'send_email', 'config' => json_encode(['to' => 'management@example.com', 'subject' => 'Weekly Recruiting Report', 'body' => 'See attached report.'])] ]; break; } if ($workflow_name && $trigger_event) { $stmt = $pdo->prepare("INSERT INTO workflows (name, trigger_event) VALUES (?, ?)"); $stmt->execute([$workflow_name, $trigger_event]); $workflow_id = $pdo->lastInsertId(); $action_stmt = $pdo->prepare("INSERT INTO workflow_actions (workflow_id, action_type, config, action_order) VALUES (?, ?, ?, ?)"); foreach ($actions as $index => $action) { $action_stmt->execute([$workflow_id, $action['action_type'], $action['config'], $index + 1]); } header("Location: workflow_actions.php?id=" . $workflow_id); exit; } } else { // Build from scratch $name = $_POST['name'] ?? ''; $trigger_event = $_POST['trigger_event'] ?? ''; $trigger_condition = $_POST['trigger_condition'] ?? null; if ($name && $trigger_event) { $stmt = $pdo->prepare("INSERT INTO workflows (name, trigger_event, trigger_condition) VALUES (?, ?, ?)"); $stmt->execute([$name, $trigger_event, $trigger_condition]); $newWorkflowId = $pdo->lastInsertId(); header("Location: workflow_actions.php?id=" . $newWorkflowId); exit; } } } } // Fetch workflows from the database $stmt = $pdo->query("SELECT * FROM workflows ORDER BY created_at DESC"); $workflows = $stmt->fetchAll(); ?>
Click any workflow to view and edit its actions
Automatically captures, enriches, and routes new candidates.
Automates calendar checks and interview coordination.
Creates and tracks onboarding tasks for new hires.
Trigger: