How to Automate Content Retrieval from a Blog

You have a blog on Wordpress (or similar site) and want to automate an email campaign to send any new posts to your contact list. How do you do it?

It just so happens that it's very easy to do in Sensorpro, and this post will show you how to do it.

 

Introduction and Prerequisites

This process uses our "Recurring Campaign" functionality. This is a special type of campaign that runs on a pre-determined schedule (daily, weekly, monthly etc). Recurring Campaigns can be sent to a particular selection of contacts (those who are eligible to receive the email), or to all contacts if there is new content available to send to them. This process uses the latter.

Our blog retrieval process works by comparing today's date with a date in the blog URL. For example, if today's date is April 3rd 2014 and the blog URL is as follows:

http://www.mycoolblog.com/newsletter20140403.html

... then the recurring campaign will run and send an email automatically on that day.

 

Getting Started

First of all, note the link for your blog post. The link I'm using for this example is:

http://www.mycoolblog.com/newsletter20140403.html

  1. Log into newsletter.ie (or create an account if you're new here - welcome!).
  2. Create a Recurring Campaign and blank design.
  3. "Edit" a line to go into the content editor.
  4. In the Content Editor, use a special merge tag called {url} to specify the external URL to grab the content from. The syntax is {url:link} (where link is the page that you want to take content from). You also need to include the date mask as part of the URL. Using my example above, here is how it looks for me:



    Note: This link becomes the following if run on April 3rd 2014:

    http://www.mycoolblog.com/newsletter20140403.html
  5. Set up a segment of contacts who will receive each blog email.
  6. Add a broadcast as normal.
  7. With a recurring broadcast, there is no "Build" and "Broadcast" process. Instead, you will see a "Schedule" icon at the end of the line () - click it to open a screen where you can set the schedule:



  8. Enable it, set it to execute daily, and set the start date (and optionally the "stop" conditions). If you want to receive a status email every time it runs, enter your email address in the field at the bottom. Click OK.
  9. That's all there is to it!

 

Q&A.

Q. I have lots of extra content on my blog page that I do not want to appear in my email (menus, side bar content, footer content etc). Is there any way be more selective about what to 'scrape'?

A. Absolutely. In your blog post, put the following code before the content you want to scrape:

<!--[%-->

... and put the following code where you want the scrape to stop (e.g. the end of the content):

<!--%]-->

Important: Use the tags exactly as shown above (make sure that there are no spaces). Any content between those two tags will be scraped, and everything else will be ignored. Note that the <!-- and --> are HTML comment tags and are required (otherwise the [% and %] will be visible on the screen).

 

Q. What if I just have one blog post that I want to scrape to use in a regular email campaign?

A. Easily done. Simply use the blog URL without the date parameter, for example:

     {url:http://www.mycoolblog.com/my-new-article.html}

 

Q. If I'm automating the content, is there any way to automate the subject line too (ie. based on the title of the blog?)

A. Sure. For your subject line, use the following format:

     {url:http://www.mycoolblog.com/my-new-article.html|title}

The "|title" piece at the end will take whatever you are using as the title of the blog (ie. between the <TITLE> and </TITLE> tags) and use that as the subject line for your email.

Recent Blog Posts

Is this something you could use?