I don't know if this is gem/api related question or implementation, but after deleting a member from a list, I can't add him again. I'm obtaining that
is already a list member. Use PUT to insert or update list members.
I am using the following methods to add members from a list:
class SubscribeToNewsletterService
def initialize(user)
@user = user
@gibbon = Gibbon::Request.new(api_key: ENV['MAILCHIMP_API_KEY'])
@list_id = ENV['MAILCHIMP_LIST_ID']
end
def call
@gibbon.lists(@list_id).members.create(
body: {
email_address: @user.email,
status: "subscribed",
merge_fields: {
FNAME: @user.first_name,
LNAME: @user.last_name,
}
}
)
end
end
Aucun commentaire:
Enregistrer un commentaire