Pause In-App Messages
You can pause/unpause in-app messages at any time.
import Reteno from 'expo-reteno-sdk';
await Reteno.pauseInAppMessages(true); // pause
await Reteno.pauseInAppMessages(false); // resumeTo control what happens with messages while paused:
Reteno.setInAppMessagesPauseBehaviour('skip');
// or
Reteno.setInAppMessagesPauseBehaviour('postpone');Pause Push-Triggered In-App Messages (Android only)
Starting from Android SDK 2.9.0, push-triggered in-app messages can be paused independently:
import { Platform } from 'react-native';
import Reteno from 'expo-reteno-sdk';
if (Platform.OS === 'android') {
await Reteno.pausePushInAppMessages(true); // pause
await Reteno.pausePushInAppMessages(false); // resume
}To control what happens with push-triggered messages while paused:
import { Platform } from 'react-native';
import Reteno from 'expo-reteno-sdk';
if (Platform.OS === 'android') {
await Reteno.setPushInAppMessagesPauseBehaviour('skip');
// or
await Reteno.setPushInAppMessagesPauseBehaviour('postpone');
}In-App Message Lifecycle Events
Subscribe to in-app lifecycle events.
Available handlers:
beforeInAppDisplayHandleronInAppDisplayHandlerbeforeInAppCloseHandlerafterInAppCloseHandleronInAppErrorHandler
import { useEffect } from 'react';
import { Platform } from 'react-native';
import Reteno from 'expo-reteno-sdk';
useEffect(() => {
Reteno.setInAppLifecycleCallback();
const before = Reteno.beforeInAppDisplayHandler((data) => console.log('before', data));
const onShow = Reteno.onInAppDisplayHandler((data) => console.log('show', data));
const beforeClose = Reteno.beforeInAppCloseHandler((data) => console.log('beforeClose', data));
const afterClose = Reteno.afterInAppCloseHandler((data) => console.log('afterClose', data));
const onError = Reteno.onInAppErrorHandler((data) => console.log('error', data));
return () => {
before.remove();
onShow.remove();
beforeClose.remove();
afterClose.remove();
onError.remove();
if (Platform.OS === 'android') {
Reteno.removeInAppLifecycleCallback();
}
};
}, []);Close event data
beforeInAppCloseHandler and afterInAppCloseHandler receive an InAppCloseData object:
type InAppCloseData = {
id?: string;
source?: 'DISPLAY_RULES' | 'PUSH_NOTIFICATION';
closeAction?: 'OPEN_URL' | 'BUTTON' | 'CLOSE_BUTTON' | 'UNKNOWN';
isCloseButtonClicked?: boolean;
isButtonClicked?: boolean;
isOpenUrlClicked?: boolean;
};Error event data
onInAppErrorHandler receives an object with an errorMessage field:
type InAppErrorData = {
id?: string;
source?: 'DISPLAY_RULES' | 'PUSH_NOTIFICATION';
errorMessage?: string;
};Handling Link and In-App Custom Data
Link source identification is available since
expo-reteno-sdkv2.5.0.
Subscribe at app startup to receive link URLs and custom data from In-App messages and, on iOS, from push notifications:
import { useEffect } from 'react';
import Reteno from 'expo-reteno-sdk';
useEffect(() => {
Reteno.setInAppLifecycleCallback();
const listener = Reteno.onInAppMessageCustomDataHandler((data) => {
if (data.source === 'pushNotification') {
console.log('Push link received', data.url, data.customData);
} else if (data.source === 'inAppMessage') {
console.log('In-App link received', data.url, data.customData);
}
});
return () => listener.remove();
}, []);The event has the following shape:
type InAppCustomData = {
customData?: Record<string, any>;
source?: 'inAppMessage' | 'pushNotification';
url?: string;
inapp_id?: string;
inapp_source?: 'DISPLAY_RULES' | 'PUSH_NOTIFICATION';
};source identifies where the link interaction itself originated. The Android-only inapp_source has different semantics: it identifies the rule that displayed the In-App message. Keep push cold-start handling through getInitialNotification() separate and deduplicate navigation if the same interaction is observed in both flows.
pushNotification is emitted on iOS only. On Android, push links are opened by the native Reteno SDK and are not delivered to this handler, so source is always inAppMessage there. Use setOnRetenoPushClickedListener for push clicks on Android.
On Android, one In-App custom-data interaction produces one callback. If the
native event arrives before the first JavaScript handler is registered, it is
queued and delivered when onInAppMessageCustomDataHandler starts listening.
Android testing note: this callback is emitted only when the In-App link
action contains at least one custom-data field. A URL-only action is opened
directly and does not emitreteno-in-app-custom-data-received. To verify
sourceandinapp_source, configure test custom data such as
link_source_test=trueon the link action.
