Skip to main content

Installation

Install MoEngage’s Inbox Plugin to your application, using the npm package manager. And then link your native dependencies.
Note: This plugin is dependent on react-native-moengage plugin. Make sure you have installed the react-native-moengage plugin as well. Refer to the link for the same.

Android Installation

Configuration Required For Older React Version (Optional)

This step is required only if react-native auto-linking is not working.
In android/settings.gradle(.kts) add the following:
In android/app/build.gradle(.kts) add the following
Add the MoEngage React Package in the Application class’s getPackages() Path - android/app/src/main/java/package-name/MainApplication.java Note: Your Application class name might vary, go to your application class.
In case you are facing issues with the import add the below import statement in your java file.

iOS Installation

To run the application in the new react architecture, follow these steps:
  1. Navigate to the iOS folder.
  2. Run the command RCT_NEW_ARCH_ENABLED=1 bundle exec pod install to install the necessary dependencies.
To run the application in the old react architecture, follow these steps:
  1. Navigate to the iOS folder.
  2. Run the command pod install to install the necessary dependencies.
Make sure to configure AppGroup ID in App Target and Set up Notification Service Extension in your iOS Project, for the SDK to save the received notifications.

Inbox Initialization

To initialise Inbox, pass Workspace ID as parameter to  initialize(Workspace ID) method of MoEReactInbox as shown below

Fetch Messages

To fetch all the inbox messages use fetchAllMessages() method as shown below, where you would get an instance of MoEInboxData

InboxData Payload

MoEInboxData will be received in the below format:

Get Unclicked Message Count

To obtain the unclicked messages count from the Inbox use getUnClickedCount() method as shown below:

Track Message Clicks

To track clicks on the messages inside your Inbox use trackMessageClicked() method as shown below:

Delete Message

To delete a particular message from the list of messages use deleteMessage() method as shown below: