Search code examples
coldfusioncoldfusion-9mailchimp

Mailchimp API listsubscribe() doesn't add subscriber to my list


I am implementing the Mailchimp API to my Coldfusion Project. I have performed all the steps that are required to add email to list.When I run the code it returns the message of true but when I look at my list there is no subscriber I found there? Below is my code

<cfhttp url="https://us5.api.mailchimp.com/1.3/" method="post"  >  

    <cfhttpparam name="output" value="json" type="url">
    <cfhttpparam name="method" value="listSubscribe" type="URL">
    <cfhttpparam name="apikey" value="3xxxxxxxx1e7a-us5" type="url">
    <cfhttpparam name="id" value="ccxxxx2b" type="url">
    <cfhttpparam name="email_address" value="test@hotmail.com" type="url">
    <cfhttpparam name="merge_vars[fname]" value="test" type="url">

</cfhttp>

<cfset result = JSStringFormat(cfhttp.filecontent)>
<cfdump var="#result#"> 

What is wrong in my code?


Solution

  • The answer to this question was already posted, but unfortunately with no attention, so I am re-posting it here to give you the solution.

    After reading the answer by @alexleonard I figured out the problem. The solution to your question is just add an extra <cfhttpparam after the param fname:

    <cfhttpparam name="double_optin" value="FALSE" type="url">
    

    Now check it works or not?