Giter Site home page Giter Site logo

artfulrobot / mailchimpsync Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 0.0 1013 KB

CiviCRM Extension providing Mailchimp Sync

License: Other

PHP 85.51% TSQL 1.73% Smarty 0.09% CSS 0.70% JavaScript 5.22% HTML 6.75%
mailchimp-sync civicrm-extension civicrm mailchimp

mailchimpsync's Introduction

mailchimpsync's People

Contributors

artfulrobot avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mailchimpsync's Issues

Show recent failures

The status says "in sync" despite there being people who can't be sync-ed. It's more that it's 'reconciled' rather than actually in sync.

Some failures are longstanding and uninteresting, e.g. the person who has 2 email addresses on one contact record, one email is unsubscribed at Mailchimp and the other is subscribed. They can safely be left as faliures.

But others might need investigation, especially when they're recent.

Showing a count per list of recent failures might help people who monitor these things iron out awkward cases.

Something like this:

select count(*) 
from civicrm_mailchimpsync_cache mc 
inner join civicrm_mailchimpsync_update u on mc.id = u.mailchimpsync_cache_id 
and u.error_response is not null and u.error_response != '' 
inner join civicrm_mailchimpsync_batch b on u.mailchimpsync_batch_id = b.id 
where b.completed_at >= CURRENT_TIMESTAMP - INTERVAL 1 WEEK;

status should be updated when an update completes

When a batch webhook result is processed it updates the cache table with status OK etc. but it does not update the table with mailchimp status and mailchimp updated date. This means the status display loses count of people - it says "ok" in the sync status yet it's in Civi but apparently not in Mailchimp.

I think the status should be updated.

Subscribe with email A, then gets cleaned, then resubscribe with B

  1. Subscribe with email A at Mailchimp, added to group in CiviCRM
  2. Mailchimp cleaned email A (CiviCRM marks that email on hold)
  3. Same Contact uses different email address and subscribes again.

Initial sync (or since=ever) will now fail because Mailchimp sees this as 2 people, so:

  1. While processing email A, sees that they unsubscribed at Mailchimp (the "cleaned"); removes from group in CiviCRM
  2. While processing email B, sees that they are (now) unsubscribed in CiviCRM, so plans to unsubscribe them.

Compliance state handling

There was a bug whereby:

  1. contact is subscribed/added in Mailchimp and Civi
  2. contact unsubscribes at Mailchimp by using an unsubscribe link in a mailchimp email.
  3. contact gets removed from group by webhook
  4. contact "rejoins" group - added again in CiviCRM.
  5. sync tries to subscribe, but this fails with a compliance state error. This causes another update to be created but not submitted which sets the status to 'pending'.
  6. sync runs again. Reprocesses the contact and creates a new update to subscribe them.
  7. when the updates are submitted, the first one (pending) works but the 2nd fails with another compliance state error, which generates another pending update(!)
  8. When sync next runs it sees 'pending' at mailchimp and 'added' in Civi, so it thinks it's in sync.
  9. This leaves an odd situation whereby there is a 'status:pending' update that is not submitted - and shouldn't be.

I'm documenting this here because it's a very tricky situation and there could be lots to complicate it further.

7d87183 added a failing test

Should not add deleted contacts into the cache

  • Address is known in Mailchimp as unsubscribed.
  • Contact is deleted in CiviCRM
  • Cache record has the Mailchimp unsubscribe in it, but it does not bother to create a contact in Civi (or match one) because there's no point.
  • Then Civi adds the contact in (it should not) because they're in the group; but because this is not tallied with the other cache record, the POST update fails.

Issues:

  • Civi should not be including deleted contacts.

Provide action to do a single sync for a contact and/or mark them as needing sync

Currently the incremental sync only works for contacts whose group membership has changed since 2 hours before the last sync.

It means if someone's group membership has not changed, but other data has (e.g. email taken off hold) then they never get included in sync again.

Providing a button on the contact record that could mark their cache record as todo would, I think, include them in the next sync run.

On hold emails getting added to Mailchimp

This is a tricky policy area.

I think that if an email is on hold in Civi then it should not cause a subscription at Mailchimp, but instead should put the sync into 'fail' status.

Intial list addition fails

Create account » Create batch webhook » Save

Create sync connection » Create webhook » Save - not saved!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.