Totally fine.
If it works in an in-game macro, then its permitted.
If you don’t want to write all the macros there’s an addon called Clique that will do the same thing very quickly. I think there might even be a similar in-game click to cast option now but I’m not sure on that.
So basically if you put smite on your #1 action bar button, and assign flash heal to #1 in Clique, then pressing #1 will cast flash heal on an ally if your mouse cursor is over their frame, or it will cast smite at your target if not. Probably the same as the macro you were looking at.