We’re rolling out a new feature for all everybody today Webhooks!
You can now trigger HTTP and HTTPS web requests to any server online with nothing more than
Spark.publish("Hello World!");
You can setup webhooks to listen for events from your devices, and immediately trigger powerful side-effects anywhere online! You can also now securely retrieve data from HTTPS sites, and take advantage of your already encrypted session with the cloud.
Thank you to the over 100 beta testers, and to everyone who’s helped make this possible, yay!
The examples (and BDub’s example above) all show replacing a single JSON or form field; what if I want / need to replace multiple fields? It doesn’t look like I can really set more than one field given the template syntax… am I wrong?
I understand that, my question is if it is possible to customize more than one field in the JSON that is posted as part of the webhook. Using your example, what if you want to customize both the “title” and the “body” sections of the event that your webhook as part of your publish event? This doesn’t seem possible at the moment.
Not a huge deal, just something to keep in mind when integrating!
Good question! A few people have asked for this feature since we launched, and it’s interesting, I think I can make it work. I’ll add it to my backlog and build it when I get a chance.
In the Librato example the event name is “librato_”, but when Spark.publish is called librato_A0 is called.
Is this a mistake, is there some regex magic going on or am I missing something?
Edit:
Also, I have a couple more questions about webhooks would this be the appropriate place to discuss them?
In addition to @bko’s response about the benefits of HTTPS, Webhooks also offer the ability to perform event driven web requests, so the rest of your code can spend more time doing other tasks, instead of waiting for the internet to reply. When the reply comes back, your Spark.subscribe() event handler can process the results.
Webhooks are like sending a text message while playing some video games and then getting a text message back. VS an HTTP Client which is more like putting down the game controller… picking up the phone… placing a phone call… having a conversation… ending the call… hanging up the phone and then playing video games again
Good Question!, the webhook eventName acts as a prefix filter, so any events starting with the event name you specify will be included, so “temperature/” will grab any event in the form “temperature/kitchen”, “temperature/basement”, etc, etc.
Hey @Devin , thanks for bringing this up and sorry for the troubles–I’m seeing this issue too. We are looking into it, will report back when we know more.
I think this was an issue with webhooks keeping a heartbeat alive internally, I’m setting up an alert to detect this and looking into a more full code fix. But it should be working again for now in the meantime.