Messages (SMS) not syncing between iPhone and iPad

I’ve noticed, annoyingly, that when I send a message on my iPad it’s not always showing up on my phone and vice versa (especially when sending to non-iPhone users). This, despite the fact that in Settings->Messages both devices are using the same Apple user account.

Turns out the problem is that both devices also need to store Messages in iCloud.

You can do this under Settings->select your name/Apple ID->iCloud and make sure that Messages are turned on. They weren’t on my iPad even though they were on my iPhone.