Pushing events to devices


#1

I’ve been reading up on webhooks and I’ve used them on a moisture sensor project where I check the weather, but is there a way to send events to my devices (specifically Argon/Xenon) via an external webhook?

Example:
Press a button on a web app that calls a webhook that sends an event to all my devices that are subscribed to it?

Apologies if I’ve overlooked this in my searching.


#2

Welcome, you can call a function on the device

https://docs.particle.io/reference/device-cloud/api/#call-a-function

This has the advantage that you will get a (int) return code that you can customise to suit your needs.

Another method is to publish an event and have the device subscribe to it.

https://docs.particle.io/reference/device-cloud/api/#publish-an-event

The advantage of the first is that if the device is not online - you will get a timeout error, with the second, there is no indication of success or failure of the device recieveing it, unless you create some kind of acknowledgement from the device and check for that.


#3

Thanks @shanevanj! I don’t know how I missed that. I was on that page looking at webhooks forever. Apparently I needed some sleep.