Skip to main content
Solved

Webhook pass the complete event in body

  • June 27, 2023
  • 6 replies
  • 152 views

Forum|alt.badge.img+2

Hey, is it possible to pass the entire event in a webhook and not just specific fields? 
Any way I try get an invalid json error

Thanks

Best answer by Brian Turcotte

Hi @matanper!

Per our documentation on webhooks here:

For any metric-triggered flows, you can pass profile properties and dynamic event data associated with the triggering event. For instance, for a Placed Order event, you can include aspects such as the item(s) left behind, their price, the total for the cart, as well as the customer’s name and address.

 

There’s no way to copy and paste the entire event in the body of the webhook, but you can fill out a simulated version with the available event data. Just make sure you’re clicking View profile and event variables in the body statement and selecting the variables from there.

 

I hope this helps to clarify, and thanks for using the Community!

- Brian

6 replies

Brian Turcotte
Forum|alt.badge.img+37
  • Klaviyo Alum
  • 1393 replies
  • Answer
  • June 27, 2023

Hi @matanper!

Per our documentation on webhooks here:

For any metric-triggered flows, you can pass profile properties and dynamic event data associated with the triggering event. For instance, for a Placed Order event, you can include aspects such as the item(s) left behind, their price, the total for the cart, as well as the customer’s name and address.

 

There’s no way to copy and paste the entire event in the body of the webhook, but you can fill out a simulated version with the available event data. Just make sure you’re clicking View profile and event variables in the body statement and selecting the variables from there.

 

I hope this helps to clarify, and thanks for using the Community!

- Brian


Forum|alt.badge.img+2
  • Author
  • Contributor I
  • 2 replies
  • June 27, 2023

Hi @matanper!

Per our documentation on webhooks here:

For any metric-triggered flows, you can pass profile properties and dynamic event data associated with the triggering event. For instance, for a Placed Order event, you can include aspects such as the item(s) left behind, their price, the total for the cart, as well as the customer’s name and address.

 

There’s no way to copy and paste the entire event in the body of the webhook, but you can fill out a simulated version with the available event data. Just make sure you’re clicking View profile and event variables in the body statement and selecting the variables from there.

 

I hope this helps to clarify, and thanks for using the Community!

- Brian

Thanks for the quick response 😃

Too bad it’s impossible… is there a way to add support for custom django filters? (like this https://gist.github.com/jtiai/5002929)

 


Brian Turcotte
Forum|alt.badge.img+37
  • Klaviyo Alum
  • 1393 replies
  • June 27, 2023

Hi @matanper!

You certainly can! Here’s our docs on the ability/limitations of using Django logic:

Best,

Brian


Forum|alt.badge.img+2
  • Author
  • Contributor I
  • 2 replies
  • June 27, 2023

Hey @Brian Turcotte, The link isn’t working


Brian Turcotte
Forum|alt.badge.img+37
  • Klaviyo Alum
  • 1393 replies
  • June 27, 2023

Hi @matanper!

Sorry about that! Should be fixed now. 

 

Best,

Brian


  • Contributor I
  • 1 reply
  • March 17, 2025

Hi there,

Dirty solution but seem to works :
{{event|json_script|strip_html}}

For more information :
json_script encapsulate the event data in a <script> tag with a formatted json content as we wish :
strip_html remove the html tags

Example for : value = {'hello': 'world'}

{ value|json_script }

Become

<script id="hello-data" type="application/json">{"hello": "world"}</script>Then { value|json_script|strip_html }

Become

{"hello": "world"}