Script Idea: Wake up every x minutes, check for messages, go to sleep if there are no new ones

This might be of use to you: