I don't if useful but there are also existing projects like https://github.com/schollz/raspberry-pi-turnkey and https://github.com/sabhiram/raspberry-wifi-config which have the Pi configure an open WiFi AP if a network has not yet been configured which then allow the user to setup their network through a simple wizard-like web interface.