It is now possible to return the list of inbox messages on mobile.
iOS
On iOS you would use the following function to get a list of inbox messages.
It takes three parameters, the offset, the limit (number of messages to return), and a callback function (where you want to custom handle the inbox feed).
The callback function will receive a list of XPInboxItems. The data in the XPInboxItem class is as follows
@property (nonatomic, readonly) NSInteger identifier;
@property (nonatomic, readonly) BOOL isOpened;
@property (nonatomic, readonly) BOOL isClicked;
@property (nonatomic, readonly) NSNumber* createTimestamp;
@property (nonatomic, readonly, nullable) NSNumber* expirationTimestamp;
@property (nonatomic, readonly) XPInboxItemStyle* style;
@property (nonatomic, readonly) BOOL isCard;
@property (nonatomic) XPMessageResponse* response;
where:
identifier | the id of the message | NSInteger |
isOpened | represents whether the message has been seen or not | Bool |
isClicked | represents whether the message has been clicked or not | Bool |
createTimeStamp | indicates when the message was created (in Unix Epoch Time) | NSNumber |
expirationTimeStamp | indicates when/if the message is set to expire (in Unix Epoch Time) | NSNumber |
style | represents some of the style metadata for the message (contains two keys, background and title background) | XPInboxItemStyle |
isCard | represents whether the inbox message is of type card/alert | Bool |
XPMessageResponse | is the object which contains the message content along with action for this message (URL, deeplink, inAppMessage...) | XPMessageResponse |
An XPMessageResponse Object contains the following fields:
NSString
message.identifier | the id of the message | NSString |
message.campaignIdentifer | the id of the XP campaign that the message is from | NSString |
message.title | the title of the message | NSString |
message.alert | the main text body of the message | NSString |
message.icon | the image associated with a message. (smaller icon for alert type inbox message, larger image for card type inbox message) | NSString |
action | Action associated with URL, deeplink or InApp message | XPAction |
Additional Handling:
You can programatically proceed with the message click action (e.g. open URL) when user clicks a button:
[XPush clickMessage:response.message actionIdentifier:nil]];
You can also track the message as clicked without running any actions (e.g. open URL):
[XPush reportMessageClick:response.message actionIdentifier:nil]];
Inbox Badge Callback:
When custom handling your inbox feed, the inbox badge can be very useful. The badge lets you know how many unread messages are in the inbox. Using the following callback, you can handle the situation when the badge is updated.
Comments
0 comments
Article is closed for comments.