Solved

how to use RSS feed in email

  • 29 December 2020
  • 11 replies
  • 1171 views

Badge +1
  • New Member
  • 0 replies

I set up xml feeds successfully in Klaviyo from RSS feeds from Shopify blogs… I did my very best to follow the one article that describes doing dynamic content, but it does not work… anyone have thoughts?

 

also, there is no indication of how Klaviyo can pickup just the latest/new content since the last email went out, like Mailchimp does. any ideas?

icon

Best answer by k.mcevoy 30 December 2020, 17:50

View original

11 replies

Userlevel 4
Badge +5

Hi there, 

 

Thanks for contributing to the Community! Is this the article you followed to add the dynamic content? What is the syntax you are using within your template that is not populating correctly? If you are updated the RSS feed with the latest blog post, Klaviyo will automatically detect the newest post and pull it from the top of the feed. You have the option to limit the number of posts you wish to display in your feed with Django Filters: 

 

Thanks again for being a member of the Community!

 

Kelsey 

 

Badge

I have problems to pull an image from an rss feed to a template, but I'm not sure if it's Klaviyo's problem or some particularity of how I built the XML, I'm not a developer so my knowledge is little, I would like to know if you could share with me an example xml to rebuild mine.

 

 

Userlevel 7
Badge +53

Hello @Vlad Varela,

Thanks for being a member of the Klaviyo Community!

Since webfeeds can be set up in a wide variety of formats based on the type of information you are passing, there wouldn’t be an example XML file we can provide for use as an example. I would first recommend testing and validating your feed to make sure your feed is being accessed successfully by Klaviyo. 

After testing and validating that your feed is being accessed correctly by Klaviyo, I would recommend also double checking to ensure you are using the correct JSON variables and Django filters to reference the image you want to display within your email. Resource that may help you use the correct variables and filters are the Guide to Adding a Custom Web Feed in an Email article and the Django Documentation Guide

I hope this helps!

David

Badge +3

Hi David,

With reference to the above image.

If I have to display “@length” in the feed what should be the syntax-

{{ item.enclosure."@length" }} or something else?

Userlevel 7
Badge +53

Hey @pankaj,

To access data nested within the first-level variables, you’ll want to use the dot notation. So, yes, in theory, to access the “@length” variable from the example, you’ll want to use the {{ item.enclosure."@length" }} syntax. 

I think you’ll also find the Populate Feed Content in Your Template section in the Guide to Adding a Custom Web Feed in an Email Help Center article helpful for understanding this!

David

Badge +3

Hi @David To ,

I’ve gone through the documentation multiple times.

The syntax isn’t working for variables with # and @.


Refer the image, my Repeat for value is feeds.Feed_name.feed.entry

 

I’m trying to fetch nested variables (@type & #text) from title variable.

{{ item.title."@type" }}  & {{ item.title."#text" }}  gives following error.
  

I’m able to get the rest of the variables.

 

Userlevel 7
Badge +53

Hey @pankaj,

Instead of using the {{ item.title."@type" }}  and  {{ item.title."#text" }} syntax, I may suggest using the {{ item.title|lookup:"@type" }} format as those special characters within your feed may end up being encoded otherwise causing this error. 

If you’re having further troubles with this, it may also be a good idea to reach out to our wonderful Support Team who can take a more comprehensive look into the cause of this issue or finding an accredited Klaviyo Partner who can provide more hands on support on implementing this solution!

David

 

Badge +3

Thanks @David To that was really helpful.

Could you please let me know what should be the syntax in the following case, when you want to fetch the first “@href” only?
 

 

Userlevel 7
Badge +53

Hey @pankaj,

Like many array conventions, you’ll want to use a zero-based index notation to reference those array nodes. Because of this, you can use a 0 to reference the variables in the first node of the array! 

David

 

 

Badge +3

Thanks @David To 
Is this syntax Klaviyo specific or for a particular programming language? May I know the name of that programming language?

Userlevel 7
Badge +53

Hey @pankaj,

Similar to most email providers, Klaviyo emails are written in HTML. As previously mentioned in this thread, Klaviyo uses Django for template tags and filters. 

David

Reply