I have done it following the instructions/pictures on the topic @Ayesha just gave you. I wired it like @Zax described it with his first picture. Soldering was a bit tricky because I'm not used to, but overall pretty easy.
I'm using LaserGRBL and had to configure the GRBL to enable it : https://github.com/gnea/grbl/wiki/Grbl-v1.1-Configuration
I use soft limit with $20=1, then enter the dimensions of your cutting area with $130 and $131.
You also might need to change the homing axes : in my case they were both inverted ($23, configured with a mask : https://github.com/gnea/grbl/wiki/Grbl-v1.1-Configuration#2--step-port-invert-mask
To fix the switch, I used my design, remixed from a bigger mount (https://www.thingiverse.com/thing:3080317 ). works well, looses a couple millimeters but I'm okay with it.