RSS Sendy Email Campaigns

RSS Sendy Email Campaigns

I believe Sendy’s most requested feature is the RSS to email campaign. As someone who maintains a blog (you’re on one of them) I like to keep people updated via email when I update my blogs. My blog has an RSS feed and I also have Sendy. Lucky me, but also lucky you, because I found the following github project for doing exactly that. Download the zip or do a GIT and save the folder somewhere you can access it. I am working on my script locally and you can too. 

RSS Sendy Campaign Example

I then changed it to match my needs and I am going to take you through it because it’s beautiful. First off if you’re not technical, it’s quite alright, you might have to do a little more searching to find answers to your questions about setting up your environment, but it will be worth the effort. The first thing I want to point out is that I use a Mac. If you are on Windows you should…. be ashamed of yourself….. and then figure out how to install python and have it accessible from the commandline on your machine. You could also do this all from the same Linux server you are running Sendy from too. If you are on Mac or Linux then just follow along.

Let’s check the version of python you have. From the commandline or terminal run

python --version

In my case, I am running Python 2.7.10 and the perl script I linked to uses 2.7 so I am ready to go. If you aren’t running 2.7, I would continue anyway because maybe it will work and you can tell us in the comments.

To install PIP on your mac you will need to run this from the Terminal

sudo easy_install pip

You should see a bunch of stuff returned and once complete you are ready to proceed. Stick with me because it gets much easier and I am also going to share some extra goodies later too.

From the commandline change directories to the folder containing the files you downloaded in the opening paragraph.

sudo pip install -r requirements.txt

You will see something similar to this after you hit enter.

Collecting feedparser==5.2.1 (from -r requirements.txt (line 1))
Downloading (1.2MB)
100% |████████████████████████████████| 1.2MB 1.5MB/s
Collecting Jinja2==2.8 (from -r requirements.txt (line 2))
Downloading Jinja2-2.8-py2.py3-none-any.whl (263kB)
100% |████████████████████████████████| 266kB 2.4MB/s
Collecting MarkupSafe==0.23 (from -r requirements.txt (line 3))
Downloading MarkupSafe-0.23.tar.gz
Collecting requests==2.7.0 (from -r requirements.txt (line 4))
Downloading requests-2.7.0-py2.py3-none-any.whl (470kB)
100% |████████████████████████████████| 471kB 2.1MB/s
Installing collected packages: feedparser, MarkupSafe, Jinja2, requests
Running install for feedparser ... done
Running install for MarkupSafe ... done
Successfully installed Jinja2-2.8 MarkupSafe-0.23 feedparser-5.2.1 requests-2.7.0

That’s it. We are ready to pull from an RSS feed to a Sendy campaign. Let’s do the configuration and then I will share what my output looks like. SendyRSSPub can be run from anywhere, it does not need to run on the same system as your RSS feed or your Sendy installation. As long as the system has network access to both, everything should work.

If I were you, I would create a new list to test with. I created a new list in my campaign with 1 subscriber. Me. I am using that list to test that this works and I strongly recommend you do too. Make a new list with yourself as the lone subscriber now. Do it or you will have no one to blame but yourself.

In the sendyrsspub-master directory, you downloaded and unzipped, there is a file you need to update. You can do this from the commandline with vim or you can actually open it with your favorite text editor. Your choice.

Don’t change the database option but DO change everything else. I have covered how to get email list IDs before and also how to get the API Key in case you don’t know how to find them. Sendy has a pretty basic API but this little script is about to showcase it.

If you want more documentation it’s available on Github but if you’re like me and just want to see something work. Stay with me.

I am going to dumb this down a little bit and not because you need me to, but because I need to so that I can explain what’s going to happen.

In the directory there is a folder called templates. I hated how the default template looked when my test newsletter went out so I created a new template. The script output will now match my existing newsletter format.

If you have an existing template you use in Sendy that fits the look and feel of your site, I suggest going into Sendy, choosing that template to edit, then copying all of the HTML. Once you have it copied, simply paste it in a new document using your favorite text editor. I assume that if you are using Sendy, you have a basic understanding of HTML and so the next part is really neat. Find where you would like your RSS feed options to show in the template and then add the following:
{% for entry in entries %}
<h2>{{ entry.title }}</h2>
<p>{{ entry.summary_detail.value }} <a href=”{{ }}”>Read More….</a><p>
{% endfor %}

Save the file as text-custom.html and include it in your template directory. The name doesn’t matter actually it’s just what I am using to make the directions clearer below.

Open your file again and change the template name to the one you just created. In my case that’s text-custom.html and the line looks like this.

'template': 'text-custom.html,test.txt',

In the next step, our script is going to parse the RSS or XML feed and then create a new email in Sendy, and then send it to the list you have defined. Again, I am using a test list and so should you!

From the terminal or command line we are going to run:

sudo python send_newsletter

After you hit enter I would highly recommend you open Sendy, choose your Campaign and hit reports. You should see the report for the email you just sent. Clicking on the preview button is going to show you what your new RSS to Sendy email is going to look like.

If you don’t like what it looks like and want to make changes you will need to delete the feed_log.db and edit your custom-text.html file, then test it again.

You should see the status report seconds after the script has run and testing multiple times is how I got mine to look like I wanted it to.

If there are no results in the RSS feed, or if everything in the RSS feed has already been sent and stored in the feed_log.db your email will not be created. Delete the db file and you can have a fresh start.

Here are a couple of things I think are important before wrap this up. I personally like to schedule my campaigns at convenient times and I also like to review them before they are sent so in my case, I am going to keep my RSS newsletter just like it is, sending to a single campaign with my test list which includes only me. From there, I can then duplicate my campaign and send it to my “real” list. I think that is the safest way to run a script that falls outside of the Sendy default installation and guarantee the expected result.

If you have questions, hit me up in the comments.

2 thoughts on “RSS Sendy Email Campaigns

  1. Hi,
    Nice article. Do you have a screenshot of the template (link is dead)? Does this still work with RSS to Sendy? Will the RSS feed also include the images? Possible to select the 3 latest posts and include them in a mail template as a draft, so I always press send after a check of the auto created newsletter? Is there anything you think is disturbing or “have room for improvements”?

    1. Here is a template It does still work however I have moved my workflow over to Zapier, because I have automated so much other work using their platform. Images do move over regardless of Zapier or SendyPubRSS. Yes there are a couple of gotchas, if you have typos that went unchecked in an article, they will be published before you have had a chance to fix them (if you publish). Many times I have had to manually update the email before sending.

Leave a Reply