Is possible to update a flow message using the API

  • 29 June 2021
  • 2 replies

Badge +2

I would like to know if it is possible to update a Flow messages using the API.



Best answer by retention 29 June 2021, 19:32

View original

2 replies

Userlevel 7
Badge +59

@DaviAmaral Hey, welcome to the community!  There’s a few way to accomplish this - and it depends on your use case.  All Flow Messages, uses Templates so if you *can* use the Template API (Update Template) to update or change the contents of a Template.  However, you would still have to manually apply the template to the Flow Message, so I assume this is not what you want.  

To change the message dynamically without user intervention, you can do one of the three methods below:

Use Show/Hide Blocks or Conditional Logic

If the set of things you want to change are discrete (a limited set of text), you can use Show/Hide conditions for the relevant Blocks in your message to change the output based on those conditions.  Or, you can use Django Template Language to do similar If/ElseIf/Then template code to wrap elements based on those conditions.  Here are some documention on those:

Use a Custom Web Feed

Alternatively, you can use a Custom Web Feed to populate content within your template.  Unfortunately, you can’t pass parameters to the Web Feed, but you can dynamically change the contents of the Web Feed which in turn changes the content within Flow Messages.  Each time a Flow Message is sent, it will pull in the most recent data from your Web Feed source. Here’s documentation on the Custom Web Feed:

Create a Custom Metric as the Flow Trigger

This method might be the most cumbersome method, but it will give you the most control over the message contents. If your Flow is based on a Metric to trigger the Flow (and not a List/Segment, or Date Property), you can create your Custom Metric via the “Track API” to include the dynamic message in the event data payload.  Then, you can simply reference that event field in your Template and you can change/update its value(s) on a per event basis.  In other words, what you send to Klaviyo as a metric, then becomes the available data to be used in the Template.  Here’s more details on creating your own custom metric:


Hope this helps!

Badge +2

These is perfect! thanks!