veda-consulting/uk.co.vedaconsulting.mailchimp — pull request #85 by artfulrobot (2014-09-24 00:03:06+00:00)
Title: Reworked sync routines, new functionality as discussed.

OK, so it's a little way from finished, but give it a whirl, you might think it's worth it.

I've rewritten both sync routines. They each work by comparing the entire datasets and dealing with the discrepancies, as outlined in the googledoc (last page).

We now have a "list membership group" in Civi which is a group mapped to a list without any groupings that controls whether someone is subscribed or not. Then the interest grouping mapped groups are informational and the idea is that you can set some to be updatable from Mailchimp, and others not. See the end of that google doc for deets, but it's basically as discussed.

## I've tested the following:

* New member of a group (remember it has to be a membership group) gets added to Mailchimp
* Remove a member, they get removed from Mailchimp.
* Change the memberships of interest grouping groups in Civi' and this is updated in MC
* Change interest groupings in MC and they update in Civi
* Unsubscribe someone in MC and they'll be removed from the membership group
* Subscribe someone in MC and they'll be subscribed to the membership group (and added to any interest groupings, if needed).
* put an email on hold (etc etc) and it unsubscribes from MC.
* you get stats at the end of both syncs. Could be tweaked more, but it gives you an idea that it's worked.

## Yet to do/test.

* I have not fully implemented the allow/disallow MC to update Civi group membership per grouping. This should be fairly trivial, but I ran out of time
* I have not yet implemeted the 'normal/force' sync to MC options. Currently it's a bit of a hybrid: unsubscribe is implemented as delete but add a MC subscriber does not try to delete them if they're unsubscribed.
* checking for and reporting of errors from MC API calls.
* **Webhooks**. I haven't touched them apart from removing the deletion bit (need to check that wrt the bug report), but webhooks need attn. I think the two syncs are good functionality for now.
* When setting up a group mapped to a list interest grouping It should default to not allow subscribers to update via MC - Deepak: you thought you'd fixed that but I couldn't see it working?
* When setting up a group mapped... it's important that the 2nd sync option does not allow the selection of lists for which there is no membership group. This will cause confusion. Again, will be trivial to implement but I haven't had chance tonight.
* Multiple lists should work nicely, but I've not tested it.
* Not tested with any big lists wrt efficiency.