Extract data from json webhook

I’m using Unifi Protect to detect people. And I use a webhook to notify Home Assistant when someone is detected.
Now I’m trying to extract a name from the webhook payload. Part of the payload:

trigger:
  platform: webhook
  webhook_id: xxxxxxxxxxxx
  json:
    alarm:
      name: HA Person of interest
      sources:
        - device: ABCDEFGHIJK
          type: include
      conditions:
        - condition:
            type: is
            source: face_of_interest
      triggers:
        - device: ABCDEFGHIJK
          value: Westerguard
          key: face_of_interest
          group:
            name: Westerguard

So I was trying {{ trigger.json.alarm.triggers.value }}, but this ain’t working because ‘value’ can not be found.

This only works for {{ trigger.json.alarm.triggers }}, which then returns me an object with an array (I think).

I tried to search, but I can’t seem to find how to extract the value from there.

Any help would be much appreciated.

Allright, it was here all the time.

To answer my own question, you have to use {{ trigger.json.alarm.triggers[0].value }} to get the name.

2 Likes