0

Short background: working for an international language school. I wish to set up an automation for people who have booked a course and the course is coming up soon (for ex next week). In that email I would like to mention the local weather for them to be able to prepare.

Now it's possible to pull an RSS feed into emails so I am guessing it could be possible to pull weather forecast information into an email automatically also. I'm guessing with heavy AMPscript usage.

Has anyone done anything like that before? Can you share it how you did it?

1

Here is sample code from the documentation showing how this can be accomplished.

%%[Var @xml, @titles, @title, @descs, @desc, @links, @link, @cnt
Set @xml = ContentAreaByName("my contents\RSSParse\RSSParse") /* This line specifies the content area from which the RSS content will be pulled for the email message. */
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 @rows 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
]%%

You would need to adjust for the particular feed you are using and the HTML output you want.

BuildRowSetFromXML() is simply one method. You can also utilize the TransformXML() functionality which is documented here.

I prefer the second method, as it allows me to use XSLT's which I'm A) More comfortable with, and B)Have more controls.

| improve this answer | |
  • Thanks Kelly. I think I'm getting a general idea of this process, though I haven't used AMPscript nearly as complicated as this. The problem I see here is that the XML transformation needs an ET landing page. Thus is needs the Microsites feature to be enabled for our account, which we don't have right now. I suppose it cannot be done without an ET landing page, correct? (thanks for all the help you gave so far) – Balint Apr 22 '14 at 16:48
  • This totally works in email. I've done it plenty. Give it a shot. – Kelly J Andrews Apr 22 '14 at 16:51

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.