0

This is a strange one. I've had a working MailChimp, Gibbon, RoR app going for a couple of years now, and I went to go use part of my app this week and realized that the integration was no longer working. I am not receiving any errors, and some basic testing shows that the exception section of the code is never called.

Here is the code I am using:

begin
  gb = Gibbon::API.new(mailchimp_api_key)
  gb.lists.subscribe( id: mailchimp_list_id, email: {email: email} )
rescue Gibbon::MailChimpError => e
  logger.error "Mailchimp threw an error. The code is: #{e.code}, with message: #{e.message}"
end

Some code edited for readability, but assume that the variables are defined and no errors are thrown.

What I'm looking for is some debugging help. I can't seem to find a way to debug the integration to know if there is something silently failing or not. Does anyone have any tips for debugging this outside of trying to catch a raised exception?

2 Answers2

2

I use the same code and when something wrong an exception is thrown. You should check and print what subscribeis returning.

response = gb.lists.subscribe( id: mailchimp_list_id, email: {email: email} )
puts response

According to the mailchimp documentation it should return a JSON like this one :

{
    "email": "example email",
    "euid": "example euid",
    "leid": "example leid"
}

https://apidocs.mailchimp.com/api/2.0/lists/subscribe.php

Kaëris
  • 3,304
  • 2
  • 14
  • 17
0

Thanks!

And yep, I do get a response back that matches what you suggested (note, I used a real email address):

{
  "email"=>"my@email.com", 
  "euid"=>"3cb513752a", 
  "leid"=>"89681797"
}

Strangely enough, it does show up on the mailchimp side as pending subscription, but the subscription confirmation is not sending. That sounds like I have a MailChimp problem, not a gibbon problem. Does anyone know of a setting on the MailChimp side I am missing?

Will keep digging...

  • If your subscriber is signed up as pending, a confirmation email has been sent to them. If you're finding that's not the case (check the spam folder first, of course), you'll want to talk to support. – TooMuchPete Apr 26 '15 at 19:58
  • That's how it normally worked. But Mailchimp recently stopped sending those confirmation emails. It's very strange. – Branden Williams Apr 27 '15 at 21:10
  • They send fine from my account -- you'll want to talk to customer support. – TooMuchPete Apr 28 '15 at 16:36