This module is a wrapper over the native Mindbox(iOS, Android) libraries that allows to receive and handle push notifications.
- Receive and show push notification in both mobile platforms.
- Receive push notification data(links) in React Native.
This plugin depends on the configuration of push notifications on native platforms. It's necessary to follow the steps specified in the guide:
npm install mindbox-sdkimport MindboxSdk from "mindbox-sdk";Initialization of MindboxSdk. It is recommended to do this on app's launch.
await MindboxSdk.initialize({
domain: 'api.mindbox.ru',
endpointId: 'your-endpoint-id-here',
subscribeCustomerIfCreated: true,
shouldCreateCustomer: true,
previousInstallId: '',
previousUuid: '',
});Requires a callback that will return device UUID.
MindboxSdk.getDeviceUUID((uuid: string) => { ... });Requires a callback that will return FMS (Android) / APNS (iOS) token.
MindboxSdk.getToken((token: string) => { ... });Updates your FMS/APNS token.
await MindboxSdk.updateToken('your-fms/apns-token');Requires a callback that will return push notification link or push notification button link when it clicked.
MindboxSdk.onPushClickReceived((pushClickRecievedData: string) => { ... });Makes request to backend API without waiting any response.
MindboxSdk.executeAsyncOperation({
operationSystemName: '--YOUR SYSTEM NAME HERE--',
operationBody: { ... },
});Makes request to backend API and waits response.
MindboxSdk.executeSyncOperation({
operationSystemName: '--YOUR SYSTEM NAME HERE--',
operationBody: { ... },
onSuccess: (data) => { ... },
onError: (error) => { ... },
});