hacknight
hacknight copied to clipboard
Mailchimp sync
Mailchimp is a popular tool for sending mass email. Hacknight should sync participant lists with Mailchimp. There is some working code for this in the doctypehtml5 codebase.
The sync is simple, but has a few subtleties to watch out for.
- Make a separate table that has a 1:1 relationship with Event. This stores sync data for the events where the owner has chosen to setup sync.
- You'll have to store the Mailchimp API key, list id and optionally, a list group, in case the db has to be synced to a single group instead of the whole list.
- A Mailchimp list has one mandatory column,
EMAIL, and optional columns for everything else. A list will haveFNAMEandLNAMEby default, for first and last name, but in HasGeek's use case we remove that and useFULLNAMEinstead. You will have to save this mapping information that connects data from the User and Participant models with Mailchimp columns. The main things to sync: user's name, email address, participation status. If a list hasFNAMEandLNAME, just dofname, lname = User.fullname.split(' ', 1) - Store a
syncflag on theParticipantmodel. If a user unsubscribes from the list, they should not be re-subscribed again. Use thesyncflag to check if their data needs to be copied to Mailchimp.