Skip to main content
Documentation
SDKsReact Native

React Native API Reference

The complete TypeScript API reference for the WarpLink React Native SDK: initialization, deep link events, and attribution.

The main entry point. Exported from @warplink/react-native.

configure(options)

Initialize the SDK. The key format is validated synchronously; the returned promise resolves after native configuration completes, including the automatic cold-start and deferred deep link dispatch.

ParameterTypeDescription
optionsWarpLinkConfigConfiguration with your SDK key, the onLink callback, and optional settings.

When onLink is set, configure() wires getInitialDeepLink (cold start), onDeepLink (warm start), and checkDeferredDeepLink (deferred) into that single callback. Disambiguate the deferred case with isDeferred. Set automaticDeepLinks or automaticDeferredDeepLinks to false to disable either piece.

Does not throw. A malformed SDK key is reported through your onLink callback as an { error } event with code E_INVALID_API_KEY_FORMAT, and always logs a warning. The SDK stays unconfigured. iOS and Android behave the same way.

Call it once at startup. A second call with the same key and options keeps the session and takes the new onLink. If no check is running and the check has no answer yet, it asks the native check once more, at most once a minute. The native SDK decides whether that sends a request, so a wait that is still running holds it back. A different key, different options, or adding or removing onLink start a new session.

handleDeepLink(url)

Resolve a deep link URL to its link data.

Errors: E_NOT_CONFIGURED, E_INVALID_URL, E_LINK_NOT_FOUND, E_PASSWORD_REQUIRED, E_NETWORK_ERROR, E_SERVER_ERROR, E_INVALID_API_KEY, E_DECODING_ERROR

Check for a deferred deep link on first launch. Returns null if no match found. On subsequent launches, returns the cached result.

"First launch" means the first launch of the current install. A reinstall is a new install and runs the check again, with is_reinstall set on the request. See App Reinstall.

Errors: E_NOT_CONFIGURED, E_NETWORK_ERROR, E_SERVER_ERROR, E_INVALID_API_KEY, E_KEY_APP_MISMATCH, E_DECODING_ERROR

getAttributionResult()

Get install attribution data. Returns null if no attribution match found.

redeemInvitation(text)

Redeem a referral invitation the person pasted. This call reads nothing from the clipboard: the text reaches it only through this call.

Resolves with the matched link, also cached as the attribution result. Resolves with null when the text is not an invitation or matched nothing; nothing is confirmed then. An invitation that is invalid or expired rejects with a WarpLinkError whose message says how to open the link again. After a network failure the native SDK keeps the invitation and tries again on a later launch, a bounded number of times. That later result is delivered through getAttributionResult() and claimReferral, not through onLink.

Errors: E_NOT_CONFIGURED, E_NETWORK_ERROR, E_SERVER_ERROR

claimReferral(installerId)

Credit the referral behind this install to the person who just signed up. installerId is your own stable id for them, 1 to 128 characters. The call is safe to repeat: the same id gets the same answer and is never credited twice. A status of none is an ordinary answer, not an error.

PropertyTypeDescription
status'claimed' | 'flagged' | 'ignored' | 'none'The outcome of the claim.
referralIdstring | nullThe referral's id. null for none.
linkId, linkUrlstring | nullThe link the referral came from.
matchMethodMatchMethod | nullHow the referral was matched.
isExactbooleantrue when the match rests on exact evidence.
matchConfidencenumber | nullThe confidence of an estimated match.
flagsstring[]Reasons for review, for example outside_window.
duplicateOfstring | nullFor ignored, the referral that holds the credit.
updatedbooleantrue when this call replaced an estimate with an exact match.
replayStateReplayState | nulloriginal or replayed.

Errors: E_NOT_CONFIGURED, E_NETWORK_ERROR, E_SERVER_ERROR, E_INVALID_API_KEY, E_KEY_APP_MISMATCH. An empty or over-long installerId rejects with E_SERVER_ERROR.

clearAttribution()

Forgets this install's attribution so you can test a first launch again without deleting the app: the cached match, the attempt and completed markers, and any held referral invitation. Only the device is cleared. Server records are not deleted.

Test only. With a wl_live_ key this does nothing and resolves, so it never erases a live install's attribution. With a wl_test_ key and automaticDeferredDeepLinks on, a check already in flight is discarded and a new check starts. A match from it reaches onLink.

Errors: E_NOT_CONFIGURED before configure. E_STORAGE_ERROR when a stored item could not be deleted and some state may remain. Calling again is safe.

isConfigured()

Check whether the SDK has been configured.

sdkVersion()

Returns the version of the native WarpLink SDK the app is actually running, not the @warplink/react-native package version. This distinction matters because the package bundles the native WarpLink SDK. Calling sdkVersion() asks the native side directly, so you always see the version your app runs.

isAttributionComplete()

Whether the deferred attribution check has definitively completed for the current install. Scoped to one install: it reads false again after the app is deleted and reinstalled, or restored from a device backup, because a reinstall is attributed again from scratch. The automatic dispatch inside configure() already reads this before deciding whether to re-fire the deferred check, so a normal integration built on the opt-out model never has to call it directly. It is useful for diagnostics, or for a host that drives checkDeferredDeepLink() manually with automaticDeferredDeepLinks: false.

getDeferredCheckStatus()

Where the deferred check stands for this install, read without sending a request. It tells a skipped check from no match. It comes from what the native SDK stored, so a relaunch keeps it. retryAt is set only when state is 'waiting', in epoch milliseconds.

StateMeaning
'notChecked'No check has finished for this install. A failed check whose wait has passed also reads 'notChecked'.
'checking'A check is running, or waiting for the app to come to the foreground.
'matched'The check finished and found a link.
'noMatch'The check finished and the server found no link.
'waiting'An earlier check failed. The SDK sends nothing before retryAt.
'skippedOldInstall'The install is older than 30 days by default, so no request is sent.
'stopped'The SDK gave up 3 days after the first failure by default. No request is sent.

A wl_test_ key never reports 'waiting', 'skippedOldInstall' or 'stopped'. With debugLogging on, the native SDK prints Deferred check request: attempt <n>, raw signals <yes|no> for each request and Deferred check: <state> when a check ends. In Xcode the lines start with [WarpLink]. In Logcat, filter by the WarpLink tag. A waiting check prints Deferred check: waiting, retry at <ISO 8601 time>. See If your test did not match.

Errors: E_DECODING_ERROR when the native reply is malformed. Before configure it resolves { state: 'notChecked' }.

readTether()

Reads the clipboard for a Tether code now, and sends the code to the server. It works in every tetherReadMode. On iOS the system may show its paste prompt. On Android nothing is read, and the result is { kind: 'noCode', reason: null }. A match that replaces a link onLink already received also reaches onLink as an exact link. It rejects with a WarpLinkError when the SDK is not configured or the request failed. See Tether.

lastTetherTestReceipt()

The receipt the server returned for the last Tether test code (wl1t_), or null. It is kept in memory only: a restart or clearAttribution() clears it.

onDeepLink(listener)

Register a listener for warm-start deep link events. Returns an unsubscribe function.

Get the deep link that launched the app (cold start). Returns null if not launched via a link.


Types

WarpLinkConfig

matchWindowHours is accepted for backward compatibility but has no effect: the match window is set per link in the dashboard.

tetherReadMode

How the SDK gets a Tether code from the clipboard. 'pasteButton' is the default: the SDK never reads the clipboard by itself, and the person taps WarpLinkPasteButton. 'automatic' reads once during the first-launch check, and iOS may show its paste prompt then. 'onCall' reads only when you call readTether(). Android reads no clipboard in any mode. A value that is not one of these reads as 'pasteButton'.

linkDomains

Hosts the SDK should treat as yours, in addition to aplnk.to. configure() forwards the list to the native SDKs, which own the domain set and the normalization (trimmed, lowercased, a full URL reduced to its host). Declaring a custom domain here is what lets a link on it resolve on the first launch, before the SDK has reached the server. The same domains can be declared natively instead: see iOS and Android.

AttributionResult

MatchMethod is 'install_token' | 'android_referrer' | 'referrer' | 'device_id' | 'link_open' | 'probabilistic' (android_referrer is an invitation token from the Play install referrer and referrer is a plain link ID from it, so referrer comes with evidenceClass legacy_link), EvidenceClass is 'exact' | 'estimated' | 'legacy_link' and ReplayState is 'original' | 'replayed'. A value this SDK does not know reads as null, and null is never read as exact.

DeepLinkEvent

Discriminated union: exactly one of deepLink or error is present.

DeepLinkListener


TetherReadResult

KindMeaning
matchedThe code led to link.
noCodeNo code was read and nothing was sent. reason says why, and is null on Android.
unusableA code was sent and led nowhere. Let the person continue.
testA test code reached the server and nothing was recorded.

A failure is a rejected promise with a WarpLinkError, never one of these. TetherMissReason is one of 'paste_not_allowed', 'clipboard_empty', 'in_app_browser', 'expired', 'other_app', 'link_ended' and 'older_sdk'.

WarpLinkPasteButton

The system paste button that reads a Tether code. In the default 'pasteButton' mode it is the only way the SDK reads the clipboard, and iOS shows no paste prompt. It renders nothing on Android and on iOS below 16.

PropTypeDescription
onResult(result: TetherReadResult) => voidCalled with the outcome after the person taps the button.
onError(error: WarpLinkError) => voidCalled when the read or the request failed.
styleStyleProp<ViewStyle>Layout. The default size is 160 by 44 points.
baseBackgroundColor, baseForegroundColorColorValueThe button colors.
cornerStylePasteButtonCornerStyle'dynamic', 'fixed', 'small', 'medium', 'large' or 'capsule'.
displayModePasteButtonDisplayMode'iconAndLabel', 'iconOnly' or 'labelOnly'.

Error Types

WarpLinkError

ErrorCodes

CodeDescription
E_NOT_CONFIGUREDSDK not initialized.
E_INVALID_API_KEY_FORMATKey format invalid.
E_INVALID_API_KEYKey rejected by server.
E_KEY_APP_MISMATCHThe key is valid but tied to a different app. Use the SDK key created for this app.
E_NETWORK_ERRORNetwork unreachable or timeout.
E_SERVER_ERRORServer returned 5xx.
E_INVALID_URLNot a recognized WarpLink domain.
E_LINK_NOT_FOUNDLink not found or inactive.
E_PASSWORD_REQUIREDLink is password protected, so it resolves to no destination and no platform URLs.
E_DECODING_ERRORMalformed server response.
E_STORAGE_ERRORclearAttribution() could not delete a stored item. Calling it again is safe.

Native Bridge

@warplink/react-native is a classic native-module bridge (NativeModules + a single NativeEventEmitter channel, onWarpLinkDeepLink), not a TurboModule authored from scratch. React Native's interop layer runs classic modules unmodified under both the classic and New Architecture (Fabric/TurboModules), so every method and type on this page behaves identically regardless of which architecture your app runs.

Two properties of the bridge shape are worth knowing when debugging:

  • Every promise-returning method here (handleDeepLink, checkDeferredDeepLink, getAttributionResult, isConfigured, sdkVersion, isAttributionComplete) makes one native call and resolves or rejects from its answer. None of them poll.
  • onDeepLink() and the automatic onLink sink both read from the same underlying native event stream; the TypeScript layer fans one native event out to every JavaScript subscriber rather than opening a separate native subscription per listener.

If the module is not linked (NativeModules['WarpLinkModule'] is undefined), every method on WarpLink throws synchronously with a linking error rather than rejecting a promise, since there is no native module to make the call against. See Deep Links: Troubleshooting for the common causes.

Platform Requirements

The native side has its own floor: iOS 15.0 (set in warplink-react-native.podspec) and Android API 26 / Android 8.0 (minSdk in the module's android/build.gradle.kts), matching the standalone iOS and Android SDKs exactly, since this package embeds them rather than reimplementing anything. Node.js 18+ is required to build the package itself, not to run the resulting app.

TypeScript Types Exported

Every type in this reference is exported from the package root, not from an internal path:

Importing from an internal path such as @warplink/react-native/src/WarpLink is unsupported and will break on a future release; the package's main/module/types fields all resolve through the root entry point.

Expo

The SDK works in an Expo development build (npx expo prebuild or EAS Build). Add the iOS host hook (WarpLinkModule.handleIncomingURL, see Deep Links) to the generated AppDelegate/SceneDelegate, or reinsert it on every prebuild with a small withAppDelegate config plugin. Associated Domains and the Android intent filter both have app.json equivalents and need no manual native editing.

Troubleshooting

customParams values come back as unknown and TypeScript complains. This is deliberate. Custom parameters are the query parameters of the link's destination URL, returned as a JSON object, so the type is Record<string, unknown> rather than a link-specific shape the SDK cannot know ahead of time. Narrow with a type assertion or a runtime check at the call site: link.customParams['product_id'] as string | undefined.

sdkVersion() reports a different version than the npm package. The native SDK version is versioned separately and reflects the SDK your app runs.

FAQ

Does configure() need to be awaited before calling other methods? Not strictly. configure()'s promise resolves once native configuration, cold-start dispatch, and (when a sink is present) the deferred check have all settled, but handleDeepLink() and the other methods each make their own native call and will queue behind an in-progress native configuration rather than fail. Awaiting configure() is still the simplest way to know setup fully finished.

How do I use WarpLink from React function components? The package exports a single module-level WarpLink object with promise-based methods and an event subscription (onDeepLink), the same shape on every platform this SDK supports. Wrap it in your own hook if your codebase prefers that pattern; there is nothing React-specific in the underlying calls that a hook would add.

What TypeScript version is required? The package ships its own .d.ts files built against the react-native peer dependency's types; any TypeScript version compatible with your installed react-native and @types/react versions works. There is no WarpLink-specific TypeScript floor beyond what React Native itself requires.

Does getAttributionResult() make a network call, or read a cached value? It reads the native SDK's cached result from the deferred check that already ran; it does not trigger a new attribution request. Call checkDeferredDeepLink() if you need to force the check to run (only meaningful before it has completed for the current install).