Initialization

Inbox Model

In this section you will find a series of more advanced functionalities that require a more complex development. We recommend that a developer be in charge of this configuration.

Below we indicate the models of the objects that are used:

Inbox = {
    lastAccess: "string",
    count: "int",
    pageSize: "int",
    numPage: "int",
    notifications: [InboxNotifications],
    newNotifications: [InboxNotifications]
}

InboxNotifications = {
    id: "string",
    sentAt: "string",
    status: "String",
    sendingId: "int",
    campaignId: "string",
    message: Push
}

InboxCounter = {
    click: "int",
    sent: "int",
    deleted: "int",
    unread:{
        lastAccess: "string",
        count: "int"
    }

}
  • the Push object is indicated in section [7. Collection of the push data] (# 7-collection-of-the-data-of-the-push).

Once the device has been successfully registered, you can start making Inbox requests. The following characteristics of the Inbox must be taken into account, which are optionally configurable.

Properties
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.

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.

Get notifications

As explained above, to obtain the notifications the following method is used:

window.plugins.indigitall.inbox.getInbox(inbox=>{
    //DO SOMETHING
},(error)=>{
    //LOG ERROR
});

Next Page

Once the Inbox object has been obtained, we can request the following page, which is made with the following method:

window.plugins.indigitall.inbox.getNextPage(inbox=>{
         //DO SOMETHING
    },(error)=>{
         //LOG ERROR
         if (error.code == 410){
            //LOG NO MORE PAGES
        }else{
            //LOG ERROR
        }
    });

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.