IPH Technologies
Software & App Development company
Select Page

Push Notifications are an important feature, no matter what kind of app you’re building. Not only is it nice to let users know about something that may interest them, be it a new album being released, a sale or other limited-time-only deal, or that one of their friends sent them a message, but push notifications are proven to help boost user interaction and create a better overall user experience.

Whether you just want to be able to let users know when a relevant event happens, or you’re trying to optimize customer engagement and retention, Expo makes implementing push notifications almost too easy. All the hassle with native device information and communicating with APNs (Apple Push Notification service) or FCM (Firebase Cloud Messaging) is taken care of behind the scenes, so that you can treat iOS and Android notifications the same, saving you time on the front-end, and back-end!

Steps to achieve push notification :-

There are three main steps to setting up topic push notifications, and we provide a guide for each part of the process:

  • Setup: getting a user’s Expo Push Token
  • Sending: calling Expo’s Push API with the token when you want to send a notification
  • Receiving: responding to the notification in your app (maybe upon opening, you want to jump to a particular screen that the notification refers to)

First you have to visit:  https://app.nativenotify.com/dashboard

you will seen this type of  interface

Create a account for free

Then you will see : )

after that create an app by pressing the button CREATE AN APP

click the button START HERE showing in the navigation bar and follow these steps:

Step 1: Open your terminal and paste these commands
              npm install native-notify
              npx expo install expo-device expo-notifications
 
Step 2: In your App.js file, make sure this import is included at the top of the screen:
             import registerNNPushToken from ‘native-notify’;
 
Step 3: Make sure your App.js component is a Hook function. Here is an example:
             export default function App() {
              …
              }
  This link explains Hooks in detail: https://reactjs.org/docs/hooks-intro.html
 
Step 4: Inside of your App function, at the top of your App function, paste this code:
            registerNNPushToken(“your-app-id”, ‘your-app-token’);

           *Do NOT change the ‘appId’ or the ‘appToken’ value in this code. We put your appId and appToken in the code for you*

Step 5:
            npx expo start
 
After that click INDIE PUSH
 
Note: *Make sure you follow the ABOVE instructions BEFORE you set up Indie push notifications. Indie push notifications will not work without first following the ABOVE instructions*
 
API preview:
Here’s how our Indie push notification API works:
 
Registration: You have to send us a unique identifier for each app user you want to send an Indie push notification to.
Use: You can then use this unique identifier whenever you want to send an Indie push notification.
 
Usually, how people do this is by placing our Indie registration API in a login function. So, once one of your users logs into your app, you can send us that user’s unique identifier in the login function. Usually a unique identifier is the user’s email, phone number, or a unique user ID you have assigned to a user in your database.
 
Open your terminal and paste these commands and follow all the steps:
 
Step 1:
npm install axios
 
Step 2: In your login component, make sure these imports are included at the top of the screen:
          import { registerIndieID } from ‘native-notify’;import axios from ‘axios’;
 
Step 3: Make sure you are using a Hook function as your login component. Here is an example:
          export default function LoginScreen() {.
           …
          }
 
Step 4: In your login function, use this code to register your individual user:
            const yourLoginFunction = () => {
             …
             // Native Notify Indie Push Registration Code
                         registerIndieID(‘put your unique user ID here as a string’,  your-app-id,  ‘your-app-token’);
             // End of Native Notify Code
            }
*It’s very important that your user’s ID is UNIQUE. Make sure no other users share the same user ID.*
 
How to send an Indie push notification:
           At this point, you are ready to send Indie push notifications. Whenever you want to send an Indie push notification, simply send us your unique user ID (subID), your app ID, your app Token, a push notification title, and a push notification message.

 

 
      Here is the API:
          axios.post(`https://app.nativenotify.com/api/indie/notification`, {
          subID: ‘put your unique app user ID here as a string‘,
          appId: “your-app-id”,
          appToken: ‘your-app-token,
          title: ‘put your push notification title here as a string‘,
          message: ‘put your push notification message here as a string
          });
 
You can also send an optional pushData object with your post. Here’s an example:
          axios.post(`https://app.nativenotify.com/api/indie/notification`, {
          …,
          pushData: ‘{ “yourProperty”: “yourPropertyValue” }’
          });
 
Indie push notifications will be sent immediately to the individual app user associated with your subID.
 
All set
 
Now Click On Group Icon button is side bar Navigation:
 
Click on add new topic button you will see many api’s there then you will use there api to check user is subcribed your topic or not then only they will get notification which topic they subscribed.
 
 Get names of all Topic Groups:
 
           API GET URL:
           https://app.nativenotify.com/api/all/app/topic/group/names/your-app-id/your-app-token
 
Subscribe a User to a Topic Group:
 
          API POST URL:
           https://app.nativenotify.com/api/post/follower
 
         API POST Body:
          {
               “masterSubID”: “your Topic Group name”,
              “followerSubID”: “the Indie Sub ID you want to subscribe to this Topic Group”,
               “appId”: your-app-id,
               “appToken”: “your-app-token”
              }
 
Unsubscribe a User from a Topic Group:
 
          API PUT URL:
           https://app.nativenotify.com/api/unfollow/master
 
          API PUT Body:
          {
            “masterSubID”: “your Topic Group name”
            “followerSubID”: “the Indie Sub ID you want to unsubscribe from this Topic Group”,
             “appId”: your-app-id,
             “appToken”: “your-app-token”
          }
 
Show what Indie Sub Ids are subscribed to a Topic Group:
 
          API GET URL:
           https://app.nativenotify.com/api/topic/group/your-topic-group-name/5701/yxOjNO5AkmD8XiPHL2D0pP
 
 
Delete a Topic Group:
 
       API DELETE URL:
         https://app.nativenotify.com/api/follow/master/5701/yxOjNO5AkmD8XiPHL2D0pP/topic-group-name
 
Fetching all topics using api
 
 
 
All Topics- Topic group count is the count value of subscribe users
 
Sending a subscribed topic Notification
 
 
you will see:
And if user is not subcribed the topic then : )
 
 
You will not getting notifications : )