Initialization

Inbox model

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.

This section describes the different actions that could be performed with the indigitall Inbox. The Inbox and notification models would have this structure:

inbox = {
  lastAccess: "string",
  notifications: [Inboxnotification],
  count: int,
  pageSize: int,
  page: int,
  allNewNotifications: [Inboxnotification],
  totalPages: int
};

notification = {
  id: "string",
  externalId: "string",
  sentAt: {},
  status: "string",
  sendingId: int,
  campaignId: int,
  message: Push,
  read: Boolean
};

Inbox Properties
The Inbox notifications will have the following status of the inboxStatus class:

  • Sent or sent: the notification has been sent to the client, has been able to read it or not
  • Click: they have clicked on the notification shown in the Inbox.
  • Delete or erased: the Inbox notification has been deleted by the client.

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.

Get notifications

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

indigitall.getInbox({auth: getAuthConfig}, (inbox)=>{
    //DO SOMETHING
}, (error)=>{
    //LOG ERROR
});

Next Page

Once the Inbox instance is obtained, we will use it to request the next page, which is made with the following method, in the event that there are no more pages it will indicate it in the error with code 410:

inbox.getNextPage((inbox, newNotifications)=>{
    //DO SOMETHING
}, (error)=>{
    if (error == 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.