How can I get direct access to body variable on Mailchimp, using Gibbon (rails wrapper)

170 Views Asked by At

We are trying to check if a specific member on a list is subscribed or unsubscribed. We tried

gibbon.lists(list_id).members(lower_case_md5_hashed_email_address).retrieve

This. Yet, the hash return of the code is wrapped with "Gibbon::Response". How can I get a direct access to the hash itself?? or is it even possible to get access to it?

1

There are 1 best solutions below

0
Olivier Girardot On

After looking for an answer to this question for a while, and not finding one, I just tested and played around with my code, to finally come up with the solution. It looks like this:

Gibbon::Request.lists(list_id).members(user_email).retrieve.body["status"]

In your case it would look like this:

gibbon.lists(list_id).members(lower_case_md5_hashed_email_address).retrieve.body["status"]

This also means that you can retrieve whatever information from the body. Like email_address , merge_fields, and so on.

Just to make it clear for others, list_idis your audience id that you can find in your mailchimp dashboard. It is basically a string of characters that was generated automatically, and that identify the mailing list you have created.

And the user_email is just the email address in quotes.