The Shape method, a novel approach to obtain the functional form of the $gamma$-ray strength function ($gamma$SF) in the absence of neutron resonance spacing data, is introduced. When used in connection with the Oslo method the slope of the Nuclear Level Density (NLD) is obtained simultaneously. The foundation of the Shape method lies in the primary $gamma$-ray transitions which preserve information on the functional form of the $gamma$SF. The Shape method has been applied to $^{56}$Fe, $^{92}$Zr, $^{164}$Dy, and $^{240}$Pu, which are representative cases for the variety of situations encountered in typical NLD and $gamma$SF studies. The comparisons of results from the Shape method to those from the Oslo method demonstrate that the functional form of the $gamma$SF is retained regardless of nuclear structure details or $J^pi$ values of the states fed by the primary transitions.