Logical Operations in Webhook Payload

We can do some logical operations in AppDynamics to match the fields of BMC Truesight in the custom webhook integrations. Is there a way to accomplish this in Dynatrace? Because the moment I start writing some code, I immediately get a syntax error.

I also wonder how can we dive into JSON object of {impactedEntities} to extract only the entity name instead of long explanation in {impactedEntity}, such as “CPU increase at abcHost” ?

Below is the code we’re using in AppDynamics integration right now…

[<br>{<br>"eventSourceHostName": "APMTEST",<br>"eventSourceIPAddress": "xx.xx.xx.xx",<br>#if(${latestEvent.node.name})<br>"eventSourceHostName": "${latestEvent.node.name}",<br>"eventSourceIPAddress": "",<br>#end<br>"attributes": {<br>"CLASS": "APM_EV",<br>"controllerUrl": "${controllerUrl}",<br>"accountId": "${account.id}",<br>"accountName": "${account.name}",<br>"mc_object": "${latestEvent.tier.name}",<br>"mc_object_uri": "${latestEvent.deepLink}",<br>#if(${latestEvent.healthRule.name})<br>"mc_parameter": "${latestEvent.healthRule.name}",<br>"mc_tool": "${latestEvent.healthRule.name}_${latestEvent.severity}",<br>"mc_smc_alias": "${latestEvent.healthRule.name}",<br>#end<br>"mc_service": "${latestEvent.application.name}",<br>"mc_priority": "PRIORITY_1",<br>#if(${latestEvent.severity}=="ERROR") ---->> HOW CAN WE WRITE THIS?<br>"severity": "CRITICAL",<br>#end<br>#if(${latestEvent.severity}=="WARN") ---->> HOW CAN WE WRITE THIS?<br>"severity": "MAJOR",<br>#end<br>#if(${latestEvent.severity}=="INFO") ---->> HOW CAN WE WRITE THIS?<br>"severity": "OK",<br>#end<br>"msg": "$!{latestEvent.summaryMessage.replace('<br>',' ').replace('<b>','').replace('</b>','')}",<br>"mc_long_msg": "$!{latestEvent.eventMessage.replace('<br>',' ').replace('<b>','').replace('</b>','')}"<br>}<br>}<br>]

You cannot write any kind of logic in Webhook payloads.

You can only use existing placeholders that are in documentation above. I think it may be good idea to post new product idea about this feature.

Sebastian