Skip to content

In-app Content

Content Manager

In your PCL app you must implement the IContentManager interface, and set this object as the handler for the NearIT content with the method:

NearPCL.SetContentManager(myContentManager);

For every content manager interface method, you will recieve a different type of NearIT content.

Content objects

These are the types of NearIT content and their attributes:

  • XCSimpleNotification instance representing the simple notification:
    • NotificationMessage returns the notification message
  • XCContentNotification instance representing the rich content:
    • Title returns the notification title
    • Content returns the text content, without processing the html
    • ImageLink returns the link of the image object
    • Cta returns a ContentLink with a label and url fields
  • XCFeedbackNotification instance representing the feedback request:
    • Question returns the feedback request string

When your users answer the feedback request, you can send us the answer with this method:

// rating must be an integer between 0 and 5, and you can set a comment string.
NearPCL.SendEvent(new XCFeedbackEvent(originalFeedback, "Awesome!", 4));
  • XCCouponNotification instance representig the coupon:
    • Description returns the description
    • Value returns the value string
    • ExpiresAt returns the expiring date
    • RedeemableFrom returns the redeemable date, it's a start date of when you can reedem the coupon
    • IconSet returns an Image object containing the source links for the icon
    • Serial returns the serial code of the coupon
    • ClaimedAt returns the date the coupon was claimed
    • RedeemedAt returns the date the coupon was redeemed
  • XCCustomJSONNotification instance representing a custom object:
    • Content returns the json content

Notification History

If you want to fetch the user notification history you can use this method:

NearPCL.GetNotificationHistory((notificationHistory) => {
    // do something with the list
}, (error) => {
    // handle the error
});

You will receive a list of XCHistoryItem with the following attributes:

  • reaction: the actual NearIT content. It can be one of the types listed above.
  • read: a bool indicating whether the notification was read.
  • timestamp: an epoch timestamp of the notification.
  • trackingInfo: an object you can use for tracking interactions with the content/notification.

If you let your users interact with one item of the list and letting them view the content details, remember to track user interaction with this method:

NearPCL.SendEvent(trackingInfo, Recipe.OPENED);

Fetch current user coupon

We handle the complete emission and redemption coupon cycle in our platform, and we deliver a coupon content only when a coupon is emitted (you will not be notified of recipes when a profile has already received the coupon, even if the coupon is still valid). You can ask the library to fetch the list of all the user current coupons with the method:

NearPCL.GetCoupons((couponlist) => { 
    // do something with the list
}, (error) => {
    // handle the error
});