Install & Initialize
We are no longer updating this site. For user documentation, please go to User Docs. For developer documentation, please go to Developer Docs. If you have any questions or feedback, please submit a ticket.

NPM Module

This page will take you through the steps to set up the Zaius SDK module in your React Native application.
The Zaius SDK module was written using TypeScript and so is fully compatible with both JavaScript and TypeScript applications. If you are developing a new React Native app and wish to integrate with Zaius, it's recommended you use TypeScript.react-native init Project --template typescript
npm install --save @zaiusinc/react-native-sdk @react-native-community/async-storage [email protected]
If you are relying on the Zaius SDK, you must use react-native-push-notification version 3.2.1. If you are handling the display of the notifications, newer versions may work.


For an iOS project you'll also need to run the following:
npm install --save @react-native-community/push-notification-ios
cd <project>/ios && pod install
react-native link
After this, you will need to allow your app's Bundle ID to have the Push Notifications capability (in Xcode, click on Capabilities and scroll down to Push Notifications).


Inside <project>/android/app/src/main/AndroidManifest.xml, integrate the following XML to allow proper permissions to allow the app to manage Push Notifications.
android:permission="" >
<action android:name="" />
<category android:name="${applicationId}" />
<receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationPublisher" />
<receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationBootEventReceiver">
<action android:name="android.intent.action.BOOT_COMPLETED" />
<service android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationRegistrationService"/>
android:exported="false" >
<action android:name="" />
<!-- <non-Zaius firebase support> -->
android:exported="false" >
<action android:name="" />
<!-- </non-Zaius firebase support> -->
You will also need to install your google-services.json according to Google's instructions. From the google-services.json file, you will need the project_number field, which you will use as the "Sender ID".


In order to use the Zaius SDK, it must first be configured. You will need two required and one optional piece of information: First, you will need the Short Identifier from the Mobile Apps integration. This will be your App ID. Next, the API Key can be obtained from the "APIs" section in Zaius. Your API Key will be in the "key" field under "Public". Lastly, you will optionally need the Sender ID as mentioned above. This isn't required for iOS apps, but is required for Android apps.
With this information, you can use the main entry point for the SDK, Zaius.configure()
Zaius.configure(options) : Promise<Zaius>
// where options include:
appId: string,
apiKey: string,
appVersion?: string = '',
baseUrl?: string = '',
onNotification?: (notification: PushNotification) => void = () => undefined,
onRegister?: (push_token: PushToken) => void = () => undefined,
platform?: 'ios' | 'ios-sandbox' | 'android' | 'tvos' | 'tvos_sandbox' | 'unknown' // = [calculated from Platform.OS]
requestPermissions?: boolean = true,
senderID?: string = '',
startQueue?: boolean = true,
The arguments of configure are as follows:
  • appId: [Required] The App ID as mentioned above, the Shortened Name of your project.
  • apiKey: [Required] The API Key from the Public tab in the APIs section of the Zaius app.
  • appVersion: The version of your app, sent with each request to help you keep track of which customers are using which version.
  • baseUrl: Where the Zaius API is located. This should not normally by changed.
  • onNotification: A callback function that is called when a Push Notification is recieved by the app (Android) or tapped by the user (both Android and iOS). See Push Notifications for more information.
  • onRegister: A callback function that is called when permission for Push Notifications has been granted. Once this callback is called, everything is set up on the phone side for Pushes to work.
  • platform: Which platform the app is running on. Will be detected if it's not supplied.
  • requestPermissions: Should be false for modern android OS versions. For iOS, if this is false, then it is up to the app author to callZaius.requestPermission() in order for Push Notifications to be initialized on iOS. See Push Notifications for more.
  • senderID: [Required for Android] Required for Push Notifications on Android. The Sender ID is found in the google-services.json file you can obtain this file from Firebase by following Google directions. The Sender ID is the value found at project_info -> project_number.
  • startQueue: When set to true, the SDK will start processing the Event queue as soon as it can. See Events for more information about the Event queue.
The return type of Zaius.configure is a Promise and so it must be handled as a Promise or called from an async function.
Once you have the Zaius object from configure() the following functions are available on both the object returned from Zaius.configure() and as functions directly on the global Zaius object (e.g. Zaius.customer()).
  • Zaius.getConfig(): Returns the configuration that the Zaius object is using.
  • Zaius.getVUID(): Return the VUID that identifies the current user. See VUIDs for more info.
  • Zaius.anonymize(): Generates a new VUID, effectively anonymizing the user.
  • Zaius.event(): Queues an event into the Event queue. See Events for more info.
  • Zaius.customer(): Updates information about this Customer with Zaius. See Customers for more info.
  • Zaius.identify(): Updates Customer identification information. See Customers for more info.