SDK / WEB
Deep linking for web experiences.
Use the server client for protected link-management operations, or call browser-safe helpers for explicit matching and link resolution.
01 / Install
Add the SDK
npm install @wilderlinks/wilderlinks-sdk@1.0.502 / Configure
Initialize once
Use the WilderLinks API base URL and add the exact link host configured for your app. Replace links.example.com with that host.
import { WilderlinksClient } from '@wilderlinks/wilderlinks-sdk';
// Run only on a trusted server. Keep this key out of browser bundles.
const wilderlinks = new WilderlinksClient({
apiKey: process.env.WILDERLINKS_API_KEY!,
baseUrl: 'https://api.wilderlinks.space',
});
export async function createOfferLink() {
return wilderlinks.createDeepLink({
defaultUrl: 'https://www.example.com/offers',
deepLinkPayload: { screen: 'offers' },
});
}03 / Resolve
Handle an incoming link
The SDK returns a match result; your application remains responsible for navigating to the right screen.
import { resolveLink } from '@wilderlinks/wilderlinks-sdk';
async function resolveIncomingLink() {
const result = await resolveLink('https://api.wilderlinks.space', {
domain: 'links.example.com',
slug: 'summer-offer',
platform: 'desktop',
});
console.log(result.destinationUrl, result.deepLinkPayload);
}Fields returned by the primary link handler
titledestinationUrldeepLinkPayload04 / Deferred matching
Match only tokens your app can access
import { checkDeferredMatch } from '@wilderlinks/wilderlinks-sdk';
async function checkBrowserDeferredMatch() {
const result = await checkDeferredMatch('https://api.wilderlinks.space');
if (result.matched) {
console.log(result.deepLinkPayload);
}
}- The browser helper can match a token only when the app-open interstitial flow has stored it in localStorage.
- Deferred match methods return matched, installId, openId, deepLinkPayload, destinationUrl, installAttributionProvider, and error; resolveLink has a different result shape shown above.
- Current mobile deferred-install attribution should use the platform SDK or an explicit token exchange; browser localStorage is not a mobile install-referrer mechanism.
- matchInstallAttributionToken(baseUrl, token, provider) exchanges a token obtained by your own attribution flow.
05 / Platform setup
Before testing on a device
- WilderlinksClient is for trusted server runtimes: its apiKey authenticates link-management requests. Never instantiate it in browser code or expose the key in a client bundle.
- resolveLink(...) is a browser-safe helper but calls the live /api/v1/resolve endpoint. It is for runtime resolution, not a side-effect-free preview.
- checkDeferredMatch(baseUrl) reads dl_match_token from localStorage and posts it to /api/v1/match. It does not retrieve a token from an app store.
06 / Security
Keep private credentials server-side
Do not ship organization or private API keys in mobile apps, browser JavaScript, or Unity client builds. Client-side link resolution and authenticated link-management operations have different trust boundaries; keep API-key operations in a trusted server environment.
The Web SDK’s WilderlinksClient authenticates link-management requests with its API key. Browser helpers do not need that client key.
07 / Troubleshooting
When a link does not match
- Keep the API key on a trusted server and call server client methods only from server code.
- Check domain and slug values passed to resolveLink(...); the helper constructs a live resolver request from those values.
- If checkDeferredMatch(...) returns unmatched, confirm the token exists in localStorage and that the browser can reach the configured API base URL.
Continue building