- our team
- Our Clients
Module to Import MailChimp Newsletters into your Drupal Site
A few (well, three - I'm saying three counts as a few) people over at g.d.o asked to try out a module I wrote for a client of ours a few weeks ago. So I'm putting up the first beta of it here.
Behold, the first generation of the MailChimp Import module (Drupal 6 only). This module does no more, and no less, than import your MailChimp campaigns into your Drupal site as nodes. Why would you want to do that, when MailChimp already provides online versions of your newsletters? Because your client asks for it, that's why. Perhaps they want to be able to file their sent newsletters alongside their other content, in the system of taxonomy that suits their particular mental aesthetic. Perhaps they want website visitors to be able to find articles in their old newsletters from the search box in the header of their Drupal site. Perhaps they don't trust that cheerful monkey.
For those who need a little context, here's a quick primer on MailChimp: It's a very nice third-party newsletter and mailing list management system. Very friendly, and even the free account is quite robust. In the parlance of MailChimp, newsletters are "campaigns", which is why I'm referring to them as such, even though you and I both know perfectly well that newsletters are newsletters.
How you use this module:
- Install in the usual way.
- Configure, at admin/settings/mailchimp/import. (Here, have a screenshot.) Currently the only settings are: which of your MailChimp mailing lists you want to import the campaigns from, what node type and input format you want to use for the imported nodes, and some markup and formatting destruction options.
- Import campaigns! BOOM!
How it works:
Dependencies: It depends on MailChimp module, because MailChimp module has two things I wanted to use: a) a copy of the MailChimp API; b) a configuration page where you enter your MailChimp API key. And because it makes sense to bundle related functionality together. Will this module, then, ever become a sub-module of Mailchimp module? MIGHTY SHRUG.
API: It uses the MailChimp API to talk to your MailChimp accounts and extract the IDs of your mailing lists and sent campaigns.
Schema: It creates a table with two columns, to store drupal node IDs against MailChimp campaign IDs.
Cron: It automatically checks your MailChimp account for new campaigns to import (and imports them if it finds any), on each cron run. Plus there's an "Import campaigns" button there on the settings page in case you don't wanna wait.
Text processing: It provides options for stripping out potentially layout-destroying tags such as <head>, <style> and <script>, along with all the stuff inside them, from the campaigns' content.
CSS help: It includes optional CSS for hiding elements of the email, such as the header and footer. The tricky part: you'll have to edit your campaign template in MailChimp and add the CSS class .mailchimp-hide to the parts you'll want to be visible in your emails, but not visible in the imported version on your Drupal site. The included README contains hopefully useful instructions on how to set that up.
How it doesn't yet work, but maybe after my nap:
The module was dashed off pretty quickly, and needs various kinds of love and attention.
I want to add settings and options and clever bits for the following:
- node title, maybe with some tokens (currently sets the node title to the email subject line)
- taxo terms to apply
- CCK field mapping
- whether or not to import on cron runs, perhaps how often to import
- the option to do all this importing through Feeds, for the joy of consistent content handling (People have been telling me this would be easy, but then I tried and I was like "I know from easy and this is not it, you guys".)
Moreover, some people who see the name "MailChimp Import" will likely be hoping for a module that will import their MailChimp subscribers as Drupal user accounts. Eh, you want that, go help develop EMF module.
MOAR UPDATE: Timo Tiuraniemi has made a Drupal 7 version! Clone and enjoy.