If the mechanism is to be hidden entirely you construct the guide tube and spring separately and then solder the assembly into the ornamental body. But often there is no need to hide the mechanism completely as it will be hidden by the larger ornament and so can remain exposed from the back.
As to material, it should be either spring gold or platinum.
In this jabot pin, marked Van Cleef & Arpels, you can see that the spring catch is not enclosed. In this case you can see that the spring is U shaped with the base of the U engaging the detente in the pin stem.