Reputation: 1263
Scenario :
Currently my function resembles:
exports.addSubscriber = functions.https.onRequest((req, res) => {
const Mailchimp = require('mailchimp-api-v3')
const mailchimp = new Mailchimp('MY_API_KEY');
mailchimp.post('/lists/'MY_LIST_ID'/members', {
"email_address": '[email protected]',
"status": 'pending'
}).then(function(results) {
console.log('added new user to mailchimp list');
})
.catch(function(err) {
console.log(err);
})
return null
});
Where am I going wrong?
Is there a simpler way to use the Mailchimp API with Javascript?
Upvotes: 0
Views: 761
Reputation: 57
Try to run
npm install mailchimp-api-v3 --save
It seams the above package is missing.
Upvotes: 1