Skip to main content

mailchimp@0.7.3

Functions

addMember(params, [callback])
archiveMember(params, [callback])
deleteMember(params, [callback])
get(path, query, [callback])
listAudienceInfo(query, [callback])
listAudiences(query, [callback])
listBatches(params, [callback])
listMembers(params, [callback])
post(path, body, query, [callback])
request(method, path, options, [callback])
startBatch(params, [callback])
tagMembers(params, [callback])
updateMember(params, [callback])
updateMemberTags(params, [callback])
upsertMembers(params, [callback])

The following functions are exported from the common adaptor:

alterState()
chunk()
dataPath()
dataValue()
each()
field()
fields()
fn()
lastReferenceValue()
merge()
sourceValue()

addMember

addMember(params, [callback]) ⇒ Operation

addMember to a list

ParamTypeDescription
paramsobjecta listId, and options
[callback]functionOptional callback to handle the response

archiveMember

archiveMember(params, [callback]) ⇒ Operation

archiveMember in a list

ParamTypeDescription
paramsobjecta listId, and options
[callback]functionOptional callback to handle the response

deleteMember

deleteMember(params, [callback]) ⇒ Operation

Permanently delete a member from a list

ParamTypeDescription
paramsobjecta listId, and options
[callback]functionOptional callback to handle the response

get

get(path, query, [callback]) ⇒ Operation

The get function is used to make a GET request to the Mailchimp API.

ParamTypeDescription
pathstringThe endpoint of the api to which the request should be made
queryobjectAn object containing query parameters to be included in the request
[callback]function(Optional) callback to handle the response

Example (Get a list of account exports for a given account)

get('/account-exports');

listAudienceInfo

listAudienceInfo(query, [callback]) ⇒ Operation

Get information about a specific list in your Mailchimp account. Results include list members who have signed up but haven't confirmed their subscription yet and unsubscribed or cleaned.

ParamTypeDescription
queryobjectlistId and query parameters
[callback]functionOptional callback to handle the response

listAudiences

listAudiences(query, [callback]) ⇒ Operation

Get information about all lists in the account.

ParamTypeDescription
queryobjectQuery parameters
[callback]functionOptional callback to handle the response

listBatches

listBatches(params, [callback]) ⇒ Operation

listBatches

ParamTypeDescription
paramsobjecta listId, and options
[callback]functionOptional callback to handle the response

listMembers

listMembers(params, [callback]) ⇒ Operation

listMembers

ParamTypeDescription
paramsobjecta listId, and options
[callback]functionOptional callback to handle the response

post

post(path, body, query, [callback]) ⇒ Operation

The post function is used to make a POST request to the Mailchimp API.

ParamTypeDescription
pathstringThe endpoint of the api to which the request should be made.
bodyobjectThe data to be sent in the body of the request
queryobjectAn object containing query parameters to be included in the request
[callback]function(Optional) callback to handle the response

Example (Create a new account export in your Mailchimp account)

post('/accounts-export', {include_stages:[]});

request

request(method, path, options, [callback]) ⇒ Operation

Make an HTTP request to Mailchimp API

ParamTypeDescription
methodstringThe HTTP method for the request (e.g., 'GET', 'POST', 'PUT', 'DELETE').
pathstringThe endpoint of the api to which the request should be made.
optionsObjectAdditional options for the request (query, body only).
[callback]function(Optional) callback function to handle the response.

Example (Get list to all other resources available in the API)

request('GET','/');

Example (Create a new account export in your Mailchimp account)

request('POST','/accounts-export', {include_stages:[]});

startBatch

startBatch(params, [callback]) ⇒ Operation

Start a batch with a list of operations.

ParamTypeDescription
paramsobjectoperations batch job
[callback]functionOptional callback to handle the response

Example

startBatch(params)

tagMembers

tagMembers(params, [callback]) ⇒ Operation

Tag members with a particular tag

ParamTypeDescription
paramsobjecta tagId, members, and a list
[callback]functionOptional callback to handle the response

Example

tagMembers((state) => ({
listId: "someId", // All Subscribers list
tagId: "someTag", // User tag
members: state.response.body.rows.map((u) => u.email),
}));

Example

tagMembers((state) => ({
listId: "someId",
tagId: "someTag",
members: state.response.body.rows
.filter((u) => u.allow_other_emails)
.map((u) => u.email),
}));

updateMember

updateMember(params, [callback]) ⇒ Operation

updateMember

ParamTypeDescription
paramsobjecta listId,subscriberHash and member
[callback]functionOptional callback to handle the response

updateMemberTags

updateMemberTags(params, [callback]) ⇒ Operation

updateMemberTags

ParamTypeDescription
paramsobjecta listId, and options
[callback]functionOptional callback to handle the response

upsertMembers

upsertMembers(params, [callback]) ⇒ Operation

Add or update a list members

ParamTypeDescription
paramsobjecta listId, users, and options
[callback]functionOptional callback to handle the response

Example

upsertMembers((state) => ({
listId: "someId",
users: state.response.body.rows.map((u) => ({
email: u.email,
status: u.allow_other_emails ? "subscribed" : "unsubscribed",
mergeFields: { FNAME: u.first_name, LNAME: u.last_name },
})),
}));