Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2014-12-11 09:43:19

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

Calling all MailChimp users

Anyone out there using MailChimp? Or would like to use it for maintaining subscriber lists? Would you be interested in trying a beta plugin for allowing visitors to very easily subscribe / unsubscribe from your lists, that gives you virtually unlimited control over the signup process? If so, please raise your digital paw here and I’ll send you something to evaluate.

A bit of background for the interested: this plugin is merely a smidgeon of glue that links the new version of zem_contact_reborn (v4.5.0.0) with MailChimp using a tiny library written by none other than former Textpattern genius Drew McLellan. In true smd stylie, the basis of the plugin is that you can do… well, pretty much anything with the MailChimp API, by using ZCR tags to control it.

Here’s a taster from the plugin help:

<p>Sign up for our newsletter!</p>
<txp:variable name="chimpApiKey">abc123abc123abc123abc123abc123-us1</txp:variable>

<txp:zem_contact to="not_important@example.org">
   <txp:zem_contact_secret label="mailchimp_api_key" value='<txp:variable name="chimpApiKey" />' />
   <txp:zem_contact_secret label="mailchimp_double_optin:b" value="false" />
   <txp:zem_contact_secret label="list_id" value="mylist1234" />
   <txp:zem_contact_email name="email" />
   <txp:zem_contact_text name="FNAME" label="First name" />
   <txp:zem_contact_text name="LNAME" label="Last name" />
   <txp:zem_contact_submit label="Subscribe" />
</txp:zem_contact>

That’s it. So the process is:

  1. Register with MailChimp. Get an API key.
  2. Set up a List on MailChimp. Note its ID.
  3. Write a ZCR form, ensuring you add secret fields containing the key and list ID to which you wish people to subscribe.
  4. Add an email tag.
  5. Add other fields you wish to collect, with MailChimp Merge Tags as their name.
  6. Add secret fields containing MailChimp-specific control parameters, if required.
  7. Profit.

You can also control how the plugin interacts with ZCR when it returns. By default it’ll skip the mail process (because you may ask MailChimp to send a welcome message if you prefer), but if you want it to send you a confirmation of subscription or you want to copysender then it’ll do that too. With ZCR’s new bodyform attribute you have more control over the output, as well as being able to intercept the mail process itself and reformat it (maybe even do HTML emails if that’s your thing).

The plugin defaults to calling lists/subscribe, but you can change that by specifying another secret key with the mailchimp_action you wish the plugin to perform. Pass in whatever fields you need to fulfil that request and then when anyone interacts with the form, it does your bidding.

Since the thing is currently only designed for subscribe / unsubscribe actions (which don’t return anything) I’ve yet to figure out how to handle any data that MailChimp returns. If I figure that out, you could even go as far as adding ZCR forms to a hidden area of your site to make your own MailChimp management system (fetch lists, show subscribers to lists, etc). For now that’s not possible, but maybe soon.

As I say, it’s experimental, but for anyone who wants to use their Textpattern site to capture subscriber details, this may be just the ticket as a first step to engaging with customers.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#2 2014-12-11 15:40:30

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,323
Website Mastodon

Re: Calling all MailChimp users

Confused. Why would we use a plugin for contact forms as a sign-up form for a third-party service, and how do you discern between these two use cases?

mem_form as a more general form processor comes to mind as prior art for the opposite approach.

Offline

#3 2014-12-11 17:02:55

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

Re: Calling all MailChimp users

wet wrote #286441:

Why would we use a plugin for contact forms as a sign-up form for a third-party service

You’re right that mem_form is more general purpose and could indeed be used instead. Aside from the fact I don’t care for it much (it just always seems to cause more problems than it solves and I don’t have the mettle to brave the code and fork it!) this is just part one of an experiment into bolt-on modules that can do additional stuff when a user submits something to a site.

Contact forms that send email are one way of initiating dialogue with customers. I see ZCR as more than just an email portal, and kinda figured (rightly or wrongly) that it was under its remit to be able to open up a channel of communication outside of plain email.

ZCR can send articles and was used as the backbone of the first, rather flawed, Postmaster implementation. I just took that spirit and hacked together a tiny extension that delivered “email” somewhere other than someone’s inbox.

The efficacy of this is open to interpretation. Maybe nobody will bite. Maybe it’ll just be crap and I’ll ditch it. Who knows. But there’s a delivery callback in ZCR begging to be used, I wanted to play, and it took about an hour to write (including the docs) so I figured it was worth the effort.

how do you discern between these two use cases?

The existence of the secret tags beginning with mailchimp_ cause the plugin to do something. Otherwise it stays quiet and lets you mail as normal.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#4 2014-12-11 21:13:16

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

Re: Calling all MailChimp users

