Onymos Raises $12M Series A: Learn why

onymos-logo
deeplink icon

Quickstart Guide: DeepLink Component

DeepLink Component

Select a framework to get started.

Get started

Using Ionic or Cordova? Get the DeepLink component working in your app in four easy steps.

  1. Download the component
  2. Add it to your environment
  3. Using DeepLink
  4. Troubleshoot

1. Download the Onymos DeepLink component

Sign up! We’ll send you a link to your component, set up your Onymos Cloud Account, and generate your Onymos license credentials. In the meantime, you can get familiar with our API Documentation and developer resources, or join a whole community of developers building apps with Onymos on Reddit!

2. Add it to your environment

Add your components to a folder in your app’s root (e.g., onymos_components).

Add the Onymos Initialize component to your environment.

$ cordova plugin add onymos_components/onymos-component-initialize

Then we can add the Onymos DeepLink component.

$ cordova plugin add onymos_components/onymos-component-deeplink

Then update the widget inside your config.xml with the Onymos Widget ID you receive after you create an Onymos Cloud Account.

3. Using DeepLink

Add the Onymos DeepLink component to your app and start sending your users right where you want them. Don’t worry, if they’re not a user already, they will be. We’ll route them straight to your app on the appropriate app store if they don’t already have it installed.

Before we use DeepLink, let’s make sure we have everything we need to configure your onymosConnectObject. The onymosConnectObject requires the appropriate Onymos license credentials: your Customer ID (also called an Onymos ID) and your Onymos Auth Token. You’ll need these credentials to use this (or any) component in your app. To generate your Onymos license credentials, create an Onymos Cloud Account.

NOTE: Your Onymos Auth Token will work with any number of apps and components. Onymos has a developer—and project—friendly pricing model. You can use any or all of our components in an app at no cost until it is installed on 100 or more devices. This is ideal for iterating your MVP (see detailed pricing here).

Next, let’s go inside your Cordova app’s index.js file and initialize DeepLink.

var OnymosInitalize
var OnymosDeepLink

document.addEventListener('deviceready', onDeviceReady, false);

function onDeviceReady() {
  const OnymosConnectObject={
    customerId : 'Your customerId goes here', 
    onymosAuthToken : 'Your onymosAuthToken goes here',  
    envType: 'PRD'
  }

  OnymosInitialize.initialize(
    OnymosConnectObject,
      
    function onymosInitializeSuccess(status){
      console.log("Onymos initialized Successfully.", status)
    },

    function onymosInitializeFailure(error){
      console.log("Onymos failed to initialize.", error)
    })
}

Great! If we configured your onymosConnectObject correctly, onymosInitializeSuccess() should print its message to the console. Now we’re ready to use DeepLink.

Let’s make a createDeepLink() function in the index.js file that will invoke the method of the same name, and create your app’s first deep link.

function createDeepLink() {
    OnymosDeepLink.createDeepLink(
        URL,
        dynamicLinksDomain,

        function createDeepLinkSuccess(url) {
            console.log(url);
        },

        function createDeepLinkError(error) {
            console.log(error);
        },

        options);
}

The createDeepLink() method requires a URL string that you want to pass back into the app when a user clicks on your link and a dynamicLinksDomain, a string identifying the domain used for the generated deep link (you’ll get this from Onymos). You can add a title, descriptionText, and an imageURL for your deep link inside the options object.

function createDeepLink(){
    OnymosDeepLink.createDeepLink(
        'https://wwww.example.com',
        'example.page.link',

        function createDeepLinkSuccess(url) {
            console.log(url);
        },

        function createDeepLinkError(error) {
            console.log(error);
        },

        {
          title: 'Example',
          descriptionText: 'This is some descriptive text!',
          imageURL: './assets/example.png'
        });
}

But what happens when a user clicks the link? For that, we have to include the onDeepLink() method inside the index.js file. We’ll create an onDeepLink() function that invokes the method, just like before.

onDeepLink() {
  OnymosDeepLink.onDeepLink(
    function onDeepLinkSuccess(success) {
      console.log(success);
    },
    function onDeepLinkSuccess(error) {
      console.log(error);
    });
}

That’s all it takes. With these two functions, your app can start generating—and your users can start sharing—deep links!

4. Troubleshooting

How do I squash this bug? Is Ionic supposed to do that? Why is this iOS build failing?

Let’s figure it out—join the Onymos community on Reddit! More of a loner? You can email us directly at customersuccess@onymos.com.

Dig into our API documentation

Developer support

Got questions? Our support team is here to help.

Think differently about app development

Download our free white paper today to learn how Onymos Features can maximize the value of your developer resources — and shave days or weeks off your development timeline.

Get your free white paper