Skip to main content
Most core methods return a Promise. Await them when you need to sequence work after the native call completes.

Core SDK

Zixflow.initialize(config: ZixflowConfig): Promise<void>

Initialize the SDK with configuration.
await Zixflow.initialize({
  apiKey: 'YOUR_API_KEY',
});

Zixflow.identify(params: IdentifyParams): Promise<void>

Identify a user. Provide userId, traits, or both.
await Zixflow.identify({
  userId: 'user-123',
  traits: { email: 'user@example.com' },
});

Zixflow.clearIdentify(): Promise<void>

Clear the current user’s identity.
await Zixflow.clearIdentify();

Zixflow.track(name: string, properties?: Record<string, any>): Promise<void>

Track a custom event.
await Zixflow.track('button_clicked', { button_name: 'signup' });

Zixflow.screen(title: string, properties?: Record<string, any>): Promise<void>

Track a screen view.
await Zixflow.screen('HomeScreen');

Zixflow.setProfileAttributes(attributes: Record<string, any>): Promise<void>

Set attributes on the user profile.
await Zixflow.setProfileAttributes({ plan: 'premium' });

Zixflow.setDeviceAttributes(attributes: Record<string, any>): Promise<void>

Set attributes on the current device.
await Zixflow.setDeviceAttributes({ app_version: '2.0.0' });

Zixflow.registerDeviceToken(token: string): Promise<void>

Register a device token for push notifications.
await Zixflow.registerDeviceToken(token);

Zixflow.deleteDeviceToken(): Promise<void>

Remove the current device token.
await Zixflow.deleteDeviceToken();

Zixflow.trackMetric(params): Promise<void>

Track push delivery metrics.
import { MetricEvent } from 'zixflow-reactnative';

await Zixflow.trackMetric({
  deliveryID: '626533406292836846',
  deviceToken: token,
  event: MetricEvent.Delivered, // or MetricEvent.Opened / MetricEvent.Converted
});

Push Messaging

Zixflow.pushMessaging.showPromptForPushNotifications(options?): Promise<ZixflowPushPermissionStatus>

Request push notification permission.
const status = await Zixflow.pushMessaging.showPromptForPushNotifications({
  ios: { sound: true, badge: true },
});

Zixflow.pushMessaging.getPushPermissionStatus(): Promise<ZixflowPushPermissionStatus>

const status = await Zixflow.pushMessaging.getPushPermissionStatus();

Zixflow.pushMessaging.getRegisteredDeviceToken(): Promise<string>

const token = await Zixflow.pushMessaging.getRegisteredDeviceToken();

Zixflow.pushMessaging.onMessageReceived(message, handleNotificationTrigger?): Promise<boolean>

Process an FCM data message on Android (displays and/or tracks). On iOS this resolves to true without additional work.
await Zixflow.pushMessaging.onMessageReceived(remoteMessage, true);

Zixflow.pushMessaging.onBackgroundMessageReceived(message): Promise<boolean>

Background helper around onMessageReceived (Android).
await Zixflow.pushMessaging.onBackgroundMessageReceived(remoteMessage);

Zixflow.pushMessaging.trackNotificationReceived(payload): void

Track that a push was received (iOS-focused; no-op on Android).

Zixflow.pushMessaging.trackNotificationResponseReceived(payload): void

Track that a user opened a push (iOS-focused; no-op on Android).

In-App Messaging

Zixflow.inAppMessaging.registerEventsListener(callback): EventSubscription

const listener = Zixflow.inAppMessaging.registerEventsListener((event) => {
  console.log('In-app event:', event);
});
listener.remove();

Zixflow.inAppMessaging.dismissMessage(): void

Zixflow.inAppMessaging.dismissMessage();

Zixflow.inAppMessaging.inbox(): NotificationInbox

Returns the notification inbox helper. See In-App Messaging for usage.
MethodDescription
getMessages(topic?)Fetch inbox messages
subscribeToMessages(listener, topic?)Listen for inbox changes
markMessageOpened(message)Mark as read
markMessageUnopened(message)Mark as unread
markMessageDeleted(message)Delete message
trackMessageClicked(message, actionName?)Track a click

InlineInAppMessageView

React component for inline in-app placements. Requires elementId.
import { InlineInAppMessageView } from 'zixflow-reactnative';

<InlineInAppMessageView
  elementId="my-message"
  style={{ width: '100%' }}
  onActionClick={(message, actionValue, actionName) => {
    console.log({ message, actionValue, actionName });
  }}
/>

Location

Zixflow.location.setLastKnownLocation(latitude: number, longitude: number): void

Zixflow.location.setLastKnownLocation(37.7749, -122.4194);

Zixflow.location.requestLocationUpdate(): void

Zixflow.location.requestLocationUpdate();

Types

ZixflowConfig

type ZixflowConfig = {
  apiKey: string;
  logLevel?: ZixflowLogLevel;
  apiHost?: string;
  cdnHost?: string;
  flushAt?: number;
  flushInterval?: number;
  screenViewUse?: ScreenView;
  trackApplicationLifecycleEvents?: boolean;
  autoTrackDeviceAttributes?: boolean;
  inApp?: {};
  push?: {
    android?: {
      pushClickBehavior?: PushClickBehaviorAndroid;
    };
  };
  location?: {
    trackingMode?: ZixflowLocationTrackingMode;
  };
};

ZixflowLogLevel

enum ZixflowLogLevel {
  None = 'none',
  Error = 'error',
  Info = 'info',
  Debug = 'debug',
}

ScreenView

enum ScreenView {
  All = 'all',
  InApp = 'inApp',
}

ZixflowLocationTrackingMode

enum ZixflowLocationTrackingMode {
  Off = 'OFF',
  Manual = 'MANUAL',
  OnAppStart = 'ON_APP_START',
}

MetricEvent

enum MetricEvent {
  Delivered = 'delivered',
  Opened = 'opened',
  Converted = 'converted',
}

PushClickBehaviorAndroid

enum PushClickBehaviorAndroid {
  ResetTaskStack = 'RESET_TASK_STACK',
  ActivityPreventRestart = 'ACTIVITY_PREVENT_RESTART',
  ActivityNoFlags = 'ACTIVITY_NO_FLAGS',
}

ZixflowPushPermissionStatus

enum ZixflowPushPermissionStatus {
  Granted = 'GRANTED',
  Denied = 'DENIED',
  NotDetermined = 'NOTDETERMINED',
}

InAppMessageEventType

enum InAppMessageEventType {
  messageShown = 'messageShown',
  messageDismissed = 'messageDismissed',
  messageActionTaken = 'messageActionTaken',
  errorWithMessage = 'errorWithMessage',
}

InAppMessageEvent

interface InAppMessageEvent {
  eventType: InAppMessageEventType;
  messageId: string;
  deliveryId?: string;
  actionName?: string;
  actionValue?: string;
}