Hello. I’m having some trouble parsing a JSON payload and assigning variables to specific events. I followed the instructions here, but I’m stuck on how to actually retrieve the JSON data and assign it to variables.
I’m using Plex to send a webhook to the rule I’ve created in SharpTools.
I’ve set up a HTTP trigger and copied the URL into the webhook settings in Plex.
I have an action set up to assign a variable to a specific payload called ‘event’. Set variable $event value using $context.event.params.event value
Plex seems to successfully trigger the rule according to the log, but I keep getting this error…
12:41:24 PM
Triggered by http event: API Key 353dddxxx-xxxx-xxxx-xxxx-xxxxxxce191e
12:41:24 PM
Set variable value: $event = undefined
The data is supposed to be ‘media.stop’ or ‘media.play’.
It looks like the Plex Webhook implementation is kind of quirky. Instead of sending the webhook over as a traditional webhook with JSON as the body, they’re using a special form encoding which is usually reserved for files and embedding the JSON within that.
Anyway, it’s an odd format, but we’ll take a look at extending the Rule HTTP Trigger to support it in a future update.
How did you get this working? I have a rule set up with a webhook and in the logs I can see the data is coming through to sharp tools but I have not idea how to use this data to trigger anything.
What I want to do is use the event media.play to trigger a scene in Smartthings