Arduino board (or ESP board) for sending sms in case of AC's blackout

I want to create a project that sends an sms when the AC current goes blackout. I was thinking to use an arduino with a gsm module or a ESP board with that module integrated. Can you suggest me how to send a digital input to the board when this happens?