# Logical Operations in Webhook Payload

**URL:** <https://community.dynatrace.com/t/logical-operations-in-webhook-payload/21362>\
**Category:** Alerting\
**Tags:** problem-notification, migration, problems-classic\
**Created:** [February 1, 2021, 12:41pm UTC](https://community.dynatrace.com/t/logical-operations-in-webhook-payload/21362 "2021-02-01T12:41:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![serhat\_balik](https://avatars.discourse-cdn.com/v4/letter/s/c57346/32.png) [@serhat\_balik](https://community.dynatrace.com/u/serhat_balik)\
**Post date:** [February 1, 2021, 12:41pm UTC](https://community.dynatrace.com/t/logical-operations-in-webhook-payload/21362/1 "2021-02-01T12:41:09Z")

</div>

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…

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

```

---

<div class="post-metadata">

**Author:** ![skrystosik](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/skrystosik/32/21133_2.png) [@skrystosik](https://community.dynatrace.com/u/skrystosik)\
**Post date:** [February 2, 2021, 9:33am UTC](https://community.dynatrace.com/t/logical-operations-in-webhook-payload/21362/2 "2021-02-02T09:33:40Z")

</div>

You cannot write any kind of logic in Webhook payloads.

> **[Send Dynatrace notifications via webhooks](https://docs.dynatrace.com/docs/analyze-explore-automate/alerting-and-notifications-classic/problem-notifications/webhook-integration)**
>
> Learn how to integrate problem-notifications using a custom webhook.

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
