- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Webhooks | Custom payload using Liquid | Cant access child object
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.
Solved! Go to solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This looks like it would work to me, and validates.
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This looks like it would work to me, and validates.
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
as @mlefebvre 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.
