cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3062
Views
2
Helpful
3
Replies

Webhooks | Custom payload using Liquid | Cant access child object

SuperM
Community Member

Hi All.

I am using the webhook payload template editor tool and for some reason unknown to me, I can not access the child object "uplink" I am using the same syntax as per the Meraki Docs.

LIQUID:

{
    "alert":"{{alertData.uplink}}"
}

The Error I get:

" Failed to load webhook payload template preview. Make sure you're using valid JSON format. ["Body Liquid error: undefined variable uplink"] "

The uplink value does exist:

LIQUID:

{
 "alert" : {{alertData | jsonify }}
}

JSON:

{
  "alert": {
    "uplink": "0"
  }
}


Example from Meraki docs which I followed to the "T":

https://developer.cisco.com/meraki/webhooks/custom-payload-templates-overview/#overview

Child object properties can also be accessed using the {{foo.bar}} syntax.

LIQUID:

{
    "port":"{{alertData.portNum}}"
}

JSON:

{
  "port": "3"
}



Any suggestions would be appreciated, not sure if it is a bug or if I am doing something wrong.

1 Accepted Solution

Accepted Solutions

matt_uc
Level 6
Level 6

This looks like it would work to me, and validates.

}

"uplink": "{{alertData|dig:"uplink"}}"
}

View solution in original post

3 Replies 3

matt_uc
Level 6
Level 6

This looks like it would work to me, and validates.

}

"uplink": "{{alertData|dig:"uplink"}}"
}

SuperM
Community Member

@matt_ucthanks that worked 😊

DexterLabora
Cisco Employee
Cisco Employee


as @matt_uc correctly suggested:
https://developer.cisco.com/meraki/webhooks/custom-payload-templates-overview/#dig

The alertData property is ... special. Since every alert contains different properties, its sort of a black box to the template language. So, using the "dig" filter runs a function to pull this info out at runtime. That being said, if the nested property is declared, then using the dot.notation works.

We can update the documentation to make this more clear.