Updated: New Version 0.99 - Still unfinished

Yes, it is still an unfinished version (v.0.99) I only implemented methods we actually needed for client work. If anything is missing and you add to it, please share with the rest of us.

Available Methods for interaction with Mailchimp API

  • isEmail
  • login (depricated in MCApi.1.2)
  • listBatchSubscribe
  • ListBatchUnsubscribe
  • listInterestGroupAdd
  • ListInterestGRoupDel
  • ListMemberinfo
  • ListMembers
  • lists
  • listInterestGroups
  • listSubscribe
  • listUnsubscribe
  • CampaignContent
  • campaigns
  • campaignStats
  • CampaignAbuseReports
  • CampaignClickStats
  • CampaignHardBounces
  • campaignSoftBounces
  • campaignUnsubscribes
  • CampaignEmailStatsAIMAll
  • createCampaign
  • listTemplates

Earlier this week a fellow programmer pointed out to me just how far behind the posted version of this CFC was, that I had to jump to action and share my updated version, that we us now since December 2010.

The 1.2 invocation code

I still need to read up about v1.3 changes of the API.
<cfset apiKey = "GetYourOwnAPIKey">
<cfset url= "http://#listlast(application.mc.apiKey, "-")#.api.mailchimp.com/1.2/">
<cfset output = "xml">
<cfset mp = createObject("component","components.mailchimp099").init(apiKey,url,output)>
You need to replace "GetYourOwnAPIKey" with your account's API Key. You'll find it on Mailchimp under Account Settings > APIKeys https://us1.admin.mailchimp.com/account/api

For a query recordset of all your lists:
<cfset qryMylists = mp.lists(apikey)>

For Groups of a specific list
<cfset interestgroups = mp.listInterestGroups(apikey,listid)>
   
<ul>
<cfloop from="1" to="#ArrayLen(interestgroups.groups)#" index="g">
   <cfoutput><li>#interestgroups.groups[g]#</li></cfoutput>
</cfloop>
</ul>

A set of Templates:
<cfset qryMyTemplates = mp.listTemplates(application.mc.apikey)>
These examples should get you started.

Feel free to email (bph@idxtools.org) me with suggestions, corrections and other comments. Or stop by our IDXTools blog and leave a comment.

You can also follow me on Twitter: @bph

Stay in touch!

Getting Started: How to call the test files in usable order.

Update start with test.cfm ------

  1. Get yourself an account with MailChimp.com
  2. Create a list at MailChimp.com
  3. add username & password to settings.cfm
  4. include settings.cfm in any test files you create as it provides the apikey for your other calls to the API. Later on I would store the API in a persistent scope or DB.
  5. Edit testBatchSubscriber.cfm and add subscribers to a list.
  6. Create a Campaign on MailChimp.com (the interface there is much richer than I could create here on the fly)
  7. Sent the campaign to your test list.

  8. Here is the list of dependencies of various test templates in cluded in the zip file:
    testLists.cfm
    links to testListMembers.cfm, which links to testMemberinfo.cfm

    testCampaign.cfm
    links to testCampaignStats.cfm (links to testStatsDetails.cfm) & testCampaignContent.cfm

BlogCFC was created by Raymond Camden. This blog is running version 5.5.006. | Protected by Akismet | Blog with WordPress