Forum

Thread tagged as: MailChimp

MailChimp form problem

Having some difficulty with the MailChimp add on. When submitting the form we get the success message but then seemingly nothing happens. The list value is set correctly (matching admin).

Debug:

Array
(
    [headers] => Array
        (
            [url] => https://us13.api.mailchimp.com/3.0/lists/0d6e53c6bc/members
            [content_type] => application/problem+json; charset=utf-8
            [http_code] => 400
            [header_size] => 417
            [request_size] => 443
            [filetime] => -1
            [ssl_verify_result] => 0
            [redirect_count] => 0
            [total_time] => 0.44537
            [namelookup_time] => 0.004284
            [connect_time] => 0.014694
            [pretransfer_time] => 0.055116
            [size_upload] => 108
            [size_download] => 177
            [speed_download] => 397
            [speed_upload] => 242
            [download_content_length] => 177
            [upload_content_length] => 108
            [starttransfer_time] => 0.445257
            [redirect_time] => 0
            [redirect_url] => 
            [primary_ip] => 23.214.44.243
            [certinfo] => Array
                (
                )

            [primary_port] => 443
            [local_ip] => 77.72.0.66
            [local_port] => 34610
            [request_header] => POST /3.0/lists/0d6e53c6bc/members HTTP/1.0
User-Agent: DrewM/MailChimp-API/3.0 (github.com/drewm/mailchimp-api)
Host: us13.api.mailchimp.com
Accept-Encoding: deflate, gzip
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Authorization: apikey 200b8eb28fea8ad0941fea2dcef7864f-us13
Content-Length: 108


        )

    [body] => {"type":"https://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/","title":"Member Exists","status":400,"detail":" is already a list member. Use PUT to insert or update list members.","instance":""}
)

There's a message there which suggests to me I'm trying to add an email address which already exists on the list but I get this no matter what email I use.

Template

<perch:form id="subscribe" class="xnewsletter" app="perch_mailchimp" double-optin="true">
    <perch:success>
        <p>Thank you!</p>
    </perch:success>
    <div>
        <perch:label for="email">Email</perch:label>
        <perch:input id="email" required="true" type="email" mailer="email" />
        <perch:error type="required" for="email">Required</perch:error>
    </div>
    <div>
        <perch:label for="firstname">First name</perch:label>
        <perch:input id="firstname" required="true" type="text" mailer="FNAME" />
        <perch:error type="required" for="firstname">Required</perch:error>
    </div>
    <div>
        <perch:label for="lastname">Last name</perch:label>
        <perch:input id="lastname" required="true" type="text" mailer="LNAME" />
        <perch:error type="required" for="lastname">Required</perch:error>
    </div>
    <div>
        <perch:input type="submit" value="Submit" id="btnsubmit" />
        <perch:input type="hidden" value="1" id="confirm" mailer="confirm_subscribe" />
        <perch:input type="hidden" id="list" value="0d6e53c6bc" mailer="list" />
    </div>  
</perch:form>
Stephen Turvey

Stephen Turvey 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you see anything about it in your MailChimp account?

I'm not sure if there's a specific place to look for that but I've browsed around my account and there's no obvious warning message or anything.

Drew McLellan

Drew McLellan 2638 points
Perch Support

On the page with your API keys there's a log of all API interactions.

Yes - they are listed there as failed results. No new information that wasn't in the debug though.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Does it list the detail of the request?

You should reset your API key now that you've posted it publicly - you're giving everyone access to your account.

Yes, I already disabled that one.

This is all the info it gives:

2016-05-23 17:28:28 GMT     nope    XX.XX.X.XX  POST /lists/.../members/    php 0.018s  DrewM/MailChimp-API/3.0 (githu  3.0 is already a list member. Use PUT to insert or update list members.

"nope" referes to Throttled?, think the others are self explanatory.

Update: I used a friend's email address and that one went through fine. It's strange, almost like it was remembering email addresses I'd used to test previously even though I'd deleted them from the list.

Another error has cropped up now though, I edited the template from the default to what I want to use and I get:

Array
(
    [headers] => Array
        (
            [url] => https://us13.api.mailchimp.com/3.0/lists/0d6e53c6bc/members
            [content_type] => application/problem+json; charset=utf-8
            [http_code] => 400
            [header_size] => 417
            [request_size] => 414
            [filetime] => -1
            [ssl_verify_result] => 0
            [redirect_count] => 0
            [total_time] => 0.228239
            [namelookup_time] => 0.004313
            [connect_time] => 0.01485
            [pretransfer_time] => 0.064633
            [size_upload] => 80
            [size_download] => 253
            [speed_download] => 1108
            [speed_upload] => 350
            [download_content_length] => 253
            [upload_content_length] => 80
            [starttransfer_time] => 0.228028
            [redirect_time] => 0
            [redirect_url] => 
            [primary_ip] => 23.214.44.243
            [certinfo] => Array
                (
                )

            [primary_port] => 443
            [local_ip] => 77.72.0.66
            [local_port] => 41155
            [request_header] => POST /3.0/lists/0d6e53c6bc/members HTTP/1.0
User-Agent: DrewM/MailChimp-API/3.0 (github.com/drewm/mailchimp-api)
Host: us13.api.mailchimp.com
Accept-Encoding: deflate, gzip
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Authorization: apikey xxx
Content-Length: 80


        )

    [body] => {"type":"https://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/","title":"Invalid Resource","status":400,"detail":"The resource submitted could not be validated. For field-specific details, see the 'errors' array.","instance":"","errors":[{"field":"merge_fields","message":"Schema describes object, array found instead"}]}
)

Here's the new template:

<perch:form id="subscribe" class="newsletter mb-30" app="perch_mailchimp">

    <perch:success>
        <p>Thank you! You are now subscribed.</p>
    </perch:success>

    <perch:input id="email" required="true" type="text" mailer="email" class="mr-5" placeholder="Email" /> <perch:input type="submit" value="Submit" id="btnsubmit" class="btn" />

    <perch:error type="required" for="email">Required</perch:error>

    <perch:input type="hidden" value="1" id="confirm" mailer="confirm_subscribe" />
    <perch:input type="hidden" id="list" value="0d6e53c6bc" mailer="list" />

</perch:form>
Drew McLellan

Drew McLellan 2638 points
Perch Support

Am I reading that wrong, or is it saying:

DrewM/MailChimp-API/3.0 (githu  3.0 is already a list member

as in, rather than getting the email address it's somehow taking the user agent string as an email address?

It's just how it pasted in. They are separate cells in a table so difficult to display nicely here. It goes:

User Agent: DrewM/MailChimp-API/3.0 (githu

Ver: 3.0

Response: is already a list member.

Not sure if you missed my update above?

Drew McLellan

Drew McLellan 2638 points
Perch Support

I did miss it, sorry.

MailChimp does remember old addresses - it's so that you don't accidentally resubscribe someone who has opted out of receiving your mailings.

There'll be an update out tomorrow with a fix for your new issue - that's just a bug.

Ok thanks. Will that appear in the change log on this page when ready?

https://grabaperch.com/add-ons/apps/mailchimp

Drew McLellan

Drew McLellan 2638 points
Perch Support

It will. I'm just preparing it now.

Thanks, looks like that's worked.