Deep Link URL List and formats [Sharing, Cross-app, etc]

Good evening folks!

I’ve been in the process of developing a custom share sheet for my app because of the way that the FBSDK needs to be used for sharing to Facebook (which breaks the native share sheet on many devices, such as my Huawei Mate 10 Pro).

You can possibly use the Branch API (https://docs.expo.io/versions/latest/sdk/branch), but if you don’t want to add extra services to your project, this guide is designed to help you get setup and running using device-level ‘links’ that can be called using the easy to use Linking API provided by expo.

With that in mind, I didn’t want to not integrate a feature that I feel others will find value in, and to this end, I’m putting together this list of deep-linkable apps and their formats and parameters.

Before we jump into that, here’s a code sample you’ll want to use to trigger a URL to open. This has been tested on Android (I don’t have an iOS device to test on unfortunately – before anyone asks, I don’t publish my apps to iOS yet because of this, nothing beats testing on a real device) and by default will open the app or a selector-dialog in Android 7+;

import {Linking} from 'expo';
import {Alert} from 'react-native';

const url = `https://example.com/`;
Linking.canOpenURL(url).then(supported => {
    if (supported) {
        Linking.openURL(url);
    } else {
        Alert.alert(
            'Alert',
            'This URL scheme is not installed',
        )
    }
});

That sample will open the url https://example.com in the default browser, or the relevant selected app if the user hasn’t provided a default for https links.

Now, onto the interesting parts. Using Android intents, and iOS extensions (I believe that’s what they’re called). Intents are what power cross-app interaction, and some apps also use them to provide data from background tasks/services to their main app (such as sync). What this means is that by triggering an intent, you can open specific ‘deep links’ within another application. At the basic level, a deep link is simply a specific screen within an app, and it can have content prefilled depending upon the parameters passed to it.

In the below examples, text must be URL-encoded in many cases (e.g. %20 is a space character), and phone numbers sometimes need to be in international format (i.e. with the country code before - e.g. +44 for the UK). In some cases, such as WhatsApp, the correct format may omit the leading + symbol, or even use the local country format instead of international. The below are correct at time of writing.

The following examples are intent triggers, and also an ongoing list of collected intent triggers that I hope will provide you guys with all the information you need;

Twitter

  • Send a tweet: twitter://post?message=this%20is%20my%20tweet
  • Send a reply: twitter://post?message=this%20is%20my%20tweet&in_reply_to=12345 (replace 12345 with the tweet ID to reply to)
  • Send a tweet (alternative): _http://twitter.com/home?status=this%20is%20my%20tweet_
  • Open a users profile: twitter://user?screen_name=chronSyn
  • Query/Search twitter: twitter://search?query=%23reactjs (searches for #reactjs hashtag - use encodeURIComponent on a string to get something you can push as part of the URL)
  • Open timeline view (i.e. default Twitter screen): twitter://timeline
  • More details: Overview | Docs | Twitter Developer Platform

WhatsApp

  • Send a message after asking user where to send it: whatsapp://send?text=test1234
  • Send a message to a specific number: whatsapp://send?text=test1234&phone=+447712345678
  • Send a message to a specific number (alternative): Share on WhatsApp
  • More details: https://faq.whatsapp.com/en/26000030/

SMS

  • Send a message after asking user where to send it: sms:?body=test1234
  • Send a message to a specific number: sms:447712345678?body=test1234

Facebook Messenger

  • Share a link after asking where to share it: fb-messenger://share/?link=https://expo.io/
  • Opens a messenger window: fb-messenger://user-thread/{user-id}
    Please note that ‘opens a messenger window’ is currently being investigated as it does not seem to function with fluidity in all cases.

Spotify

  • Open a specific track in Spotify: spotify://track:18AXbzPzBS8Y3AkgSxzJPb
    Spotify has a huge array of possible links, and you can find a spotify link within the Spotify app (share > copy spotify URI)

This list is in no way comprehensive and I’ll continue working on adding more as time goes on. If there’s a specific one you’d like to see added, let me know and I’ll try to find out what you need to do to achieve it. Not everything is possible, but I’ll do what I can to assist. In exchange, if you know of a scheme not covered above and can provide an example, please post a comment.

1 Like

Thank U @chronsyn

Open An Address on Google Maps?
Someone know Maps Deep Linking?

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.