How to setup a webhook to stop Photon going to deep sleep mode?

Hi there:

I have an application: I have a battery powered remote sensor. In order to save battery power, I need to put Photon into deep sleep mode for 30 minutes,wake up for 1 minute to measure sensor input/ publish the data, then go back to deep sleep.

Sometimes, I need to stop Photon from going to the deep sleep mode so that I can interact with it to do some maintenance (such as download new firmware, or change WiFi credentials, etc.). How can I setup a webhook which listens for the a Particle.publish() and let it know that it needs to stop going to deep sleep mode? If you have some example code to show, it would be great!!