npm package: @modoryx/go
Description: Universal deep linking SDK for Android & iOS
Author: Modoryx
Latest version: 0.0.7

# Modoryx Go — Universal Deep Linking SDK

# https://go.modoryx.com/

Modoryx Go is a universal deep-linking platform for mobile apps.

It creates ONE smart link that:

- Opens your app if installed
- Redirects users to Play Store / App Store if not installed
- Preserves campaign parameters after installation
- Works with Ionic, Angular, Capacitor, React, Vue, Web

Drop-in plugin. Minimal setup. No custom native Android coding required.

---

Example (Ionic / Angular)

Below is a practical example that:

Initializes Modoryx on startup (ngOnInit)

Reads link params (getLinkData)

If {} is returned, falls back to a locally saved last link (modoryx:lastLink)

If domain exists, uses it, then clears stored data via reset()

```angular
import { Component, OnInit } from '@angular/core';
import { Modoryx } from 'modoryx-go';

@Component({
  selector: 'app-example',
  templateUrl: './example.page.html',
})
export class ExamplePage implements OnInit {

  private readonly LAST_LINK_KEY = 'modoryx:lastLink';

  async ngOnInit() {
    try {
      await Modoryx.init();
      await this.loadLinkData();
    } catch (e) {
      console.log('Modoryx init/load failed', e);
    }
  }

  async loadLinkData() {
    try {
      const dataFromSdk: any = await Modoryx.getLinkData();
      let data: any = dataFromSdk;

      // Empty object => fallback localStorage last link
      if (!data || Object.keys(data).length === 0) {
        const lastLink = this.getJson(this.LAST_LINK_KEY);
        if (lastLink) data = lastLink;
      }

      if (data?.domain) {
        console.log('domain', data.domain);

        // optional: invite, campaign, etc.
        // console.log('invite', data.invite);

        await this.resetModoryx();
      }
    } catch (e) {
      console.log('Modoryx init/load failed', e);
    }
  }

  async resetModoryx() {
    await Modoryx.reset();
  }

  private getJson(key: string): any | null {
    try {
      const raw = localStorage.getItem(key);
      if (!raw) return null;
      return JSON.parse(raw);
    } catch {
      return null;
    }
  }

  private setJson(key: string, value: any): void {
    try {
      localStorage.setItem(key, JSON.stringify(value));
    } catch {
      // ignore quota / serialization errors
    }
  }
}
```

---

## How it works

### iOS support is planned and will be added in a future release.

You create a link like:

https://go.modoryx.com/<APP_ID>/open?domain=test

When users click it:

- If the app is installed → opens instantly
- If not installed → redirects to the correct store
- After first launch → your app receives parameters automatically

Your app simply calls:

Modoryx.getLinkData()

Example result:

{ "domain": "test", "invite": "ABC123" }

If nothing exists:

{}

---

## Install SDK

npm i modoryx-go  
or  
yarn add modoryx-go

---

## Create your app in Modoryx Dashboard

Open:

https://go.modoryx.com/admin/

Add:

- App name
- Android package name
- (optional) iOS bundle id
- (optional) custom scheme or app domain

Save — you receive your APP ID.

Your universal link becomes:

https://go.modoryx.com/<APP_ID>/open?domain=test

---

## Domain verification (required for auto-open)

Create folder on your domain:

/.well-known/

---

### Android — assetlinks.json

Path:

https://YOUR_DOMAIN/.well-known/assetlinks.json

Content:

[
{
"relation": ["delegate_permission/common.handle_all_urls"],
"target": {
"namespace": "android_app",
"package_name": "YOUR_ANDROID_PACKAGE",
"sha256_cert_fingerprints": ["AA:BB:CC:DD:..."]
}
}
]

---

### iOS — apple-app-site-association

Path:

https://YOUR_DOMAIN/.well-known/apple-app-site-association

Content:

{
"applinks": {
"apps": [],
"details": [
{
"appID": "TEAMID.YOUR_IOS_BUNDLE_ID",
"paths": ["*"]
}
]
}
}

Important rules:

- Must be HTTPS
- Must return JSON only
- Do not use .json extension on iOS
- Do not return HTML

---

## Android: enable App Links

Edit file:

`android/app/src/main/AndroidManifest.xml`

Inside your **main activity** add:

```xml
<intent-filter android:autoVerify="true">
  <action android:name="android.intent.action.VIEW" />
  <category android:name="android.intent.category.DEFAULT" />
  <category android:name="android.intent.category.BROWSABLE" />
  <data
    android:scheme="https"
    android:host="YOUR_DOMAIN" />
</intent-filter>

<intent-filter>
  <action android:name="android.intent.action.VIEW" />
  <category android:name="android.intent.category.DEFAULT" />
  <category android:name="android.intent.category.BROWSABLE" />
  <data android:scheme="YOUR_SCHEME" />
</intent-filter>
```

No extra Java/Kotlin code is required.

---

## Initialize Modoryx in your app

Import and call:

Modoryx.init()

during app startup.

---

## Reading deep-link data

Call anywhere:

Modoryx.getLinkData()

Example result:

{ "domain": "test", "invite": "XYZ123" }

If nothing exists:

{}

---

## Clear stored link data

Modoryx.reset()