What exactly are webhooks, Particle.publish, Particle.variable, and Particle.function used for?

I am new to the Particle ecosystem, and I am trying to figure out what the point of these four things is.

Webhooks and Particle.publish
As far as I understand it, Particle.publish is used in conjunction with webhooks which can post the information contained in Particle.publish to a website such as ThingSpeak, and also puts that information in the log of the Particle dashboard. But, it seems as though Particle.publish can only take one piece of data, and webhooks can only deal with one event, so for each piece of information you need another webhook. I know that it is possible to post information to other websites without webhooks, but then why would one need webhooks or Particle.publish?

Particle.variable and Particle.function
I believe that these two allow you to access variables and functions from outside the program, but from where?

Any explanations for these would be greatly appreciated!

1 Like

Particle publish will emit a Server Sent Event from the server to which you, and/or other devices can subscribe. It’s an actual ‘thing’, similar to websockets. It supported in browsers by default and most programming language have support for it too. So it’s used to push data from the device outwards.

Webhooks can pick up on these and use the data within to hit something else on the web that might require HTTPS, which is not natively supported on the Particle devices due to hardware constraints (though libraries are available).

Particle variables can GET data from the device.
Particle functions can POST data to the device, and trigger functions.
Both can be accessed over a REST API, called from whatever you’re comfortable with. A browser normally makes GET requests so that could be used to Request a variable for example. But again, most programming languages have support for REST, just have a quick google for the one you’re interested in :slight_smile:

4 Likes

Thank you, this was very helpful. :smile:

1 Like

Arti,
The but where part of the question, the variables and functions can be use in a lot of places. I been using Mobicle.io, Digistump Dashboard and I have downloaded but not used yet Blynk.

Mobicle is a quick way of accessing functions for controlling relays etc. by setting up buttons.

Digistump Dashboard allows the viewing of variables as text, graphs or gauges.

One other thing, most of the web interfaces seem to work better from Chrome, some have problems with Internet Explorer.

Hope that helps,
Chuck

1 Like

Thank you!