Docs

API Reference

Complete React Native SDK properties and methods reference

Methods

onDeeplinkReceived

onDeeplinkReceived(callback: (data: DeeplinkResponse) => void): { remove: () => void }

Register a listener for deep link events. Returns an object with a remove() method to unsubscribe.

setSDK

setSDK(enabled: boolean): void

Enable or disable the SDK.

setDebug

setDebug(level: LogLevel): void

Set the debug logging level. Options: 'info', 'error'.

setPushToken

setPushToken(pushToken?: string): void

Set the push notification token (FCM or APNs) for receiving dashboard messages.

setIdentifier

setIdentifier(identifier?: string): void

Set the user identifier. This value appears in the Grovs dashboard and reports.

setAttributes

setAttributes(attributes?: { [key: string]: any }): void

Set user attributes for identification and behavior analysis in the dashboard.

generateLink(
    title?: string,
    subtitle?: string,
    imageURL?: string,
    data?: { [key: string]: any },
    tags?: string[],
    customRedirects?: CustomRedirects,
    showPreviewIos?: boolean,
    showPreviewAndroid?: boolean,
    tracking?: Tracking
): Promise<string>

Generate a smart link with the specified parameters. All parameters are positional and optional.

displayMessages

displayMessages(): Promise<void>

Display the messages list as a modal.

numberOfUnreadMessages

numberOfUnreadMessages(): Promise<number>

Get the count of unread messages.

logInAppPurchase

logInAppPurchase(transactionId: string): Promise<boolean>

Log a platform store purchase for revenue attribution. On iOS, pass the StoreKit transaction ID as a string. On Android, pass the purchase originalJson. Returns true on success.

logCustomPurchase

logCustomPurchase(
    type: TransactionType,
    priceInCents: number,
    currency: string,
    productId: string,
    startDate?: string
): Promise<boolean>

Log a custom purchase, cancellation, or refund. The startDate is an optional ISO 8601 date string. Returns true on success.


Types

DeeplinkResponse

interface DeeplinkResponse {
    link: string;
    data?: { [key: string]: any };
}

Contains information about a received deep link.

PropertyTypeDescription
linkstringThe deep link URL that opened the app.
dataobject?Custom payload data attached to the link.

Tracking

interface Tracking {
    utm_medium?: string;
    utm_source?: string;
    utm_campaign?: string;
}

UTM tracking parameters for link generation.

ParameterDescription
utm_campaignCampaign name (e.g. 'spring_sale').
utm_sourceTraffic source (e.g. 'in_app').
utm_mediumMarketing medium (e.g. 'share_button').

CustomRedirects

interface CustomRedirects {
    ios: CustomLinkRedirect;
    android: CustomLinkRedirect;
    desktop: CustomLinkRedirect;
}

Override the default redirect behavior per platform when generating a link.

CustomLinkRedirect

interface CustomLinkRedirect {
    link: string;
    open_if_app_installed: boolean;
}

A platform-specific redirect. When open_if_app_installed is true, the app opens if installed; otherwise the link URL is always used.

LogLevel

type LogLevel = 'info' | 'error';

Controls the verbosity of SDK log output. Pass to setDebug().

TransactionType

type TransactionType = 'buy' | 'cancel' | 'refund';

The type of payment transaction. Used with logCustomPurchase.

ValueDescription
'buy'A new purchase.
'cancel'A cancelled subscription or purchase.
'refund'A refunded transaction.