# See aggregation value in a custom threshold (using webhook)

**URL:** <https://discuss.elastic.co/t/see-aggregation-value-in-a-custom-threshold-using-webhook/373805>\
**Category:** Kibana\
**Created:** [January 29, 2025, 10:07am UTC](https://discuss.elastic.co/t/see-aggregation-value-in-a-custom-threshold-using-webhook/373805 "2025-01-29T10:07:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![juanmgarciaf](https://avatars.discourse-cdn.com/v4/letter/j/53a042/32.png) [@juanmgarciaf](https://discuss.elastic.co/u/juanmgarciaf)\
**Post date:** [January 29, 2025, 10:07am UTC](https://discuss.elastic.co/t/see-aggregation-value-in-a-custom-threshold-using-webhook/373805/1 "2025-01-29T10:07:45Z")

</div>

Hello all,

I have created a custom threshold rule in Kibana 8.15.3 where I have defined two aggregations:

Aggregation A --\> count (all documents)  
Aggregation B --\> count (eventType: F\*)

I have also created a webhook action where I can specify in the body some things like {{context.group}}, {{context.value}}, etc., but I can't find any instruction to show the value of the aggregations independently.

Does anybody know if I can show in the webhook body the value of the aggregation A or B separately and not only the calc done with the aggregations in the condition (condition that I can currently see using {{context.value}} instruction)?

Many thanks in advance.  
Best regards.

---

<div class="post-metadata">

**Author:** ![Tortoise](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tortoise/32/147587_2.png) [@Tortoise](https://discuss.elastic.co/u/Tortoise)\
**Post date:** [January 29, 2025, 2:16pm UTC](https://discuss.elastic.co/t/see-aggregation-value-in-a-custom-threshold-using-webhook/373805/2 "2025-01-29T14:16:06Z")

</div>

Hola Juan,

Could you please try to use below :

ctx.payload.hits.total  
ctx.payload.aggregations.\<replace\_with\_your\_agg\_name\>.doc\_count

Thanks!!

---

<div class="post-metadata">

**Author:** ![juanmgarciaf](https://avatars.discourse-cdn.com/v4/letter/j/53a042/32.png) [@juanmgarciaf](https://discuss.elastic.co/u/juanmgarciaf)\
**Post date:** [January 30, 2025, 9:41am UTC](https://discuss.elastic.co/t/see-aggregation-value-in-a-custom-threshold-using-webhook/373805/3 "2025-01-30T09:41:15Z")

</div>

Hi,

I have tried to use {{ctx.payload.hits.total}} and {{ctx.payload.aggregations.A.doc\_count}} (because A is the aggregation where I have the all documents count) in the webhook body, but I can't see any value.

Anyway, many thanks for your help @Tortoise!!!
