Inbox object
π¦ Inbox
βββ notifications : ArrayList<InboxNotification>?
βββ lastAccess : String?
βββ count : Int
βββ pageSize : Int
βββ page : Int
βββ totalPages : Double
βββ isRequestingPage : Boolean
π¦ InboxNotification
βββ id : String
βββ sentAt : String?
βββ status : String?
βββ sendingId : Int
βββ campaignId : Int
βββ message : InboxPush?
βββ category : InboxCategory?
βββ read : Boolean
π¦ InboxPush
βββ action : InboxPushAction?
βββ buttons : ArrayList<InboxPushButton>?
βββ id : Int
βββ appKey : String?
βββ title : String?
βββ body : String?
βββ icon : String?
βββ image : String?
βββ gif : ArrayList<String>?
βββ layout : Layout?
βββ data : String?
βββ silent : Boolean
βββ securedData : String?
βββ isDisposable : Boolean
βββ sendingId : String?
βββ campaignId : String?
βββ pushId : Int
βββ journeyStateId : Int
βββ journeyExecution : Int
βββ cjCurrentStateId : Int
βββ sendEventAck : Boolean
βββ applicationId : Int?
The notifications of the Inbox will have the following states of the class InboxStatus:
- Sent : The notification has been sent to the client, whether or not they could read it.
- Click: have clicked on the notification displayed in the Inbox.
- Delete : The Inbox notification has been deleted by the customer.
The notifications will also come with a 'read' status, to help differentiate those status.
Each notification will be assigned with an integer and unique sendingId, to be able to differentiate them and use them for some of the functionalities.
In the particular case of Android, when a new push from Indigitall arrives at the client device, an action defined in an intent is generated, which can be used to notify the user that they have a new message in the Inbox. To collect it, it must be implemented in the following way:
@Override
protected void onResume() {
super.onResume();
if (getIntent() != null && getIntent().getExtras() != null){
Bundle extras = getIntent().getExtras();
if( extras != null && extras.containsKey(Push.EXTRA_PUSH)) {
//DO SOMETHING
}
}
}override fun onResume() {
super.onResume()
intent?.extras?.takeIf { it.containsKey(Push.EXTRA_PUSH) }?.let { extras ->
// Handle the push that opened the Activity
}
}As explained above, to obtain the notifications the following method is used:
Inbox.Companion.getInbox(context, new InboxCallback(context) {
@Override
public void onSuccess(Inbox inbox) {
//DO SOMETHING
}
@Override
public void onError(int errorId, String errorMessage, String descriptionMessage) {
// Handle the error
}
});Inbox.getInbox(context, object : InboxCallback(context) {
override fun onSuccess(inbox: Inbox) {
// Display the notifications
}
override fun onError(errorId: Int, errorMessage: String?, descriptionMessage: String?) {
// Handle the error
}
})Inbox next page
Once the Inbox instance is obtained, use the following method to request the next page. If there are no more pages, the callback reports INBOX_GET_PAGE_ERROR (error ID 3011):
inbox.getNextPage(context, new InboxNextPageCallback(context) {
@Override
public void onSuccess(Inbox inbox, ArrayList<InboxNotification> newNotifications) {
//DO SOMETHING
}
@Override
public void onError(Integer errorId, String errorMessage, String descriptionMessage) {
// Handle the error or the end of the page list
}
});inbox.getNextPage(context, object : InboxNextPageCallback(context) {
override fun onSuccess(inbox: Inbox, newNotifications: ArrayList<InboxNotification>?) {
// Append the new notifications to the list
}
override fun onError(errorId: Int?, errorMessage: String?, descriptionMessage: String?) {
// Handle the error or the end of the page list
}
})Take into account that the Inbox callback, apart from returning the updated Inbox, returns an array called newNotifications, in which the new notifications to be added to the Inbox will be displayed, so that, if necessary, be able to use said array to move between the pages without depending on the Inbox calls.
Inbox info errors
List of all possible Inbox errors and callback messages:
INBOX_GET_ERROR = 3001 -> "get Inbox error"
INBOX_EXTERNAL_ID_NO_REGISTERED = 3003 -> "External Id not registered"
INBOX_IS_REQUESTING_PAGE = 3006 -> "Wait. Is Requesting new page"
INBOX_GET_PAGE_ERROR = 3011 -> "There are no more messages on Inbox"
INBOX_GENERAL_ERROR = 3600 -> "inbox general error"
INBOX_BAD_REQUEST = 3604 -> "AppKey or deviceId null or empty"
