简体   繁体   中英

Mailchimp Error: -100 when using node-mailchimp API in a Meteor app

I am trying to use meteor-mailchimp which in turn uses node-mailchimp to subcribe an email to a mailing list

but when I call lists/subscribe I keep getting a Error: -100 "You must specify a email"

apiKey = "234324234234324324234234"
listId = 
    id : "234234234"
email = -> 
    email: 'example@gmail.com'

MailChimpAPI = new MailChimp(
    apiKey
    version: '2.0'
)

MailChimpAPI.call "lists", "subscribe", listId, email, (error,data)->
    return

I am fairly certain it is the way I am formatting the email arguement passed to the api call but I can't figure it out how to do it correctly.

If i make it an object:

email = 
    email: example@gmail.com

it complains its not a function

when I make it a function that returns and object (as above) still no luck

Figured it out, and yes I am an idiot. All of the options must be passed as a single object, so the configuration and call needs to be:

options = 
    id : "234234234"
    email :
        email: 'example@gmail.com'

MailChimpAPI.call "lists", "subscribe", options (error,data)->
    return

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM