Tether SDK read modes
Read the Tether code in your iOS, React Native or Flutter app with a paste button, an automatic read, or a call you make. Android reads the install referrer.
The WarpLink SDK reads the Tether code on the iPhone and sends it to WarpLink. Tether needs SDK 1.4.0 or newer on iOS, React Native and Flutter. Older SDKs do not read the code.
The SDK sends only WarpLink codes: text that starts with wl1_, or wl1t_ for a test code. It never sends other clipboard text. After WarpLink uses a code, the SDK clears it from the clipboard, if the clipboard still holds that code.
Read modes
You pick one read mode in configure. The default is the paste button.
| Mode | When the SDK reads | What the person sees |
|---|---|---|
| Paste button (default) | When the person taps a system paste button that you place in your app | One tap. This tap shows no paste prompt |
| Automatic | During the first-launch check, and again on a later launch until a check completes | iOS may show its own paste prompt |
| On call | When your code calls readTether | iOS may show its own paste prompt at that moment |
Use the paste button when your first-run screen has room for a button. Use automatic for the shortest path to the link. Use on call when you want to choose the moment, for example after a welcome screen.
Read the code in the app
Install SDK 1.4.0 or later (Swift Package Manager): .package(url: "https://github.com/WarpLinkApp/warplink-ios-sdk", from: "1.4.0"). Earlier versions do not read the code.
Replace YOUR_SDK_KEY with an SDK key for this app. Create one on the Keys page of the dashboard, on the SDK keys tab. An AI agent can call create_key with type sdk.
Set the read mode with tetherReadMode in configure. The default is .pasteButton. The SDK then reads the code after the person taps a system paste button.
.automatic reads during the first-launch check, and again on a later launch until that check completes. .onCall reads when your code calls WarpLink.readTether(completion:).
The first-launch check is the SDK's check for a link after an install. It repeats on a later launch until it completes.
In the default mode, add WarpLinkPasteButton to your first-run screen. It needs iOS 16. On iOS 15, use a plain button that calls WarpLink.readTether(completion:), as the snippet does. iOS may show its paste prompt then.
Route links in onLink. In the paste button and on call modes, onLink first gets an estimate, if the SDK found one. An estimate is a best guess and can be the wrong link.
When the SDK reads a valid code, the exact link reaches the read callback. It reaches onLink again only when onLink got another link first. The snippet calls routeOnce, so each link opens once.
In automatic mode, onLink fires once per check. The link is exact when the SDK read a valid code. With no code, it is an estimate, if the SDK found one. Check evidenceClass to tell them apart.
Put each part of the snippet in its place. lastRouted, routeOnce and handle go at file scope. The WarpLink.configure block goes in your App's init(). The if #available block goes in the body of your first-run view. Read WarpLink.lastTetherTestReceipt where you show or log it, for example in a button action.
The snippet calls router.replaceRoute and router.showRoute. Replace them with the app's own navigation code, which opens the screen for a link. If the app has no screen for the link, open the home screen.
Show or log the test receipt, so you can send it to verify_setup as tether_test_receipt. It is WarpLink.lastTetherTestReceipt. The SDK forgets it when the app restarts.
import SwiftUI
import WarpLink
// One match can reach onLink and the read callback. Route each link once.
@MainActor var lastRouted: String?
@MainActor func routeOnce(_ link: WarpLinkDeepLink, _ route: (WarpLinkDeepLink) -> Void) {
let key = link.linkId.isEmpty ? link.destination : link.linkId
guard key != lastRouted else { return }
lastRouted = key
route(link)
}
// router stands for your app's own navigation code. Replace it.
WarpLink.configure(
apiKey: "YOUR_SDK_KEY",
options: WarpLinkOptions(
tetherReadMode: .pasteButton,
onLink: { result in // onLink runs on the main actor.
guard case .success(let link?) = result else { return }
if link.evidenceClass == .exact {
routeOnce(link) { router.replaceRoute(with: $0) } // the exact link: switch to it
} else {
routeOnce(link) { router.showRoute(for: $0) } // an estimate: a best guess
}
}
)
)
// On the first-run screen. Always let the person continue without it.
func handle(_ result: Result<TetherReadResult, WarpLinkError>) {
guard case .success(.matched(let link)) = result else { return } // Other results: .noCode, .unusable and .test.
Task { @MainActor in routeOnce(link) { router.replaceRoute(with: $0) } }
}
if #available(iOS 16.0, *) {
WarpLinkPasteButton(onTether: handle)
} else {
Button("Paste your code") { WarpLink.readTether(completion: handle) }
}
// Show or log WarpLink.lastTetherTestReceipt after the SDK read the test code.The order of onLink calls
Your app gets a link from onLink and from the read callback. The read mode decides what onLink gets first.
| Mode | First onLink call | Second onLink call |
|---|---|---|
| Automatic | The exact link, when the SDK read a valid code. With no code, an estimate, if the SDK found one | None |
| Paste button | The estimate from the first-launch check, if the SDK found one | The exact link, when the pasted code gives a link that differs from the estimate |
| On call | The estimate from the first-launch check, if the SDK found one | The exact link, when readTether gives a link that differs from the estimate |
In paste button and on call modes, the SDK reads nothing at first launch. The first-launch check can only estimate from device signals. An estimate has matchType probabilistic and evidenceClass estimated. It carries no UTM values. It can be a different link than the one the person tapped.
When the SDK reads a valid code, the exact link has matchType deterministic, evidenceClass exact and matchGuaranteed true. It always reaches the paste button or readTether callback. It reaches onLink too, but only when onLink already got a different link.
onLink never gets the same link twice. Two links are the same when their link ids match, or their destinations match when there is no link id. Only a Tether read can call onLink again. redeemInvitation answers only its own caller. If the first-launch check found no estimate, the exact link reaches only the read callback. React Native and Flutter deliver the second call when it follows the first in the same app session.
Route on the first call, and replace that route on the second. router is your own navigation code:
WarpLink.configure(
apiKey: "YOUR_SDK_KEY",
options: WarpLinkOptions(
tetherReadMode: .pasteButton,
onLink: { result in
guard case .success(let link?) = result else { return }
if link.evidenceClass == .exact {
router.replaceRoute(with: link) // the exact link: switch to it
} else {
router.showRoute(for: link) // an estimate: a best guess
}
}
)
)
If the person has already acted on the estimate, keep the screen they are on. Apply the exact link's parameters, such as UTM values, to what you record.
What the read returns
A read returns one of four results: a match with the link's destination and parameters, no code with a reason, an unusable code, or a test receipt. A failed read, for example after a network error, is an error and not a result.
A no-code result carries one of three reasons:
| No-code reason | Meaning |
|---|---|
paste_not_allowed | The person declined the paste |
clipboard_empty | The clipboard held no text, or text that is not a WarpLink code |
older_sdk | The build has no clipboard access. The name does not mean an old SDK version |
A code that WarpLink does not accept gives an unusable result, or an error when the code expired on the device. Results also counts the reasons that WarpLink records: expired, other_app and link_ended. in_app_browser is in the REST list, but nothing reports it yet. Use them to see why a tap did not become a match.
Android
Android needs no clipboard. Tether on Android reads the install referrer from Google Play, as before. WarpLink.readTether gives TetherReadResult.NoClipboard to its callback once the SDK is configured, so the same shared code can call it on every platform. A wl1t_ code in the install referrer is a test, and its receipt is in WarpLink.lastTetherTestReceipt.
A valid Tether code wins over probabilistic matching, even when a newer link was tapped on the same network. Results show the match method as Tether.
Next steps
- Test Tether to confirm the read with a test code
- Privacy and App Review for the review note and label text
- iOS SDK, React Native SDK, Flutter SDK
Tether hosted page
Turn on the WarpLink hosted page so an iPhone tap copies a Tether code and opens the App Store. Set the headline, button and colour, with no script to add.
Test Tether
Check your Tether setup with a test code that writes no install, click or referral, then read the setup check rows that tell you what to fix next.