Towards the end of 2016, Google introduced an API called App Preview Messaging. It debuted with Allo, where it lets you message anyone regardless of whether they have the app installed. They receive a preview message, handled by Google Play Services, which they can respond to as though they do have the app.
Duo recently added support for this, too, so you could receive and answer a video call from a contact even if you’ve never heard of the app.
Google Photos gets new sharing previews for users who don’t have the app installed was written by the awesome team at Android Police.