This is the last blog post in this year’s advent calendar covering plugins I use. And just like yesterday, it is a plugin that I wrote, because there was no satisfying solution from the platform. The website offers a newsletter using Mailchimp. In newsletter mails, you often find a link to an anonymous web version of the email. This is also available for Mailchimp newsletters. But listing all those “archive emails” was not that easy. There is a snippet from Mailchimp, but this is using some external JavaScript. That script is using one document.write() call to show the archive on a page, and there is almost no chance to modify the look of this list. It also used a date format MM/DD/YYY and title attributes on the link, which is really bad for accessibility. All in all, the snippet is pretty useless.
The only “solution” we had to get a nice archive was adding them manually to a static page with the title and archive link, after each newsletter was sent out. But this became an annoying task over time, since you can schedule a newsletter, but had to remember yourself to update this static archive page. So, long story short, I’ve created a plugin to dynamically show the archive.
What does the plugin do?
The Campaign Archive Block for Mailchimp plugin implements a single block to pull the archive for a Mailchimp newsletter using their API. I first implemented it as a “normal plugin” with a small settings page for the API key. But then I converted it into a “Block Plugin” which can be installed from within the block editor and be used right away. This was a great learning opportunity for me. And it was equally satisfying to delete the settings page for the plugin – I really don’t like settings pages. 😅
If one of the official Mailchimp plugins is already installed and configured on the website, it uses the same API key. If none of those is installed, the API key can be added (and removed) in the block settings. The other settings of the block allow you to define the number of mails from the archive to list, you can decide to either use the mail title or subject, and you can show the sender, date and time, if you want to.
Why do I use the plugin?
I use it, because there is no official plugin to show an archive. Many newsletter providers offer official plugins to add a sign-up form to your website. But I have not found a single one that also has a plugin to show and archive of previous mails. That’s why, again, I wrote my own solution. And since Mailchimp is one of the largest newsletter providers, I’ve published the plugin in the WordPress.org Plugin Directory.
Conclusion
Just like in the plugin I presented yesterday, I could not find a good solution for my requirement to integrate a Mailchimp newsletter archive into a website. But fortunately, the Mailchimp API is quite flexible and had just the right endpoint for me. I’m also working on a new feature that would allow you to only show mails from a specific campaign folder.
I also thought about creating a similar plugin for CleverReach, a newsletter provider that is quite popular in Germany, but their API credentials handling is too complicated to be used in a block plugin. Since I don’t use any other big newsletter provider in any of my projects, I also haven’t checked their APIs.
Do you write a newsletter? And do you also list older mails on your website? Then how do you do it?
Final words on the plugin advent calendar
It was fun writing all these blog posts in the past days. It was also a lot of work, and on three Sundays, I was not able to publish the next one at midnight. But life sometimes have other plans for you. I still managed to publish all blog posts on intended plugin advent calendar day.
Did you like my blog posts and the plugins I’ve shared? Which one was your favorite?