false, 'error' => 'No autenticado'], 401); } // Verificar permiso if (!hasPermission('manage_recipients', 'telegram')) { jsonResponse(['success' => false, 'error' => 'No tienes permiso para eliminar destinatarios de Telegram.'], 403); } $input = json_decode(file_get_contents('php://input'), true); $id = $input['id'] ?? null; if (!$id) { jsonResponse(['success' => false, 'error' => 'ID requerido'], 400); } try { $db = getDB(); $stmt = $db->prepare("DELETE FROM destinatarios_telegram WHERE id = ?"); $stmt->execute([$id]); jsonResponse(['success' => true]); } catch (PDOException $e) { jsonResponse(['success' => false, 'error' => $e->getMessage()], 500); }