# Webhook output inside ctx?

**URL:** <https://discuss.elastic.co/t/webhook-output-inside-ctx/219866>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [February 18, 2020, 9:30pm UTC](https://discuss.elastic.co/t/webhook-output-inside-ctx/219866 "2020-02-18T21:30:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chop/32/61665_2.png) [@Chop](https://discuss.elastic.co/u/Chop)\
**Post date:** [February 18, 2020, 9:30pm UTC](https://discuss.elastic.co/t/webhook-output-inside-ctx/219866/1 "2020-02-18T21:30:19Z")

</div>

I am running a webhook but i am not able to get the rest api call output into the context so i can send it through an email action is that possible?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [February 19, 2020, 9:25am UTC](https://discuss.elastic.co/t/webhook-output-inside-ctx/219866/2 "2020-02-19T09:25:46Z")

</div>

Hey.

this is not sufficient in order to aid with debugging. A full watch would help a lot. Based on a single sentence problem all that can be done is to guess things. So my guess here is, that you would like to have the output of an action in the `ctx.payload` somewhere, so that you can access the fields.

This is unfortunately not possible at the moment, only the inputs are available.

You could create a second watch, that queries the watcher history index and retrieves the last execution of your first watch and then extracts such information.

Hope this helps!

--Alex

---

<div class="post-metadata">

**Author:** ![Chop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chop/32/61665_2.png) [@Chop](https://discuss.elastic.co/u/Chop)\
**Post date:** [February 19, 2020, 4:28pm UTC](https://discuss.elastic.co/t/webhook-output-inside-ctx/219866/3 "2020-02-19T16:28:13Z")

</div>

Yes, it does help. Thanks for taking the time to answer.  
Now, when you mention that only the inputs are available by any chance do you have a sample that shows how to use the inputs?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [February 20, 2020, 7:37am UTC](https://discuss.elastic.co/t/webhook-output-inside-ctx/219866/4 "2020-02-20T07:37:27Z")

</div>

Run the execute watch API and check the `payload` field from the output, you will see the data that is available.

---

<div class="post-metadata">

**Author:** ![Chop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chop/32/61665_2.png) [@Chop](https://discuss.elastic.co/u/Chop)\
**Post date:** [February 20, 2020, 2:49pm UTC](https://discuss.elastic.co/t/webhook-output-inside-ctx/219866/5 "2020-02-20T14:49:26Z")

</div>

Thanks, for the second reply 😃 but that still requires a second watcher and i am trying to avoid that. I end up using aggregations to get the data as i didnt find any other way to get into the hits array.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 19, 2020, 2:49pm UTC](https://discuss.elastic.co/t/webhook-output-inside-ctx/219866/6 "2020-03-19T14:49:33Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
