Skip to main content

API Methods

Below is a detailed list of all methods available in the Appfastfly SDK instance.

init()

Initializes the SDK, sets up universal link listeners, and checks for deferred install payloads.

Appfastfly.init(): Promise<void>

subscribe(listener)

Subscribe to incoming deep link events. The callback may fire immediately if a link payload was already cached.

Appfastfly.subscribe(listener: (event: DeepLinkEvent) => void): () => void

Where DeepLinkEvent is:

type DeepLinkEvent = {
url?: string;
payload: Record<string, any>;
isFirstSession: boolean;
};

Returns: An unsubscribe function to clean up the listener.

getLatestParams()

Returns the most recently received deep link payload, or null.

Appfastfly.getLatestParams(): Record<string, any> | null

getFirstParams()

Returns the very first deferred deep link payload received on app install, or null.

Appfastfly.getFirstParams(): Record<string, any> | null

createLink(params)

Creates a new short link programmatically via the SDK.

Appfastfly.createLink(params: CreateLinkParams): Promise<{ shortCode: string; url: string }>

Where CreateLinkParams is:

type CreateLinkParams = {
payload: Record<string, any>;
ogTitle?: string;
ogDescription?: string;
ogImageUrl?: string;
channel?: string;
campaign?: string;
tags?: string[];
iosRedirectUrl?: string;
androidRedirectUrl?: string;
webRedirectUrl?: string;
expiresAt?: string;
};

setIdentity(userId)

Associates the current device hardware with a specific user ID, so future clicks and installs can be grouped by User ID.

Appfastfly.setIdentity(userId: string): Promise<void>

logout()

Removes the current device-user association. Call this when your user signs out.

Appfastfly.logout(): Promise<void>