I am making a program and I need this program to get WIFI Credentials before anything else. Kind of like when you buy an Alexa and it has you connect to the internet before you can do anything with it. How could i go about this or is there any code out there that someone has already created that i could look at and could be directed to??
WIFI Configuration Before Complete Boot-up Of Pi
You cannot usefully do anything network related before the Pi boots up properly. I think you have just misconstrued the concept of "booting", and what you really mean is you want the Pi to boot up the first time in a state where the goal is to get a wifi configuration somehow.
Kind of like when you buy an Alexa and it has you connect to the internet
That's not what happens. Alexa and similar devices initially run their own hotspot which you can connect to; you then provide an SSID and password so that they can connect to your WLAN. The first thing you want to do is configure the Pi to run either an open/unencrypted hotspot, or else one with a default password that can be used to connect to it. Along with that you need it to run a server application which will:
Handle interfacing with a remote client to get the SSID and password, and then apply that to Pi's networking configuration.
Attempt to connect to the WLAN using the new configuration.
On failure, revert to the original state, possibly storing a message to inform the user on next connect to the hotspot that the original attempt failed.
On success the server application exits and leaves the Pi connected to the WLAN configured such that on next boot it will do so automatically.
So, there's a bit of work. It requires you understand how networking is configured on the pi, and are able to create a simple server app which fulfils the above requirements.