Need help with best practices for creating an invite people capability in a mobile app

I am new on this forum. I am building a mobile app that is based on two way interaction between two users, and am trying to figure out the best way to create a frictionless invitation/onboarding system that one user can send another person who has not yet downloaded the app. Any suggestions on what apps to look at who do this simply and elegently. My current method seems pretty kludgy but here it is

  1. Type name or phone number in search bar
  2. If search finds match in the phone contact list, it brings up the results
  3. If I find the desired user, I press on the name
  4. If that person is already an app user, the app indicates it as such and we can proceed with the interaction
  5. If that person is not a current app user, a share message screen pops up with a pre-filled message inviting “said” person to download the app.
    All help appreciated.