Push Notifications from a device with Particle Photon

I’m trying to build a device using the Particle Photon. My main query is how do I send a push notification to a mobile to inform the user that the device has recorded new data?

As further background, I’m a mechanical engineer who’s recently started learning electronics and so I would be grateful for all relevant tips and resources.

Thank you!

Would they need to be native push notifications, or would a third-party service be acceptable?

We have a few ways to send “push notifications”. You will want to first look into using Webhooks. Webhooks allow you to perform complex HTTP(s) queries without much code on your device. A Particle.publish("The basement is flooded!") can turn into an email or text message easily with Webhooks. See the community webhook examples for examples on sending text messages, slack messages, or emails.

The above are all good answers, but I wanted to mention that by using the IFTTT (If this then that) service, you can turn a published event into almost anything with minimal development on your part.

I like IFTTT in concept but I’ve had too many instances of it dropping/ignoring my messages for me to use it in any “mission critical” application. Also, with Webhooks you can subscribe to the response and resend the publish if it fails for some reason. @bko is however correct; IFTTT does require the least amount of work to send push events. My advice would be to use it while moving to a more robust solution

1 Like

Thank you for your replies, they were helpful. I am still a beginner in device programming so I am confused as to how I should include these methods i.e. Webhooks, IFTTT. Can you please further explain these concepts?

Can you explain the difference? Google search on these terms is giving me lots of code but no actual definition.

You can read about Webhooks here

You can read about IFTTT & Particle here

Are you planning on building an app of your own (something you’d download in an appstore for example) or are you okay with using other people’s apps to provide you with notifications (e.g. email, pushbullet, telegram, etc.)?

Putting a notification on a phone when something happens on the Photon module is extremely easy! IFTTT pretty much does everything for you. The only thing you need to do is add one line to your code when you want the notification to pop on your phone. You just publish an event from your code as explained in the docs here:
Then on IFTTT you just set it to listen for that and when that happens send a push notification to your phone. This simply requires an IFTTT account, connect it to Particle and to iOS or Android through the channels. Then install the IFTTT app on your phone. Then on IFTTT you create a recipe which listens for that Particle Event and does a notification to your phone.

If you are new to all of this and want to get it done this is the way to go!

I use a webhook with Pushover service for notifications. I too find it more reliable than IFTTT.

It has the added benefit of being a cross-platform notification service… sends notifications to my mobile, laptop or iPad.

That said, I also use IFTTT but mainly their DO Button.

Thank you for your explanation. For now, I am happy to use a third party service, but I am definitely looking to make my own app in the future. Is there a large difference between addressing these two?

Making an app of your own can be quite challenging if you haven’t got any experience with it. Depending on what platform you’re aiming at it can get rather costly too ($99/year for iOS) not to mention the fact that you need a Mac environment to program it.
A webapp is often a lot easier to design, cheaper, and more friendly to maintain since it’ll run on all platforms, thus only one code base, rather than different ones for different platforms. The downside is that you can get native notifications with a webapp, but then again, that’s where 3rd party services could still offer a solution.

Especially for private use I gave up trying to design an iOS app of my own since it was way too much of a hassle to toggle my lights. I spent days trying to get a hackintosh installed, only to realize I had to idea how to code for iOS. I then gave a webapp a shot and had that running within the hour…

Thank you, I will definitely keep that in mind. If I may, how did you design the webapp?