Skip to main content

React Native SDK API Reference

Auto-generated from TypeDoc annotations in @hoberhq/react-native-sdk. All methods are available on the default Hober export.

Hober.init(options)

Initializes the SDK. Call once from your app entry point (e.g. App.tsx) before calling any other Hober method.

Signature

Hober.init(options: HoberInitOptions): void

Parameters

ParameterTypeRequiredDescription
options.sdkKeystringYesYour Hober SDK key from the dashboard.
options.baseUrlstringNoOverride the Hober API base URL (e.g. for staging).

Returns: void

Throws: HoberError if sdkKey is empty.


Hober.requestPermission()

Requests notification permissions from the OS. Returns Promise<boolean>.

Signature

Hober.requestPermission(): Promise<boolean>

Returns: Promise<boolean> — resolves to true if permission is granted, false otherwise.

Notes:

  • On iOS, delegates to UNUserNotificationCenter.requestAuthorization.
  • On Android 13+ (API 33+), requests the POST_NOTIFICATIONS runtime permission.

Hober.identifySubscriber(subscriber)

Associates the current user with a Hober subscriber record by calling POST /v1/subscribers/upsert.

Signature

Hober.identifySubscriber(subscriber: HoberSubscriberOptions): Promise<void>

Parameters

ParameterTypeRequiredDescription
subscriber.externalIdstringYesYour application's user identifier.
subscriber.emailstringNoSubscriber email address.
subscriber.attributesRecord<string, string | number | boolean>NoAdditional subscriber attributes.

Returns: Promise<void>

Throws: HoberError if externalId is empty or the API returns a non-2xx response.


Hober.registerDevice(token)

Registers the FCM/APNs device push token with the Hober backend by calling POST /v1/devices.

Signature

Hober.registerDevice(token: string): Promise<void>

Parameters

ParameterTypeRequiredDescription
tokenstringYesThe FCM registration token (Android) or APNs device token (iOS).

Returns: Promise<void>

Throws: HoberError if token is empty or the API returns a non-2xx response.


Types

HoberInitOptions

interface HoberInitOptions {
sdkKey: string;
baseUrl?: string;
}

HoberSubscriberOptions

interface HoberSubscriberOptions {
externalId: string;
email?: string;
attributes?: Record<string, string | number | boolean>;
}

See Also