We describe the construction of vector-valued modular forms transformi
ng under a given congruence representation of the modular group SL(2,
Z) in terms of theta series. We apply this general setup to obtain clo
sed and easily computable formulas for conformal characters of rationa
l models of W-algebras.