You might be able to get it working like that but a minimum of some decoupling (capacitor) on the supply near the Wroom 32 and some protection on the output if it's driving a relay would be wise. The programme would obviously be fixed and presumably uploaded to the 32 beforehand.
These are available at very little cost via Ebay etc. and would make it much easier to programme/ use:
View attachment 137256