Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add a user to a specific group while subscribing to a list #91

Closed
mohitjain opened this issue Jul 18, 2014 · 2 comments
Closed

Comments

@mohitjain
Copy link

I am running this on console and its adding user in my subscribed_list. Works like charm.

  gb.lists.subscribe({:id => list_id, :email => {:email => 'mohit.jain@example.com'}, :merge_vars => {:FNAME => 'Mohit', :LNAME => 'Jain', }, :double_optin => false})

Now I want to subscriber to groups: Like I have a group " User Type" which has some predefined 4 values. How can I map this User Type in subscribe method?

@mohitjain mohitjain changed the title How to subscribe a user to a specific group while adding a list How to subscribe a user to a specific group while adding in a list Jul 18, 2014
@mohitjain mohitjain changed the title How to subscribe a user to a specific group while adding in a list How to add a user to a specific group while subscribing to a list Jul 18, 2014
@amro
Copy link
Owner

amro commented Jul 18, 2014

Hi Mohit,

The hash you pass to Gibbon maps exactly onto what MailChimp requires so if you simply follow their documentation you'll be in good shape. In this case, you need to look at lists/subscribe.

Your example might look something like:

gb.lists.subscribe({:id => list_id, :email => {:email => 'mohit.jain@example.com'}, :merge_vars => {:FNAME => 'Mohit', :LNAME => 'Jain', :groupings => [{:name => "user_type", :groups => ["admin"]}]}, :double_optin => false})

I've not tested this code so there might be a minor thing to tweak here and there but it should get you closer.

@mohitjain
Copy link
Author

Yupp. This worked :) Will send you a pull request with updated readme soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants