Skip to main content
Solved

How to retrieve response data in Webhook setup?

  • September 5, 2023
  • 4 replies
  • 459 views

Forum|alt.badge.img+2

Hello,

 

So far as I know, I can set up a webhook in a flow to send Klaviyo data (profile/event properties) to the external system (POST only). However, it seems that Klaviyo does not handle the response data. What can I do if I need to retrieve some data from the response body after hitting the webhook?

 

It seems to me the Update Profile Property in the flow actions can play some roles here. I can create a custom profile property and bring it to webhook as a field in request payload, and I can change the value of this field in the webhook logic. But how is the change backfilled to this custom profile property in Klaviyo? I don’t see any endpoint in Klaviyo API (here: https://developers.klaviyo.com/en/reference/api_overview) can support to update a profile property.

 

Thank you so much for the reply!

Junsheng

Best answer by retention

@junsheng Hmmm.  At this time, I don’t think there’s a built-in Klaviyo event that tracks successful (or failed) webhook deliveries (yet).  

As a workaround, perhaps your webhook receiver can set a Custom Property timestamp like webhook_received = MMDDYYYY.  Then you can set a Conditional Split on it?

In this example, I’m using the “Created” Profile Property as an example, but you could create your own Custom Property that accepts a Klaviyo accepted datetime value.  Then, I set a 1-hour delay to check if the webhook occurred for that Profile in the Flow using the “Properties about someone” … “in the last 1 hour” (Date data type) to verify that the webhook was successful if the timestamp was updated in the Profile.  

 

Does this work for your use case?

 

---

Joseph Hsieh // retentioncommerce.com // twitter: @retenion 

View original
Did this topic or the replies in the thread help you find an answer to your question?

4 replies

retention
Partner - Platinum
Forum|alt.badge.img+62
  • 2025 Champion
  • 944 replies
  • September 5, 2023

Hi @junsheng, welcome to the dev group community here.

As far as I know, the wehook POSTS externally only and doesn’t handle any response or logic.  If you review the explanation here, it is not meant to be bi-directional:

If you want some kind of follow-up action to each webhook, you can create a service that accepts the Webhook and performs other subsequent action like updating a Profile or other actions.  If you are simply updating the Profile with a static value, you can also just use the “Update Profile Property Action” in Klaviyo.  Here’s the documentation for it:

Finally, you can also explore napkin.io - which is actually a Klaviyo owned service that you can use to accept webhooks and then do something else all hosted for you.  See here:

Coding the handler and subsequent actions I leave it up to you to explore further, and might be a bit out of scope here, but if you explain more what you’re trying to do, maybe we can point you in the right direction.

 

---

Joseph Hsieh // retentioncommerce.com // twitter: @retenion 


Forum|alt.badge.img+2
  • Author
  • Contributor III
  • 5 replies
  • September 6, 2023

Hi @retention, thank you so much for the reply. The information you provided is super helpful. One more question: I see Klaviyo flow is able to record whether or not the Webhook action is successful (Sent in below):

  

I want to add one more action after Webhook action if it is ‘Sent’. How can I capture the status of the Webhook action? I don’t see any related condition in the list:

 

Thanks!

-Junsheng  


retention
Partner - Platinum
Forum|alt.badge.img+62
  • 2025 Champion
  • 944 replies
  • Answer
  • September 6, 2023

@junsheng Hmmm.  At this time, I don’t think there’s a built-in Klaviyo event that tracks successful (or failed) webhook deliveries (yet).  

As a workaround, perhaps your webhook receiver can set a Custom Property timestamp like webhook_received = MMDDYYYY.  Then you can set a Conditional Split on it?

In this example, I’m using the “Created” Profile Property as an example, but you could create your own Custom Property that accepts a Klaviyo accepted datetime value.  Then, I set a 1-hour delay to check if the webhook occurred for that Profile in the Flow using the “Properties about someone” … “in the last 1 hour” (Date data type) to verify that the webhook was successful if the timestamp was updated in the Profile.  

 

Does this work for your use case?

 

---

Joseph Hsieh // retentioncommerce.com // twitter: @retenion 


Forum|alt.badge.img+2
  • Author
  • Contributor III
  • 5 replies
  • September 7, 2023

Hi @retention ,

 

This is a great idea and I am pretty sure it will work perfectly if this flow is triggered rarely. Thanks a lot!

My concern is: if the flow is triggered too often, e.g. 30 times/hours. How can we use a single custom property to check the all of the webhook deliveries? It seems that the minimum time interval of a Date type property is 1 hour. It’s ideal if we can somehow create a custom property with a dynamic name when the flow is triggered. Are we allow to do that? Do you have any idea on that?

 

Thanks as always,

-Junsheng