As an addendum to my previous post that I wrote in a rush, here are my reasons for choosing ZCR as the delivery platform, instead of mem_form:

  • ZCR supports HTML 5 widgets and has a more generic set of tags. Granted mem_form does have the combi tags for select and category lists, which is a nice feature.
  • Redirection in mem_form can be hit and miss, and sometimes just returns “You have successfully submitted the form. Thank you.” when you want it to do something else.
  • ZCR supports Textpacks and is more l10n-aware.
  • ZCR is currently supported and has more in-depth documentation. And a fair number of people are comfortable with the syntax of creating a contact form compared with mem_form.
  • Modules such as smd_mailchimp hook into the delivery phase of ZCR. Signalling back to the plugin allows the built-in mailing feature to be augmented or overridden, but it’s there for free if you wish.
  • A contact form creates a bond between your site and your visitors. I wanted to capitalise on that notion and build upon it. Other plugin modules could take ZCR content, validate it and present it to any number of places, e.g. social media sites or comment systems. And as mentioned, site admins can get a notification about the content if they choose.
  • ZCR just feels more solid in use and has a more well-rounded set of defaults because of its focus on message delivery. Convention over configuration.

I like that mem_form has a callback per field: that’s neat, though probably overkill for ZCR. A single delivery callback is probably enough for modules to decide if they need to intervene. At least for now.

ZCR is fairly mature now and a stable platform to work from. As a simple glue concept, the MailChimp plugin works. It could go a lot further, but probably won’t. I thought about allowing you to set and store your API key(s) from the admin side, maybe offering some handy subscribe / unsubscribe tags, but I opted for the path of least resistance / lowest common denominator and left it up to the admin to decide how to build the form. That does mean you could do some daft things, as hinted in the first post, but I wouldn’t advocate them even though they’re allowed!

Oh, and this is why I chose to try this out using MailChimp instead of any one of the other eight million offerings in the arena:

  • It has a free account option with sensible limits.
  • It’s powerful and flexible enough for modest campaigns to succeed.
  • The API is clean and logical… err, mostly.
  • It doesn’t ram OAuth down your throat for simple requests. An API key is perfectly good enough in most cases.

All that said, I may hook the plugin into mem_form as well for completeness, haven’t decided.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#5 2014-12-29 05:06:27

tye
Member
From: Pottsville, NSW
Registered: 2005-07-06
Posts: 859
Website

Re: Calling all MailChimp users

sh1t a booger – I’m interested :)

Been overseas – so totally missed this one

Offline

#6 2014-12-31 01:56:12

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: Calling all MailChimp users

yo steffer… please, oh please may I have the beta?

Offline

#7 2015-01-21 17:04:55

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,137
GitHub

Re: Calling all MailChimp users

Late to the party here – count me in for a +1 on the beta, please.

Offline

#8 2015-01-22 00:37:56

masa
Member
From: Asturias, Spain
Registered: 2005-11-25
Posts: 1,091

Re: Calling all MailChimp users

Bloke wrote #286425:

Would you be interested in trying a beta plugin for allowing visitors to very easily subscribe / unsubscribe from your lists, that gives you virtually unlimited control over the signup process?

Count me in.
I use Mailchimp and I’m fed up with their signup form. I would like some more control of the styling.

Offline

#9 2016-05-18 09:08:42

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: Calling all MailChimp users

Hi Stef,

MailChimp has reared is cartoon head in connection with one of my exisiting client websites.

I have some existing online contact forms which collect a tick/no-tick from the users about their mailing list preference. The contact form emails, sent to the client, are effectively manually trawled to pull out the opted-in email addresses.

Would your plugin enable me to turn that exisiting checkbox into a secret “subscribe” directive to MailChimp? And then expect MailChimp to do the “welcome-did-you-really-subscribe” handshake email with the user.

Adi

Offline

#10 2016-05-18 10:16:39

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

Re: Calling all MailChimp users

gomedia wrote #299137:

Would your plugin enable me to turn that exisiting checkbox into a secret “subscribe” directive to MailChimp? And then expect MailChimp to do the “welcome-did-you-really-subscribe” handshake email with the user.

Yep. Just make a zem_contact form as usual and set it to subscribe to your existing list. Through judicial use of the callback signals (return codes sent from the MailChimp module back to ZCR) you can either get it to continue mailing out as normal, or — as is the default with the module — just fire the data at MailChimp and quit. As long as your MailChimp is set to deliver welcome messages on successful subscription, it’s game on.

I’ll send you the plugin. Shout if you need anything doing to it, or feel free to hack away and improve it!


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#11 2016-05-23 02:27:13

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: Calling all MailChimp users

Before I get too hopeful … the plugin help has a link to the MailChimp API docs – these are for API v2.0, but there’s a message on this page:

MailChimp API v3.0 is now live!
Prior versions will no longer be supported after 2016, so all API users should begin transitioning to v3.0.
Check out the API v3.0 Documentation for more details.

Will there still be a happy smd_mailchimp’s tea party next year?

Offline

#12 2016-05-23 06:27:40

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,075
Website Mastodon

Re: Calling all MailChimp users

i am intrigued with the integration of mailchimp api and txp.


…. texted postive

Offline

Board footer

Powered by FluxBB