ColdFusion wrapper for the MailChimp 3.0 API
This wrapper is a work in progress. I have prioritized building out the features needed for my projects. If there is a feature that you would like added, please open an issue or submit a pull request.
- getLists - Retrieves all lists in the account
- getList - Retrieves information about the specified list
- getListMembers - Retrieves a list of all members of the specified list
- getListMember - Retrieves details on a single member of the specified list
- putListMembers - Uses a batch operation to add or update multiple members of the specified list
- putListMember - Adds or updates a single member to the specified list
- getMemberIdFromEmail - Generates the member ID, the MD5 hash of the email address
- getGroups - Retrieves a list of all interest groups of the specified list
- getGroup - Retrieves details on a single interest group of the specified list
- getInterests - Retrieves a list of all interests in the specified group
- getInterest - Retrieves details on a single interest in the specified group
I have only tested on Adobe ColdFusion 11. I am confident that the wrapper will work in Lucee/Railo 4. It may work in ACF 10 and will NOT work in ACF 9-.
CF MailChimp uses the JSONUtil library for JSON serialization/deserialization instead of ColdFusion's built-in serializer. MailChimp's API will reject data being sent as a boolean or numeric value when it is expecting a string. CF's serializer frequently and silently converts variable types and cannot be controlled.
If you put JSONUtil.cfc in the same folder as mailchimp.cfc, it will be found automatically.
If you want to keep JSONUtil.cfc in a different folder, then add the argument jsonUtil to your init, and pass it the normal ColdFusion dot-delimited path to the component.
If JSONUtil.cfc cannot be found, CF MailChimp will fall back to using ColdFusion's built-in serializer.
Want to contribute to CF MailChimp? Awesome! See CONTRIBUTING for more information.
Please note that this project is released with a Contributor Code of Conduct to ensure that this project is a welcoming place for everyone to contribute to. By participating in this project you agree to abide by its terms.
mc = new mailchimp(
apiKey = "YOURAPIKEY", // see http://kb.mailchimp.com/accounts/management/about-api-keys
serviceURL = "https://us1.api.mailchimp.com/3.0/",
debug = true // note debug setting
);
lists = mc.getLists();
newMember = mc.putListMember(
listId = "YOURLISTID", // see http://kb.mailchimp.com/lists/managing-subscribers/find-your-list-id
data = {
"email_address" = "[email protected]",
"status" = "subscribed",
"merge_fields" = {
"FNAME" = "Hey",
"Now" = "Finley",
"COMPANY" = "Acme"
}
}
);
This project is based on previous work by others. See CONTRIBUTORS for details.
This repository is licensed under the GNU Lesser General Public License v2.1. See LICENSE for details.