streamdeck-web-requests icon indicating copy to clipboard operation
streamdeck-web-requests copied to clipboard

Parse response from requests

Open depsir opened this issue 4 years ago • 7 comments

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

depsir avatar Jan 24 '22 09:01 depsir

Interesting idea, though I'd want to implement it in a fairly minimalistic way to avoid ballooning the scope of the plugin.

data-enabler avatar Jan 25 '22 18:01 data-enabler

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?

depsir avatar Jan 26 '22 17:01 depsir

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.

data-enabler avatar Jan 27 '22 00:01 data-enabler

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 avatar Mar 09 '22 09:03 mjbnz

@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...

thebasti314 avatar Mar 17 '22 18:03 thebasti314

@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 avatar Mar 17 '22 22:03 mjbnz

@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.

mjbnz avatar Mar 23 '22 04:03 mjbnz