AppInbox Integration

The App inbox is feature within mobile applications provide you with a centralized location to access and manage the notifications that are listed. App inbox offers you a way to make your push notifications persistent that users can refer back at any point.

To enable this feature, reach out to your Account Manager. For more information, refer to App Inbox.

Integration Steps

To integrate AppInbox into your mobile application, follow these steps:

For Android SDK

Integrate AppInbox functionality into your Android application by following these steps:

  1. Define Latest SDK version: Add the version line to your gradle.properties.
// Version of smartech push SDK to use with Ionic
SMARTECH_APPINBOX_SDK_VERSION=<<appinbox_sdk_android_version>>
  1. Integrate the latest Netcore CE SDK by changing the app-level build.gradle.
api "com.netcore.android:smartech-appinbox:${SMARTECH_APPINBOX_SDK_VERSION}"

For Ionic SDK

Integrate AppInbox functionality into your Ionic application by following these steps:

  1. Complete the setup for Netcore CE and SmartPush SDK for Ionic.

Refer to Customer Engagement to complete the setup of SmartPush SDK for push notifications.

  1. Install the Netcore CE Ionic Smartech AppInbox plugin by running the below command from your project directory.
npm install smartech-appinbox-cordova --save
  1. Initialize the SDK to the Netcore CE Ionic library in your JavaScript file.
import SmartechAppInboxCordova from 'smartech-appinbox-cordova';
  1. App Inbox SDK offers two options to create and manage the UI for app inbox screen for the app.

Custom App Inbox UI Implementation

You can create a custom Inbox UI using our SDK method to fetch data and display it inside your app.

Get Inbox Messages

To fetch data of app inbox messages from our server, you can use the optional methods below.

  • messageLimit : Count of records of notification. Example: 10
  • categoryList : Fetching data based on the app inbox categories provided by the user.
  • messageType: It's an integer that has three values :all, latest, and earliest.
SmartechAppInboxCordova.getAppInboxMessagesByApiCall(messageLimit, messageType, categoryList, (result) => {
    console.log(JSON.stringify(array));
}, (error) => {
    console.log("error:" + error);
})

Fetching data from DB

You can use the below method to fetch the data from the database. This can be also used to show data in an offline state.

//INBOX_MESSAGE = 1, READ_MESSAGE = 2, UNREAD_MESSAGE =3

SmartechAppInboxCordova.getAppInboxMessages(messageType, (result) => {
                
});

Category-based data

Every AppInbox message belongs to a specific category. You can use this data to create a dropdown on the menu to display users' list of available categories.

The below method can be used to get a list of available categories.

SmartechAppInboxCordova.getAppInboxCategoryList((categoryList) => {
             
 };

The below method can filter the AppInbox messages list based on the category the user selects. It takes an array of category objects as a parameter.

  • categoryList : This is an optional method for fetching data based on the app inbox categories provided by the user.
 SmartechAppInboxCordova.getAppInboxMessagesWithCategory(categoryArray, (appInboxMessages: object[]) => {
  console.log(JSON.stringify(appInboxMessages));
 }, (error: Error) => {             
 });

AppInbox Message Count

To show the count of all read and unread messages, you can call the below method to get their respective count.
This method accepts type (number) as a parameter.

It could be of three types.

  • INBOX_MESSAGE: Get the count of all messages from the database.
  • READ_MESSAGE: Get a count of only read messages from the database.
  • UNREAD_MESSAGE: Get a count of only unread messages from the database.
// INBOX_MESSAGE = 1, READ_MESSAGE = 2, UNREAD_MESSAGE =3

SmartechAppInbox.getAppInboxMessageCount(SmartechAppInbox.INBOX_MESSAGE, (count) => {
                
});

AppInbox Message Events

When users interact with messages in the AppInbox, capturing these actions for analytics and tracking is essential. You must send Viewed, Clicked, and Dismissed events to SDK for every action performed on the AppInbox message. The following events should be handled:

Viewed Event:

Trigger this event once the AppInbox message is visible to the user. It should be sent only once for each AppInbox message. This method accepts the payload of the AppInbox message as a parameter.

 SmartechAppInboxCordova.markMessageAsViewed(objItem);

Clicked Event:

Trigger this event when a user clicks on an AppInbox message. Provide the deeplink and trid of the message as parameters.

SmartechAppInboxCordova.markMessageAsClicked(trid, deeplink) //deeplink and trid of the Appinboxmessage

Dismissed

You can use this method to mimic the feature of swipe to delete the messages from your Recyclerview. You need to manually remove the message from the recycler view and next time when you will fetch the data from the DB, this message will be not present. This method accepts payload of the AppInbox messages.

SmartechAppInboxCordova.markMessageAsDismissed(objAppInboxItem, (status) => {
   if (status) {
       // If true, Item is dismissed.

   }
});

CopyMessageAsClicked

Trigger this event when a user user clicks on the Copy action button of an AppInbox message. Provide the action button payload and trid of the message as parameters.

 SmartechAppInboxCordova.copyMessageAsClicked(itemObj, trid);

📘

Demo Project on Github

Click here, to check the demo project on Github.