Actually...I just remembered there's an app that can handle this for you.
There's a way to do this with Rule Machine, but it's pretty cumbersome.