# Accessing payload of Component event

**URL:** <https://community.weweb.io/t/accessing-payload-of-component-event/8454>\
**Category:** Ask us anything\
**Created:** [May 4, 2024, 6:45pm UTC](https://community.weweb.io/t/accessing-payload-of-component-event/8454 "2024-05-04T18:45:10Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![oblic](https://avatars.discourse-cdn.com/v4/letter/o/bcef8e/32.png) [@oblic](https://community.weweb.io/u/oblic)\
**Post date:** [May 4, 2024, 6:45pm UTC](https://community.weweb.io/t/accessing-payload-of-component-event/8454/1 "2024-05-04T18:45:10Z")

</div>

I feel like there’s something missing in my understanding of component events.

I have a card, made into a component. On a button click there’s an event being triggered.  
The event has a workflow “on\_event” on the parent outside the component. This is all fine.

What I was trying to achieve is the following.  
OnClick, before sending the event, I want the component do to some work and send a payload with the event (using event value).

I don’t seem to get **where I can access that payload within the event workflow ??**

---

<div class="post-metadata">

**Author:** ![Doc](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/doc/32/8594_2.png) [@Doc](https://community.weweb.io/u/Doc)\
**Post date:** [May 9, 2024, 4:14am UTC](https://community.weweb.io/t/accessing-payload-of-component-event/8454/2 "2024-05-09T04:14:23Z")

</div>

Great question!

Could you give more details on the part you mentioned- the component do to some work and send a payload with the event (using event value)?

It looks like you’re familiar with the basics but have you had a chance to review [this article](https://docs.weweb.io/components/component-events.html#component-events) or [the video about triggering component events](https://youtu.be/WAu3GJtuFeU?si=8S8lCZtC-q4O4Xbg)?

---

<div class="post-metadata">

**Author:** ![oblic](https://avatars.discourse-cdn.com/v4/letter/o/bcef8e/32.png) [@oblic](https://community.weweb.io/u/oblic)\
**Post date:** [May 9, 2024, 12:36pm UTC](https://community.weweb.io/t/accessing-payload-of-component-event/8454/3 "2024-05-09T12:36:50Z")

</div>

Yes thank you. I watched all those articles and videos and it doesn’t cover the event _payload_. Just the event triggering.

But I did figure out how it works. I had to use the console log to catch the payload and understand the structure in order to catch and cast it properly on the event “triggered” side of things.

The problem is that you can’t see what the payload is live during execution. Since you can’t put a debug breakpoint in workflows, you can never catch the “event triggered” and look at what’s happening.

As you can see here, the ‘Event’ is always undefined.  
Also, for the ‘event’ variable to appear in the bottom browser, you have to execute your event trigger at least once.

 ![Screenshot 2024-05-09 at 8.23.58 AM](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/2/27ba1370a6b594957289a644778222a5b14ca24c.png)

---

<div class="post-metadata">

**Author:** ![Broberto](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/broberto/32/5918_2.png) [@Broberto](https://community.weweb.io/u/Broberto)\
**Post date:** [May 9, 2024, 10:21pm UTC](https://community.weweb.io/t/accessing-payload-of-component-event/8454/4 "2024-05-09T22:21:44Z")

</div>

You need to define the event (trigger schema) in the settings. The events are usually not available like this , because the event has’t happened yet. So I think you might just want to log the empty event and attempt to trigger it in order to see the payload.

---

<div class="post-metadata">

**Author:** ![oblic](https://avatars.discourse-cdn.com/v4/letter/o/bcef8e/32.png) [@oblic](https://community.weweb.io/u/oblic)\
**Post date:** [May 10, 2024, 4:12pm UTC](https://community.weweb.io/t/accessing-payload-of-component-event/8454/5 "2024-05-10T16:12:59Z")

</div>

Exactly what I thought. Thanks for the input.  
How do you define an event schema ? Can’t find anything on it in the doc.

---

<div class="post-metadata">

**Author:** ![Broberto](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/broberto/32/5918_2.png) [@Broberto](https://community.weweb.io/u/Broberto)\
**Post date:** [May 10, 2024, 4:22pm UTC](https://community.weweb.io/t/accessing-payload-of-component-event/8454/6 "2024-05-10T16:22:39Z")

</div>

Trigger schema, when you’re creating the trigger.

 ![Screenshot 2024-05-10 at 18.22.17](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/2/2aadd76d26840d9e718f889322993d1f66e50b9b.png)

---

<div class="post-metadata">

**Author:** ![oblic](https://avatars.discourse-cdn.com/v4/letter/o/bcef8e/32.png) [@oblic](https://community.weweb.io/u/oblic)\
**Post date:** [May 13, 2024, 12:58pm UTC](https://community.weweb.io/t/accessing-payload-of-component-event/8454/7 "2024-05-13T12:58:15Z")

</div>

Yes, I know where it is, I don’t know what should be put in there !? JSON, Javascript, variables …  
Do you have a Event schema exemple ?

Thanks.

---

<div class="post-metadata">

**Author:** ![EduardoChaves](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/eduardochaves/32/12460_2.png) [@EduardoChaves](https://community.weweb.io/u/EduardoChaves)\
**Post date:** [February 19, 2025, 8:01pm UTC](https://community.weweb.io/t/accessing-payload-of-component-event/8454/8 "2025-02-19T20:01:03Z")

</div>

I found that the Event value doesn’t overwrite the default Event Schema. It seems that we cannot pass a payload based on a variable, just don’t know exactly if it is a current limitation or a bug.

 ![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/2/24e6fd3da61023c408a7d9ce3858237f6ba8fbb4.png)

The workaround I found for this is by updating a component variable that can be accessed by outside.

---

<div class="post-metadata">

**Author:** ![Broberto](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/broberto/32/5918_2.png) [@Broberto](https://community.weweb.io/u/Broberto)\
**Post date:** [February 19, 2025, 8:14pm UTC](https://community.weweb.io/t/accessing-payload-of-component-event/8454/9 "2025-02-19T20:14:56Z")

</div>

You’re overcomplicating it and using not standard. Schema is just informative, it’s a helper to give you a hint of the data structure, the result once the action is run is the real data.

---

<div class="post-metadata">

**Author:** ![EduardoChaves](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/eduardochaves/32/12460_2.png) [@EduardoChaves](https://community.weweb.io/u/EduardoChaves)\
**Post date:** [February 19, 2025, 11:34pm UTC](https://community.weweb.io/t/accessing-payload-of-component-event/8454/10 "2025-02-19T23:34:34Z")

</div>

But that’s my point, the workflow execution always returns the schema instead of the **Event value** I passed when triggering it.

 ![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/5/542de6c693426af916aa41a03adaa8d0b1683f91.png)  
 ![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/e/e3a5d036ac5940489e5f4d1e2762b36f0c034e49.png)

---

<div class="post-metadata">

**Author:** ![DanielL](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/daniell/32/13398_2.png) [@DanielL](https://community.weweb.io/u/DanielL)\
**Post date:** [February 23, 2025, 7:43am UTC](https://community.weweb.io/t/accessing-payload-of-component-event/8454/11 "2025-02-23T07:43:11Z")

</div>

Hi @EduardoChaves

Have you checked this article: [Component events | WeWeb Documentation](https://docs.weweb.io/components/component-events.html#event-data-and-schema)

As mentioned by Broberto, the event is only informative. The binding UI is just an informative template. If you log the event value, you will see the correct results.

---

<div class="post-metadata">

**Author:** ![EduardoChaves](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/eduardochaves/32/12460_2.png) [@EduardoChaves](https://community.weweb.io/u/EduardoChaves)\
**Post date:** [February 24, 2025, 6:29pm UTC](https://community.weweb.io/t/accessing-payload-of-component-event/8454/12 "2025-02-24T18:29:11Z")

</div>

Hi @DanielL I just tested it and the event value returns the proper value from the trigger.

My complainants were because I thought the value would be the default event schema that was showing on my workflow, instead of the actual value returned from the trigger.

I think it would be great if the event data could dynamically update as the developer uses it, just like the proper workflow history that we may visualize the variables value used in the execution.
