Push Notifications to APNs

Good day folks. First time on here. If anyone has advice for the following:

I am building an IOS App to receive alerts from a remote Particle device (any flavor). I have been able to subscribe and list devices and capture events on the app on my phone. This only works when the app is in the foreground and not suspended. I have searched high and low for information on how to send remote notifications to the IOS device and found most, if not all, tutorials and instructions on how to do remote notifications. Can Particle Cloud send directly to Apple’s APNs service via a webhook or integration? Or do you have to use a third party service? I am not looking to use Blynk, IFTTT, PushBullet, etc. I would like the ability to connect direct to my own custom app. I feel I am missing something simple with my limited knowledge set. Or will i need to build my own notification server that captures the output of the Particle Cloud that manages the notifications to APNs? Any feedback would be greatly appreciated.

You can’t use Apple Push Notification Service from a webhook because it’s requires a client certificate, and webhooks don’t support them. What I do is monitor the server sent events (SSE) event stream and make the APNS connection from my own server. It happens to be Java (Apache Tomcat), though there’s support for SSE and APNs in many environments. Node.js would be the most obvious choice, but there are many options.

The nice thing about the SSE data stream is that you can run it from a home network (even using NAT, with no firewall changes) because it opens an outbound connection to the cloud and keeps it open to receive events in real time. You can also deploy it to Google Cloud, AWS, etc. if you prefer.

Thank you for the information. I was starting to suspect that it was not possible. Now off to do research on building my own server and figuring out how to program the interface. I would suspect that I could do this with Python. Would you have any tutorial reference links to get started, per chance?

Again thank you and appreciate the quick response.

I don’t have a Python reference, but it should be possible.

SSE is not specific to Particle so any Python SSE sample code should work fine.

I’m a mobile dev so I won’t be much help with python references, but to make things easier, take a look into 3rd party push notification services such as pushwoosh or onesignal. This will limit your server functionality to subscribing to webhook and calling 3rd party provider API when you want to send a notification.