Webhook Json If Else Automation

Hi there,

I’m trying to create an automation, triggered by webhook, that reacts differently based on the content of the json content.

The automation shall fire when the webhook gets called (easy part).
Within the automation, a simple if else statement shall check the variable ‘action’ from the web request and then do different things (for example, play/pause media).

I’ve been looking for hours now to find someone who had a similar problem before, but I think I’m always one wrong char in syntax away from the right solution.

What would be the right syntax to do this?

When your trigger is a webhook then here is the trigger variable:

If the payload is json you want to base your condition on trigger.json.action in the template. Or if it’s form data then trigger.data.action.

Yea, I figured that one out already, but how can I use it inside the automation? When I use trigger.json.action it won’t let me save.

What’s the payload (the json) that you send alongside your webhook?
Maybe show us the command you use to send the webhook.

Also show your current automation code.