Socket
Socket
Sign inDemoInstall

url-to-deep-link

Package Overview
Dependencies
3
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    url-to-deep-link

Transform URLs to Deep Links and open your users apps


Version published
Weekly downloads
208
decreased by-4.15%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Build Status

Transform URLs to Deep Links and open your users apps

Why ?

Deep links are a very powerful feature of Android and iOS devices that allows creators to point their users to the content with the best experience possible.

Looking for a way to redirect users throught a basic <a> html link tag, I found out that no library does the conversion from a URL to a deep link. There was an attempt 4 years ago that wasn't still what I was looking for and another one more recent but that works using a Node server and still doesn't exactly do what I was looking for: just transform URLs to deep links.

Following on with the research some services like Branch.io and Url Geni exist but they are premium. Branch is hard to try because you need to request a demo, which I asked for but I haven't got any answer back yet. On the other hand Url Geni gives you a quick way to see it working in their home page and later on with a subscription you are able to generate URLs dinamically using their API.

Since universal links are still not a standard nor all the apps support them nor all version of Android and iOS support them, I decided to create this library.

url-to-deep-link is a simple hardcoded solutions that translates URLs to their deep link version in order to open your users apps.

Install

npm install --save url-to-deep-link

Usage

// ES5 require syntax also works
// var getAndroidDeepLink = require("url-to-deep-link").getAndroidDeepLink;
import { getAndroidDeepLink, getIOSDeepLink } from "url-to-deep-link";

const yourAndroidDeepLink = getAndroindDeepLink("YOUR URL");
const yourIOSDeepLink = getIOSDeepLink("YOUR URL");

At this moment the following transformations are available (any other option will return undefined):

Facebook

  • Page: https://www.facebook.com/YOUR_PAGE_ID

You can get your id here.

Instagram

  • Profile: https://www.instagram.com/YOUR_USERNAME

  • Post (ONLY ANDROID): https://www.instagram.com/p/YOUR_POST_ID

Twitter

  • Profile: https://www.twitter.com/YOUR_USERNAME

  • Tweet: https://twitter.com/YOUR_USERNAME/status/YOUR_TWEET_ID

Notes

Facebook URL transformation by page name instead of ID and Instagram's post URL on iOS are not suported because they require an asynchronous call in order to get the ID of the page/post. In ./lib/apps/facebook.js you can find an async version commented working fine although Facebook apps are currently a mess and there is no way to get an API access token.

Test

npm run test

Build (webpack)

npm run build

License

MIT

Keywords

FAQs

Last updated on 29 Aug 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc