Notification Feed API for Apps
Get a JSON of all your recently pushed campaigns to create a Notification Center! 🔔
This API allows you to get a list of recently published campaigns in a JSON format which can then be used to create a fully customizable Notification Center for your app. The design of the Notification Center including the UI/X would have to be thought through by you and your team. On a very high level, using this API would include the following steps:
- Make sure News Hub is configured and enabled: Ensure you enable News Hub from the panel before proceeding to the next steps. You can reach out to your Account Manager or send an email to [email protected] to get this option enabled for your apps.
- Creating and designing the Notification Widget and Feed Menu: Be creative in your approach and lure users in by designing an attractive and useful Notification Center. Customize it with your app theme and run hypotheses/experiments to maximize engagement.
- Populating the Feed Menu with data: We will talk about this step in detail in the below section.
Using the API
This API provides data in a succession of 15 notifications per call. You can call the API again to fetch the next 15 notifications and so on. It is recommended to do so whenever the users scroll scrolls down inside the Notification Center.
The API fetches the notifications sent in the past 45 days and returns the latest 75 notifications.
To fetch the initial feed data (15 notifications) a developer needs to call a method inside the app as given below:
String jsonData = iZooto.getNotificationFeed(isPagination);
// For first call, isPagination = false
// For subsequent calls, isPagination = true
// isPagination = true should be called when the user the scrolls down inside the News Hub.
// Do something with the JSON data
iZooto.getNotificationFeed(isPagination: value) {
(jsonString, error) in
if let error = error {
print("\(error.localizedDescription)")
}
else if let jsonString = jsonString {
print("Response = ",jsonString)
}
}
// For first call, isPagination = false
// For subsequent calls, isPagination = true
// isPagination = true should be called when the user the scrolls down inside the News Hub.
// Do something with the JSON data
iZooto getNotificationFeedWithIsPagination:NO completion:^(NSString * _Nullable notificationData, NSError * _Nullable error) {
if (error == nil) {
NSLog(@"Notification data: %@", notificationData);
} else {
NSLog(@"Error: %@", error.localizedDescription);
}
}];
// For first call, isPagination = false
// For subsequent calls, isPagination = true
// isPagination = true should be called when the user the scrolls down inside the News Hub.
// Do something with the JSON data
// Add the below method in the main.dart file
var jsonData = await iZooto.getNotificationFeed(isPagination);
// For first call, isPagination = false
// For subsequent calls, isPagination = true
// isPagination = true should be called when the user the scrolls down inside the News Hub.
// Do something with the JSON data
// Add the below method in App.js file
var jsonData = await iZooto.getNotificationFeed(isPagination);
// For first call, isPagination = false
// For subsequent calls, isPagination = true
// isPagination = true should be called when the user the scrolls down inside the News Hub.
// Do something with the JSON data
Note: This API should only be called after you've initialized the iZooto SDK for your app.
You will receive response data which will have information as explained in the next section.
For an ideal UX, use Lazy Loading and show up more notifications as the user scrolls down your Notification Center with
isPagination = true
in the above method.
Sample Request and Response Syntax
Sample Request
The sample code to call the API is shown above for the different app frameworks. The response will be contained in the variable jsonData
.
Sample response (Success)
[
{
"title":"नवाब मलिक को सुप्रीम कोर्ट से बड़ी राहत, 17 महीने बाद मिली जमानत सुप्रीम कोर्ट ने मनी लॉन्ड्रिंग मामले में नवाब मलिक को जमानत दे दी है. उन्हें मेडिकल आधार पर दो महीने के लिए जमानत पर छोड़ने का आदेश दिया गया है. ईडी ...",
"message":"सुप्रीम कोर्ट ने मनी लॉन्ड्रिंग मामले में नवाब मलिक को जमानत दे दी है. उन्हें मेडिकल आधार पर दो महीने के लिए जमानत पर छोड़ने का आदेश दिया गया है. ईडी ...",
"banner_image":"https:\/\/d3pc1xvrcw35tl.cloudfront.net\/sm\/images\/800x600\/defaultlogo-hindi_202010187470.jpg",
"landing_url":"http:\/\/news18.com?utm_source=izooto&utm_medium=push_notifications&utm_campaign=dfd",
"time_stamp":"1692276255789"
},
{
"title":"नवाब मलिक को सुप्रीम कोर्ट से बड़ी राहत, 17 महीने बाद मिली जमानत सुप्रीम कोर्ट ने मनी लॉन्ड्रिंग मामले में नवाब मलिक को जमानत दे दी है. उन्हें मेडिकल आधार पर दो महीने के लिए जमानत पर छोड़ने का आदेश दिया गया है. ईडी ...",
"message":"सुप्रीम कोर्ट ने मनी लॉन्ड्रिंग मामले में नवाब मलिक को जमानत दे दी है. उन्हें मेडिकल आधार पर दो महीने के लिए जमानत पर छोड़ने का आदेश दिया गया है. ईडी ...",
"banner_image":"https:\/\/d3pc1xvrcw35tl.cloudfront.net\/sm\/images\/800x600\/defaultlogo-hindi_202010187470.jpg",
"landing_url":"http:\/\/news18.com?utm_source=izooto&utm_medium=push_notifications&utm_campaign=dfd",
"time_stamp":"1692276255789"
},
{},
{},
{},
...
{} // Up to 15 results in the data object.
]
Data Object Parameters
Name | Description |
---|---|
Title | This is the Title used in the notification. |
Banner Image | The featured image is associated with the notification. |
Time Stamp | The time at which this notification was sent from your iZooto Account. |
Landing URL | The URL to which the user was taken when we clicked on the notification. |
Message | The description used inside the notification. |
Sample response (Failure): No Notifications
In this case, a developer tried calling the API and had already received all the notification data or there are no notifications that have been sent yet. As a result, the API informs that there are no notifications available.
{
"No more data"
}
Sample response (Failure): Any Other Issue
For any other issue, like the iZooto SDK is not initialised, News Hub is not enabled from the iZooto panel, etc., the API gives a response informing the same.
{
"iZooto is not initialised properly, Please verify again."
}
You're All Set 🚀
Get access to use this API. Reach out to us on [email protected] and we'd be happy to help.
Updated 2 months ago