I am attempting to pull in content from a blog feed using AMPscript but am experiencing some issues in attempt to do so. It is probably worth noting that all I need to pull in is the title, description, and link of each blog post.
I've searched through other SFSE posts on this topic for a resolution but have not found one.
Here is my AMPScript:
%%[ Var @xml, @titles, @title, @descs, @desc, @links, @link, @cnt Set @xml = ContentBlockByName("Content Builder\z_SFMC_Test\Blog_Feed") Set @titles = BuildRowsetFromXML(@xml,"//item/title",1) Set @descs = BuildRowsetFromXML(@xml,"//item/description",1) Set @links = BuildRowsetFromXML(@xml,"//item/link",1) If RowCount(@titles) > 5 THEN SET @rows = 5 ELSE SET @rows = RowCount(@titles) ENDIF IF @rows >= 1 THEN for @cnt = 1 to 5 do Set @title = Field(Row(@titles,@cnt),"Value") Set @desc = Field(Row(@descs,@cnt), "Value") Set @link = Field(Row(@links,@cnt), "Value") ]%% <div style="border: 1px solid #444; background-color: #F7F7F7; margin: 0.76em 0; padding: 0.76em;"> <h1 style="font: bold normal 1.0em Arial, Helvetica, sans-serif;"><a href="%%=RedirectTo(@link)=%%" alias="%%=v(@title)=%%" title="%%=v(@title)=%%" style="color: #000;">%%=v(@title)=%%</a></h1> <span style="font: normal normal 0.76em Arial, Helvetica, sans-serif; color: #444;">%%=v(@desc)=%%</span> </div> %%[ NEXT @cnt ENDIF ]%%
Here's the content block that calls in the blog feed. (Note: I have this saved outside the email):
%%before; httpget; 1 "https://developer.salesforce.com/blogs/feed"%%
I have also tried just calling in the blog feed directly in my ampscript block without using a separate content area/block. No success.
Set @xml = HTTPGet("https://developer.salesforce.com/blogs/feed")
I have tested other valid RSS feeds using this AMPScript and have pulled content into my email with success. I have been unable to get the AMPScript to work with the blog feed I'm using in my case-- http://developer.salesforce.com/blogs/feed I'm not receiving any errors and am able to preview and test send my email just fine. It's just that there is zero XML content being pulled in.
<channel> <title>Salesforce Developers Blog</title> <atom:link href="https://developer.salesforce.com/blogs/feed" rel="self" type="application/rss+xml" /> <link>https://developer.salesforce.com/blogs</link> <description>Elevating developer skills and connecting with the Salesforce Developers community</description> <lastBuildDate>Mon, 25 Feb 2019 18:00:45 +0000</lastBuildDate> <language>en-US</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <item> <title>Features and Settings and Scratch Orgs, Oh My!</title> <link>https://developer.salesforce.com/blogs/2019/02/features-and-settings-and-scratch-orgs-oh-my.html</link> <comments>https://developer.salesforce.com/blogs/2019/02/features-and-settings-and-scratch-orgs-oh-my.html#respond</comments> <pubDate>Mon, 25 Feb 2019 18:00:45 +0000</pubDate> <dc:creator><![CDATA[Karen Fidelak]]></dc:creator> <category><![CDATA[Developer Experience]]></category> <category><![CDATA[February 2019]]></category> <category><![CDATA[salesforce dx]]></category> <category><![CDATA[scratch orgs]]></category> <guid isPermaLink="false">http://developer.salesforce.com/blogs/?p=190137</guid> <description><![CDATA[Scratch orgs are one of the really great capabilities provided with Salesforce DX. One of the benefits of scratch orgs is that they start empty, allowing you to configure them how you want and develop in a clean and known environment. But what is a benefit can also be a challenge. With all the optional […]]]></description>
Anyone have any recommendations or know of any workarounds? Am I missing something obvious? Anything would be appreciated!