Content Feed Reference
What is a Content Feed?
A Content Feed is an API endpoint you host that returns HTML content. When EmailElement sends an email, it calls your endpoint and injects the returned HTML into the template. This enables real-time, dynamic content in emails without updating the template itself.
Adding a Content Feed
- Open a Custom HTML email template in the editor.
- Right-click in the editor where you want the content to appear.
- Select Content Feed from the context menu.
- The tag is inserted with a placeholder URL. Replace the URL with your endpoint.
Tag Syntax
[[Content-Feed url=https://example.com/api/htmlContents/1]]
The tag is replaced at send time with the HTML returned by the URL.
Static Content Feed
A Content Feed URL with no replacement tags is treated as static. EmailElement calls the endpoint once and caches the response for the entire send.
Characteristics
- Single HTTP request per send, regardless of recipient count
- Consistent content across all recipients
- Faster processing and lower load on your server
- Ideal for: promotions, announcements, shared content blocks
Example
[[Content-Feed url=https://example.com/api/htmlContents/1]]
Dynamic Content Feed
A Content Feed URL that includes replacement tags is treated as dynamic. EmailElement makes a separate HTTP request per recipient, substituting the contact's data into the URL.
Characteristics
- One HTTP request per recipient
- Personalized content per recipient
- Higher load on your server; ensure it can handle the volume
- Ideal for: product recommendations, personalized offers, account-specific content
Example
[[Content-Feed url=https://example.com/api/content?email={Email}&name={First Name}]]
For a contact with Email = sarah@example.com and FirstName = Sarah, EmailElement calls:
https://example.com/api/content?email=sarah@example.com&name=Sarah
Available Replacement Tags in URLs
Any standard replacement tag can be used in the Content Feed URL:
{Email},{First Name},{Last Name},{City},{State}, etc.- Custom fields:
{CustomFieldName} - Default values:
{First Name##default}(URL-encoded at send time)
Response Format
Your endpoint must return:
- Content-Type:
text/htmlortext/plain - Body: Raw HTML content to be injected into the template
- Status: HTTP 200. Non-200 responses result in empty content for that tag.
Example Response
<div style="padding: 20px; background: #f5f5f5;">
<h2>Recommended for You</h2>
<p>Based on your preferences, check out these items:</p>
<a href="https://example.com/product/123">Product Name</a>
</div>
Content Feed HTML Attributes
The returned HTML can include:
- Links: Automatically tracked by EmailElement (click tracking applies)
- Images: Hosted URLs are tracked for open tracking if applicable
- Replacement Tags: Tags in the returned HTML are not processed a second time. All personalization must be handled by your endpoint.
Best Practices
- Keep responses fast: EmailElement has a timeout for Content Feed requests. Aim for under 500ms response time.
- Return valid HTML: Malformed HTML can break the email layout.
- Handle errors gracefully: If your endpoint is unavailable, the Content Feed tag renders as empty. Design your template so this does not break the layout.
- Use static when possible: Static feeds are significantly more efficient for large sends.
- Test thoroughly: Use the Test email feature to verify Content Feed rendering before scheduling a campaign.