External resources is a powerful tool in Ubivox, to dynamically merge external content into newsletters. They can for instance be used to fetch updated product prices, new post in a blog or forum, banners etc. into the newsletter.
An external resource is created on a list - click on the name of the list from the dashboard, and then List menu -> Externals.
To create a new external resource, click Create new external resource and fill out the fields. You can choose whether is has to be HTML-/text content or RSS-content.
Example using HTML
Create an external resource. Title is used when inserting the external resource into the newsletter. Choose Raw content in resource type, and Fetched is set to At delivery. This means that Ubivox retrieves the HTML content when the newsletter is about to be sent, and not when it is scheduled for delivery. This way you will have the latest updated HTML content in your newsletter. In the URL field, you enter the destination of the content that has to be retrieved when the newsletter is about to be sent. Leave the Template field empty.
Save the external resource and enter the editor, to insert it into the newsletter. You then insert a content area. If you called the banner "Banner nr. 1" then you enter the following: {$ Banner nr. 1 $}
.
Save the changes, and Ubivox will then fetch the updated content and merge it into each newsletter every time the newsletter is sent.
Example using RSS-feed
It's the same process as the latter example, except you have to choose Syndication feed in Resource type, and you now have to fill out the Template area.
Template is used to explain Ubivox how the RSS-feed is to be parsed. Ubivox uses Feedparser, the full documentation can be found at the homepage.
An example of fetching the latest 5 posts in a forum at Amino.dk could be:
<table>
<tr>
<td>Titel</td>
<td>Dato</td>
<td>Bruger</td>
</tr>
{% for entry in feed.entries %}
{% if loop.index < 5 %}
<tr>
<td><a href="{{ entry.link }}">{{ entry.title }}</a></td>
<td>{{ entry.date }}</td>
<td>{{ entry.author }}</td>
</tr>
{% endif %}
{% endfor %}
</table>
You can test it, by creating a resource and let it link to this RSS-feed.
Please note
The external resource is only fetched once, and is thereafter cached.
The character set for the RSS-feed should be UTF-8.
If the external resource is not fetched correctly, the delivery will fail, and all users (NOT recipients) on the account are notified through an notification e-mail.