2

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?

Yeseop
  • 21
  • 2
  • Have you added the `params`? This is directly from the gibbon [GIT](https://github.com/amro/gibbon): `gibbon.lists(list_id).members.retrieve(params: {"count": "50", "offset": "50", "status": "subscribed"})` – scoopzilla Jan 31 '17 at 19:02
  • Yes I have tried that as well. Though, the data I get is wrapped in `#".....", "email_address"=>"......", ..., "status"=>"subscribed"` But then I want to get the `subscribed` as a return. how should I do it?... @scoopzilla – Yeseop Feb 02 '17 at 03:09
  • That's the response from the API? Then the member is subscribed. – scoopzilla Feb 02 '17 at 16:28
  • @scoopzilla Yea... I know it but I want to make rails judge it by itself. And as far as I understood, to do that I need to get the `status` value as mere return of `subscribed` or `unsubscribed`. The problem is that I don't know how to access the `status` value within the `# – Yeseop Feb 03 '17 at 03:27
  • Damn, that was exactly what I was looking for. Has anyone figured it out? – Olivier Girardot Feb 03 '21 at 15:00

1 Answers1

0

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.

Olivier Girardot
  • 389
  • 4
  • 16