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
| Parameter | Type | Required | Description |
|---|---|---|---|
options.sdkKey | string | Yes | Your Hober SDK key from the dashboard. |
options.baseUrl | string | No | Override 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_NOTIFICATIONSruntime 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
| Parameter | Type | Required | Description |
|---|---|---|---|
subscriber.externalId | string | Yes | Your application's user identifier. |
subscriber.email | string | No | Subscriber email address. |
subscriber.attributes | Record<string, string | number | boolean> | No | Additional 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
| Parameter | Type | Required | Description |
|---|---|---|---|
token | string | Yes | The 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>;
}