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

Attempting to submit to multiple lists #1

Open
jasondbchapman opened this issue Aug 7, 2017 · 2 comments
Open

Attempting to submit to multiple lists #1

jasondbchapman opened this issue Aug 7, 2017 · 2 comments

Comments

@jasondbchapman
Copy link

I am attempting to submit to multiple lists in my Mailchimp account and passing the List ID to my loopback model this way; however, it always will return to the defaultID I specify in my component-config-json. Any ideas on how to get around this?

Newsletter.js

`Newsletter.observe('before save', function mailChimp(ctx, next) {
console.log(ctx.instance)

Newsletter.app.MailChimp.subscribe({
  email : ctx.instance.email,
  id : ctx.instance.list,
  firstName : ctx.instance.name,
  lastName : 'the last name',
  merge_vars : {
    optin_ip : '192.168.0.1'
  }
})
  .then(function (res) {
    console.log('Result :',res);
    next()
  })
  .catch(function (err) {
  console.log('Error : ',err);
  next()
});`

component-config.json
{ "loopback-component-roles": { "mountPath": "/explorer" }, "loopback-component-explorer": { "mountPath": "/explorer" }, "loopback-component-mailchimp": { "connector": "loopback-connector-mailgun", "apikey": "*****************", "defaultListId": "***************", "defaults": { "double_optin": true } } }

@mbouclas
Copy link
Owner

mbouclas commented Aug 7, 2017

To do this, you need to go outside the component i'm afraid and use the mailchimp API here

@luncht1me
Copy link

luncht1me commented Dec 1, 2017

Is your ctx.instance.list just an array of list IDs? ? @jasondbchapman

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

3 participants