App Inbox Integration
App inbox is essentially a screen within an app where all your notifications will be listed. App inbox offers you a way to make your push notifications persistent that users can refer back at any point.
Read more about how app inbox feature works here. And reach out to your account manager to enable this feature.
For Android SDK Setup
Step 1: Define Latest SDK version
Add below line in gradle.properties
# Version of smartech appinbox SDK to use with React Native
SMARTECH_APPINBOX_SDK_VERSION=<<appinbox_sdk_android_version>>
Step 2: Integrate the latest Netcore CE SDK
Make the following changes in the app-level build.gradle
api "com.netcore.android:smartech-appinbox:${SMARTECH_APPINBOX_SDK_VERSION}"
api "com.netcore.android:smartech-appinbox:${SMARTECH_APPINBOX_SDK_VERSION}"
This guide will explain how to integrate app inbox.
Step 1: Complete the setup for Netcore CE and SmartPush SDK for Flutter
Go to Basic Setup to complete the basic setup of Netcore CE SDK.Go to Customer Engagement to complete the setup of SmartPush SDK, used for push notifications.
Step 2: Add Netcore CE-AppInbox SDK dependency
Implement plugin in pubspecs.yaml
file under dependencies:
By using pub
smartech_appinbox: ^3.2.7
Step 3: App Inbox UI Integration
Netcore CE App Inbox SDK offers two options to create and manage the UI for app inbox screen for the app.
- Custom UI that can you can create with SDK methods given below.
Custom App Inbox UI Implementation
You can also 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 method below:
It has 3 values (optional)
- messageLimit - Count of records of notification. E.g. 10
- categoryList - Fetching data based on the app inbox categories provided by the user.
- smtInboxDataType: It's a string that has 3 values all, latest, and earliest.
You will get following possible values of status key in response for each App Inbox messages:
"sent", "delivered", "viewed", "clicked", "dismissed"
You will get following possible values of ActionButton.callToAction key in response:
"copy", "deeplink", "dismiss", "reply", "snooze"
SmartechAppinbox().getAppInboxMessagesByApiCall(
messageLimit: messageLimit ?? 10,
smtInboxDataType: smtInboxDataType ?? "",
categoryList: categoryList.where((element) => element.selected).map((e) => e.name).toList()).then((value) {
// Here you will get list of app inbox messages
});
Fetching data from DB
You can use the below method to fetch the data from the database and it can be also used to show data in an offline state.
SmartechAppinbox().getAppInboxMessages().then((value) {
// Here you will get list of all appinbox messages from local db
});
Category based data
Every AppInbox Message belongs to a specific category and we can use this data to create a dropdown on the menu to display the list of available categories to users.
The below method can be used to get a list of available categories.
SmartechAppinbox().getAppInboxCategoryList().then((value) {
// Here you will get list of available categories for appinbox messages
});
The below method can be used to filter the AppInbox messages list based on the category selected by the user. It takes an ArrayList of strings as a parameter.
- categoryList - Fetching data based on the app inbox categories provided by the user. (optional)
List<MessageCategory> categoryList = [];
SmartechAppinbox().getAppInboxCategoryWiseMessageList(categoryList: categoryList?.where((element) => element.selected).map((e) => e.name).toList() ?? []).then((value) {
// Here you will get list of appinbox messages according to selected category list
});
AppInbox Message Count
To show the count of all, read and unread messages, we can call the below method to get their respective count.
This method accepts smtAppInboxMessageType as a parameter.
smtAppInboxMessageType is a string. It has 3 values. (optional)
inbox - Get count of both read and unread messages from DB. (default value)
read- Get count of only read messages from DB.
unread - Get count of only unread messages from DB.
SmartechAppinbox().getAppInboxMessageCount(smtAppInboxMessageType: smtAppInboxMessageType ?? "").then((value) {
// It will return count of messages in integer format
});
// Example: to get all inbox message count
String smtAppInboxMessageType = "inbox";
SmartechAppinbox().getAppInboxMessageCount(smtAppInboxMessageType: smtAppInboxMessageType ?? "").then((value) {
// It will return count of messages in integer format
});
// Example: to get all read message count
String smtAppInboxMessageType = "read";
SmartechAppinbox().getAppInboxMessageCount(smtAppInboxMessageType: smtAppInboxMessageType ?? "").then((value) {
// It will return count of messages in integer format
});
// Example: to get all unread message count
String smtAppInboxMessageType = "unread";
SmartechAppinbox().getAppInboxMessageCount(smtAppInboxMessageType: smtAppInboxMessageType ?? "").then((value) {
// It will return count of messages in integer format
});
Capturing App Inbox user events
You also need to send Viewed, Clicked and Dismissed events to SDK for every action performed on the AppInbox message by the user.
Viewed
Send this event once the AppInbox message is visible to the user and It should be sent only one time for each AppInbox message. This method accepts the payload of the AppInbox message as a parameter.
SmartechAppinbox().markMessageAsViewed(trid) //trid of the Appinboxmessage
Clicked
Onclick of AppInbox message, you need to send this event to SDK. This method takes 2 parameters that are deeplink and payload of AppInbox message.
SmartechAppinbox().markMessageAsClicked(deeplink, trid); //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.
SmartechAppinbox().markMessageAsDismissed(trid);//trid of the Appinboxmessage
Reference of demo project on GitHub
https://github.com/NetcoreSolutions/Smartech-Flutter-Modular
Updated about 1 month ago