Simple app to push to IFTTT when power source changes

I bought the electron to learn a bit on getting started with IoT.
My first test would be to see if I have a power outage in my house. My plan is to power up the electron with a usb wall plug and the battery. Then I want it to react to if the power source switches from ac to battery. I saw that I can use the powerMonitor but to be honest I have no idea on where to start.
Anyone feel like giving me a few pointers?

Thanks in advance.

There is probably a better answer here, but if you just monitor the fuelguage, you could simply create an IF loop to see when the values decrease.

Thought about it. but feel like that is a less exact way to do it compared to just a binary switch on where it gets its power from.