0

I want to feature the image and a link to our latest company Instagram posts within the footer of all of our emails. As the content will be updated no more than daily, I envisage calling an Instagram API within an automation and then upserting latest post info (title,url,imagepath etc) into a DE.

Has anyone attempted this type of integration and if so can they provide some example code?

3
  • Did you ever get this working? – Adam Spriggs Oct 3 '16 at 14:59
  • Not yet, having some authentication issues when trying to re-display the image assets. – Paul Moody Oct 3 '16 at 16:07
  • The solution I found was to use the tool fetchrss.com to generate an RSS feed of our Instagram channel. A HTTPGet call to pull the XML result into SFMC, before using a set of BuildRowsetFromXml calls to get the information via XPATH. Once I had the data then looping through the results and upserting them into a DE was pretty simple. – Paul Moody Oct 4 '16 at 8:00
0

If you can retrieve the Instagram data with JavaScript, my recommendation would be to utilize a Server-Side JavaScript Script Activity to retrieve the Instagram data and store it in a Data Extension. The Script Activity can be a step in the Automation prior to your email send.

Once the data is in a Data Extension, you can utilize one of the AMPScript Lookup functions to iterate and output the data:

%%[
var @rows, @row, @rowCount, @numRowsToReturn, @lookupValue, @i

set @lookupValue = "whee"
set @numRowsToReturn = 0 /* 0 means all */
set @rows = LookupOrderedRows("DataExtensionName",@numRowsToReturn,"DEColumn1 desc, DEColumn2 asc","LookupColumn", @lookupValue)
set @rowCount = rowcount(@rows)

if @rowCount > 0 then

 for @i = 1 to @rowCount do

  var @DEColumn1, @DEColumn2
  set @row = row(@rows,@i) /*get row based on loop counter */
  set @DEColumn1 = field(@row,"DEColumn1")
  set @DEColumn2 = field(@row,"DEColumn2")

]%%

  Row %%=v(@i)=%%, DEColumn1 is %%=v(@DEColumn1)=%%, DEColumn2 is %%=v(@DEColumn2)=%%

%%[

 next @i ]%%

%%[ else ]%%

  No rows found

%%[ endif ]%%

Reference

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.