dominicsayers / mailchimp_api_v3 Goto Github PK
View Code? Open in Web Editor NEWA simple gem to interact with Mailchimp through their API v3
License: Other
A simple gem to interact with Mailchimp through their API v3
License: Other
Hi,
I've managed to create new member and add interest group, also update mail/name etc. via API, but I have no clue how to update interest group.
I've tried
student.interests["b945c0efaa"=>true]
also I've tried to create new hash and update like
student.interests.update(new_hash) yet no success.
Thank you
Petr R.
Tried to use the gem standalone on ruby 2.2.5p319
and it raises that when building the payload.
Hi
The new mailchimp member create API is added marketing_permissions params for GDPR.
http://developer.mailchimp.com/documentation/mailchimp/reference/lists/members/#%20
But I think there is no option yet to set this options.
The default params is like this:
"marketing_permissions": { "marketing_permission_id": "caa8dcb11e", "text": "Email", "enabled": false }
I would like to set "enabled": true
.
How can I do it?
I have found an issue with the first_or_create
function. If the record doesn't exist, it is created. If the record does exist, it does not return it, but instead throws a Mailchimp::Exception::BadRequest
. Is that what should happen? ๐
...now we've moved this repo
I have realised this is a separate issue. I get a fatal error if I use first_or_create
in an 'each' block where the member already exists and has the status 'pending' in the MailChimp list.
NoMethodError (undefined method `casecmp' for {"e6037a062c"=>true, "a25411f7a5"=>false}:Hash):
app/services/mailchimp_members_service.rb:63:in `block in refer_members'
.
.
.
An exception should really be thrown, such as...
Mailchimp::Exception::Duplicate ([email protected] is already a list member. Use PUT to insert or update list members.):
.
.
.
Taking into account that...
@emails = ["[email protected]"]
ENV['MAILCHIMP_INTEREST_1ST'] = 'e6037a062c'
ENV['MAILCHIMP_INTEREST_2ND'] = 'a25411f7a5'
This is my code...
def refer_members
@emails.each do |email|
attributes = {
"email_address": email,
"status": "pending",
"interests": {
ENV['MAILCHIMP_INTEREST_1ST'] => true,
ENV['MAILCHIMP_INTEREST_2ND'] => false
}
}
MAILCHIMP.lists(ENV['MAILCHIMP_LIST_ID']).members.first_or_create(attributes)
end
end
Again, I have used a similar process as mentioned in the comment in issue #13 to check if the member already exists.
I have notice it for another block of code I have, where I create a member. I seems to relate to the inner hash of the attributes... I think. I want to check with you first if this is because of this gem, or if I need to report it to MailChimp themselves.
๐ฆ
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
This repository currently has no open or pending branches.
Gemfile
I know it is not an issue, but I hope you might have the time to help me. I am trying to catch the exception that the gem creates when something goes wrong. This is what I have in my controller...
class MembersController < ApplicationController
rescue_from Mailchimp::Exception, with: :error
def error
render json: {
:status => 'error',
:success => false,
:message => error.message,
:params => params.as_json
}, status: 500
end
end
Problem is, the JSON is not being rendered.
Rails: ~> 5.0.1 | Ruby: 2.3.3
It seem mailchimp api v3 has support batch operations:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.