-
Notifications
You must be signed in to change notification settings - Fork 0
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
Autopost to new newsletter's mailchimp which has id 243735091b #5
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const Mailchimp = require('mailchimp-api-v3') | ||
|
||
const mailchimp = new Mailchimp(process.env.MAILCHIMP_API_KEY); | ||
|
||
module.exports.postToMailchimp = function(userInformation) { | ||
console.log('Posting to mailchimp') | ||
return mailchimp.post('/lists/243735091b/members', { | ||
email_address: userInformation.email, | ||
status: 'subscribed', | ||
merge_fields: { | ||
MMERGE3: userInformation.company_name, | ||
MMERGE6: userInformation.name | ||
} | ||
}) | ||
.catch(err => { | ||
console.log('Error adding user to mailchimp') | ||
console.log(params) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. feel like we should probably use console.error here, and also is |
||
console.log(err) | ||
}) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
const Team = require("../models/team"); | ||
const qs = require("querystring"); | ||
const invite = require("../buttons/invite"); | ||
const postToMailchimp = require('../commands/addToMailchimp').postToMailchimp | ||
|
||
const CHANNEL = process.env.SIGNUP_CHANNEL || "admin-signups"; | ||
|
||
|
@@ -26,6 +27,9 @@ function signup(req, res, next) { | |
console.log(params); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looks like this was here already, but do we want to leave it? is it necessary i mean? typically logs like this should be removed before merging |
||
|
||
postToSlack(params) | ||
.then(() => { | ||
postToMailchimp(params); | ||
}) | ||
.then(() => { | ||
if (!params.redirect_uri) { | ||
res.send(200, "signup request sent"); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
entirely style related comment, feel free to ignore, but i think it's generally better to do something like: