How can i make app for calling a function using a buttom

i want to create a home automation project using photons but i want to use alexa and a app to switch on and off lights.your help is really appreciated

The best way to do this would be through webhooks. Check out the documentation and let me know if you have any questions!