InApp NATIV
In-App Messaging are custom views which you can send to a segment of users to show custom messages or give new offers or take to some specific pages. They can be created from your MoEngage account.

Call the showInApp()
wherever InApp has to be shown in the app as shown below :
const ReactMoE = require('react-native-moengage')
ReactMoE.showInApp()
When using in-apps on Android you need to additionally opt-out of the default lifecycle in-apps while initialising the SDK. Refer to the documentation for more details.
inApp Callbacks
Note:
Make sure you are calling
initialize()
method of the plugin to receive these callbacks. Refer doc for more info.
We provide callbacks whenever an InApp campaign is shown or clicked you can register for the same as shown below.
import ReactMoE from 'react-native-moengage'
ReactMoE.setEventListener("inAppCampaignShown", (payload) => {
console.log("InApp Shown: ", payload);
});
ReactMoE.setEventListener("inAppCampaignClicked", (payload) => {
console.log("InApp clicked: ", payload);
});
Event Type | Event Name |
---|---|
InApp Shown | inAppCampaignShown |
InApp Clicked | inAppCampaignClicked |
Payload Structure
{
"platform": "ios/android",
"payload": {
"screenName" : "Screen Name",
"deepLinkUrl" : "deeplink URL", // Only in Android
"kvPairs" : {
// Custom Key-Value pairs
}
}
}
iOS Deprecated Events(SDK Version 1.2.0 - 4.1.0):
Make sure to use the new Events mentioned in the above section as inAppShown
and inAppClicked
is deprecated from Plugin version 5.0.0. This is to have a common callback for both iOS and Android platforms. To set listeners to these deprecated events refer below:
ReactMoE.setEventListener(
'inAppShown',
(inAppInfo) => console.log(inAppInfo)
);
ReactMoE.setEventListener(
'inAppClicked',
(inAppInfo) => console.log(inAppInfo)
);
Updated over 5 years ago