Push Notifications from 3rd party Alert api to individual device - ios

I am creating an app that will get push notifications based on changes in flight status from the flightstats api. A flight rule is created using a json request and then a deliver to which is the url of an https/http service that accepts post data is included in this request. The part I am struggling with is how to get the alert delivered to the device that requested it. Will any 3rd party services such as UrbanAirship work for this? If not how can I implement this? Thanks for the help I am trying to wrap my head around this concept and how to implement it.

Related

How can I go about setting up push notifications using firebase cloud messaging and cloud functions?

I'm been coding for a year now and know swift really well and the basics to javascript. I've built a social media like app and its completely done besides the push notification functionality... which i've been struggling with for quite a while now.
I'm having trouble figuring out how to implement these in order to send notifications like when a user follows another user or they receive a new messege.
I don't understand how to integrate the cloud functions that I would write using and node.js with my xcode project.
When I look for documentation online its usually just how to send push notifications using the firebase notifications console which is cool but doesn't trigger based off specific user actions or events (ex: when the user gets a new follower)
I think since im struggling with grasping the concept of how to implement it, the actual technical set up of it makes even less sense. Any advice or resources would be greatly appreciated.
Thank you
Conceptually, what you have to do is set up server-side processing of your database to manage when events occur. This is what the Node.js code will be. Everything is connected through the database-- your Xcode and Node.js code work independently, but both communicate with Firebase. You can create a Cloud Function that will automatically run when it detects changes in your database, and this will automatically send push notifications.
I've done a similar project-- I set up a listener for my Realtime Database in my Cloud Function. Every time the user got a new follower, i.e. their followers tree was updated, I sent a notification to the device using an FCM token (which I also stored in the database).
exports.onTimeEnd = functions.database.ref("users/{user}/followers")
.onUpdate((snapshot, context) => {
// your code here
}
In that block, you can call a .once() to find out the user's token to send them a notification with.
https://firebase.google.com/docs/functions/get-started
This link here told me everything I had to do in regards to set up in the terminal. Super helpful.

How to go about IOS Push Notifications?

Im currently developing an app in Swift. I'm at the last stage of the app where I just need to integrate push notifications to the lock screen when certain user actions occur.
I'm going for something like how Instagram sends a push notification when a new user follows you or likes your post.
My entire backend is using firebase, and i've looked into firebase cloud messaging and I dont know if it has the capability to perform notifications like this.
I've watched tutorials and read documentation and I know you can push notifications to users from the console but I'm looking for notifications to be published and pushed based off specific user actions.
I know this is a very broad questions so what I want to know is:
A) Are notifications like instagram possible through Firebase cloud messeging?
B) If not, can you point me in the direction of how to figure this out?
Thank you!
A) Are notifications like instagram possible through Firebase cloud messaging?
Yes
Firebase send the push to APNS first then APNS send push notification to iOS devices.
If user 'A' do any action then that specific action will be transferred/send to staging/production server via apis. Based on your business logic staging/production server will send push notification to users(FCM token).
I hope this is helpful or you can explain the exact issue your are facing.

iOS push notifications with Firebase FCM to a specific user

I am trying to send notifications to users when something happens in their account, for example a new friend request or follower, or a tag in an image. I have been looking into Firebase FCM to make this happen but can't figure out how to send push notifications to just 1 user, based on some activity in their account.
Is there any way this can be done in FCM or are there are any other methods out there to make this happen? I'm new to iOS dev and push notifications, so any help will be greatly appreciated!
Thanks!
PS: If I do need to make my own server for this, could someone point me to any resources to do this in python? I've seen quite a few posts for APNs servers in PHP, but I don't know PHP that well.
The easiest way is to use Firebase Cloud Functions , I have experience working with it using Javascript then trigger the function when something changes in database. You can also send a http request with the specific device token which you want a push notification to be delivered to, then the function will do it's magic for you. Firebase have ready to use samples from their Github repo.
NB: - For your case if you really want to use Python then check this answer it might help you get started.

Consuming external json with parse.com

I'm working on an iOS application developed with Swift. The application is going to need notifications to receive alerts when certain events occur.
To handle push notifications I'm using parse.com. I was able to create an account and integrate push notifications into my application, as it's explained in the Parse.com guide, and are working fine when I send something from the Push section.
What I'm trying to do, and I cannot figure it out, is consume a 3rd party JSON, process that JSON to check some status and report, to the users that are using the application, a status change via a push notification. I know I should process all this in the backend/server side and then push the result or what I'm trying to notify, but I don't know what to do.
Ex. of What I'm trying to archive:
3rd party website ---(json)---> parse.com ---(push notification)--->
My App
I'm aware the tools that Parse.com provides, such as REST API, Cloud Code, Webhooks and Jobs, but I'm totally lost here! I cannot find any guide or documentation that allows me to do what I previously described. I don't even know if its possible, and the documentation at parse.com it's not necesarily up to date.
I hope anyone can help me, or guide me, if parse.com it's not enought for my purpouse.
Thanks for reading.
I would suggest looking into Cloud Code or a Job from Parse and seeing if you can get one to run on a time interval to look for updated JSON.
You can decode JSON using JS, which is exactly what Parse Cloud Code is, you actually write it out on your own computer and then upload it. I've only use the afterSave functions. I would think you probably have to keep some type of object in parse to see what is updated and notify who ever needs to notified when that data is updated.
Also, you'll probably want to pass something to the app to actually update when the user selects the push alert. You can do this in the push alert itself. It converts to a dictionary in the app delegate's method for handling received notifications or launching with one.
Alternatively, if the web server is under your control, you can create a PHP script that will trigger the push to parse.
My best shot at this (after not having used Parse for a long while) would be to set up a Job on Parse that queries the 3rd-party service, and takes that response and throws it into a Cloud Code function, which in turn parses out that JSON and sends off a notification.
Parse's reference materials would probably be a good starting point.
The toughest part for you is the up-to-date-ness of your data. Since you're still polling that 3rd-party service at a regular interval, it's going to be a trade-off between freshness of updates and frequency of jobs (which cost money at a certain scale).

Web App Interfacing with iOS app for push notifications

I have a basic web app that is able to send push notifications (via UrbanAirship) to my iOS app.
My questions is, how can my webapp know that I have a new iOS app user? So I can then put the push DeviceID into a database (along with other data as required).
i.e. what is the interface for getting data into the Webapp, is it new code in the iOS app, or is there some other interface from UA?
Thanks..
I'm not an iOS developer, so it's hard for me to be too specific, but I'm assuming you need to store a device ID and (possibly) a token so that you can send messages to that device. I'm assuming (also) that you have access to this information on the device.
The correct way to do this would be to create datastore table of devices and the information associated with them (tokens, various IDs, I also like to have the last time I sent them a message, etc.) Then you send a request (should be a POST request, semantically) to your app when the user registers their device. Send the information you need in the POST request, then store it in your datastore through a handler.
Hope that helps? That's how things are done with Android Cloud to Device messages, and from my quick perusal of Urban Airship, that's how their service works, too.

Resources