Previously in (User Experience:  Inviting users to your Android or iOS app Part 1) we explored a way of inviting and onboarding new users to an application. It worked but had some UX issues related to it.

The solution relied on putting deep links in SMS messages and then sending them to the recipient. Here are the 4 use cases again.

A ) Bulk invites, or outside of the app, inviting someone who may or may not have the app:

1.The user’s information, name, phone number and possibly custom message, is captured and inserted into the database along with a unique identifier.

2.The website then generates an SMS with an url that contains the unique identifier as a parameter.

3.The SMS is sent. That’s it!

B ) Someone uses the app to invite someone else who may or may not have the app:

1. The user selects a name from their contact list.

2. Optionally, they write a message for the receiving user.

3. The app then makes an authenticated rest call to the server, where the information is inserted into the database.

4. The rest call returns the unique id that was generated.

5. The app formats an url using the unique id, and then sends in in an SMS message to the recipient. That’s it!

C ) Someone receives an invite who does not have the app installed:

1. The user receives an SMS with a web url in it. The url has a unique id appended as a query parameter.

2. The SMS has a short message, asking them to click on the url for more information.

3. The user clicks on the url.

5. Since they don’t have the app installed the url starts the default browser and the visit the web page.

6. The web server, looks up the unique id from 1), and retrieves the details of the invite such as the recipient’s name, or even a custom message. It also includes a link to Apple App Store or Google Play Market for downloading the appropriate app for their operating system.

D ) Someone receives an invite who does have the app installed:

1. The user receives an SMS with a web url in it. The url has a unique id appended as a query parameter.

2. The SMS has a short message, asking them to click on the url for more information.

3. The user clicks on the url.

4. Since they have the app installed, and deep linking is enabled, the app is opened.

5. The app fetches the parameter from the url the performs a REST call to the server and looks up the details for the invite.

6. The app displays a screen with the details.

 

A and B dovetail into C and D. The problem is that if they have the app installed the will still be receiving SMS messages and the user has to click on it. That is at least two clicks just to get into the app.  1) Select the notification to open the SMS app. 2) Select the URL to open up our app. Depending on the operating system and version, there might be another step in there to verify that you want to open up the app. That might end up being really annoying! Fortunately, there is a better cleaner way to handle this. Basically, we want the app to automatically open when it receives an event notification.

We can easily do this using the push notification facilities in iOS and Android. The trick is knowing if we should send an SMS or send a push notification. We have part of the equation solved already. We know the phone number of the person when they originally were sent the invite. We can use that to create a user account that just hasn’t been tied to the information for push notifications. When the recipient installs the app we can associate the phone number with that app installation. This way in the future when we send an event to that phone number, we can check if it is associated with an installation. If it is, we send the push notification instead of an SMS. So we’re almost there. The only question is how do we associate the phone number to the installation. We can ask the phone number, or we can request permission to read it. However, there is a slicker way to handle it.

The Magic

iOS 9 comes with some new abilities. The new Safari View Controller can share the same cookie space as the main Safari app. This means you can verify if the install action originated from a click in safari. Google Play has an INSTALL_REFERRER Broadcast. Basically, you just need to append a custom referrer to the query parameter to the end of the Goole Play Store URL when you send the user there. Google Play will fire off a broadcast intent to your app that includes the referrer. Here is an updated use cases for the first time the app is installed

Someone receives an invite who does not have the app installed:

1. The user receives an SMS with a web url in it. The url has a unique id appended as a query parameter.

2. The SMS has a short message, asking them to click on the url for more information.

3. The user clicks on the url.

4. Since they don’t have the app installed the url starts the default browser and the visit the web page.

5. The web server, looks up the unique id from 1), and retrieves the details of the invite such as the recipient’s name, or even a custom message. It also includes a link to Apple App Store or Google Play Market for downloading the appropriate app for their operating system.

6. The web page sets a cookie (for the iOS case) and the link to the Google Play Market appends a referrer that includes the unique id created in 1.

7. The user installs the app.

8. (iOS) When the app is run the first time, it loads the Safari View Controller, then looks for that cookie. If it is there then the user installed via visiting the web page and we can look up the invite and associate the phone number with the user record via a REST call.

9. (Android) When the app is run the first time, it waits for the broadcast from the Google Market App. If it is received, then the user installed via visiting the web page and we can look up the invite and associate the phone number with the user record via a REST call.

 

Now you have a very slick invite and onboarding process!