Parse response from requests
Would be nice if the plugin could read the response and react to certain payloads. This way a third party integration could "control" the streamdeck button changing image and text for example
Interesting idea, though I'd want to implement it in a fairly minimalistic way to avoid ballooning the scope of the plugin.
I understand. The plugin in its simplicity is very powerful. Maybe this could be implemented into two new nodes that just listen? like a web-hook and a socket listener?
I think being able to accept incoming requests and being able to parse requests/responses are pretty orthogonal; if I were going to implement response parsing I definitely wouldn't want to limit it to only request listening.
Regarding scope, having thought about it a bit more I can see at this point that the real value of this plugin is in being able to interact with services that expose a http/websocket interface without needing to make a dedicated Stream Deck app for it. That's certainly my main use case at the moment, and probably what most people will end up using it for.
That being said, I can't make any promises on when I'll have time to work on any of this stuff (pull requests are welcome though). As a user, I think it would be ideal to be able to parse the response with jq-style syntax.
So I hacked the plugin as installed on my PC to get it to do this as a proof of concept. it works ok, but I really don't want to put any more time into it, as I'm not a javascript developer... happy to put together a quick PR with a single patch with the changes if you're interested.
I also should have used your Util method to read in a file and set the image, but I found that after I'd borrowed a readFile() method from the elgato examples.... so, many many improvements to make to what I've done.
The configuration is loosely based off of the "custom image from response" settings from BarRaider's API Ninja (which has issues in my case, which is why I wrote this quick hack).
@mjbnz I'm very interested in your patch. I'm also not a js developer but i'm searching for a better solution than API Ninja...
@mjbnz I'm very interested in your patch. I'm also not a js developer but i'm searching for a better solution than API Ninja...
I'm actually now slowly working on my own plugin from the ground up to do this, it'll also have support for periodic checks to update the button icon if the state changes via some other means.
@mjbnz I'm very interested in your patch. I'm also not a js developer but i'm searching for a better solution than API Ninja...
Have a look at https://github.com/mjbnz/streamdeck-api-request and tell me how it goes.