You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

求助Marketo邮件开发者:如何在Marketo邮件模板中添加XML Feed

How to Embed an XML Feed in a Marketo Email Template

Hey Felix, I get where you're stuck—web hooks in Marketo run server-side as part of campaigns, so their data isn't directly accessible in email templates out of the box. Let's walk through two practical solutions to get your XML feed content into your emails:

Option 1: Use Velocity Email Scripting (Direct Template Integration)

This is the most straightforward approach if you want to pull the XML content directly when the email is sent.

Step 1: Enable Email Scripting

First, make sure your Marketo instance has Email Scripting enabled. If you don't see the "Email Script" token option, reach out to your Marketo admin or support team to turn it on—this feature isn't enabled by default.

Step 2: Create an Email Script Token

  1. Go to Design Studio > My Tokens (or the folder where your email template lives).
  2. Click New > Email Script.
  3. Paste the following Velocity code, adjusting it to match your XML feed's structure:
#set($xmlFeedUrl = "http://depts.washington.edu/uweb/s-n/w.xml")
#set($xmlResponse = $http.get($xmlFeedUrl))

#if($xmlResponse.status == 200)
  #set($xmlDocument = $xml.parse($xmlResponse.body))
  <!-- Customize this section based on your XML's actual structure -->
  <div class="xml-feed-content">
    <h3>Latest Updates</h3>
    <ul>
      #foreach($item in $xmlDocument.rss.channel.item)
        <li>
          <strong>$item.title</strong>
          <p>$item.description</p>
        </li>
      #end
    </ul>
  </div>
#else
  <p>We're unable to load the latest content right now. Please check back later.</p>
#end
  1. Save the token (e.g., name it XML Feed Content).

Step 3: Add the Token to Your Email Template

In your email template, insert the token using the syntax: {{my.XML Feed Content}}

Pro Tips:

  • Use Marketo's XML selector syntax to target the right nodes (e.g., $xmlDocument.rootNode.childNode). You can test your XML structure using tools like XMLTreeViewer to map out the paths.
  • Be aware of Marketo's $http.get timeout limit (~10 seconds)—ensure your XML feed loads quickly to avoid email delivery delays.

Option 2: Web Hook + Custom Object + Smart Campaign (Cached Data)

Use this method if you need to cache the XML data (e.g., for slower feeds or to avoid repeated HTTP calls) or if you want to manipulate the data before it's used in emails.

Step 1: Create a Custom Object

  1. Go to Admin > Custom Objects > New Custom Object.
  2. Name it something like XML Feed Item and add fields that match your XML content (e.g., Title, Description, Publish Date).

Step 2: Configure a Web Hook

  1. Go to Admin > Web Hooks > New Web Hook.
  2. Set the URL to your XML feed address, Request Type to GET, and Response Type to XML.
  3. Under Response Mappings, map XML elements to your Custom Object fields (e.g., map /rss/channel/item/title to the Title field).

Step 3: Build a Smart Campaign to Update Data

  1. Create a new Smart Campaign in Marketing Activities.
  2. Set a trigger (e.g., Schedule to run daily) or a batch campaign to refresh the data.
  3. Add the Call Web Hook flow action, select your web hook, and configure it to create/update records in your Custom Object.

Step 4: Reference Custom Object Data in the Template

In your email template, use the Custom Object field syntax to insert content:

{{my.XML Feed Item - Title}}
{{my.XML Feed Item - Description}}

Key Considerations

  • Firewall Access: Ensure Marketo's IP addresses are allowed to access your XML feed domain—check Marketo's documentation for their current IP ranges.
  • Testing: Always send test emails to verify the content loads correctly, and use Marketo's preview feature to debug Velocity scripts.
  • Rate Limits: If using Velocity, avoid hitting the XML feed too frequently (Marketo doesn't enforce strict limits, but respect the feed's rate policies).

内容的提问来源于stack exchange,提问作者Felix B

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 12:29:57