Created
April 6, 2022 06:28
-
-
Save alanboy/61f4a03c4d0b0abe43616e65f7541b63 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { mailGenerator } = require('./mail'); | |
const hubspot = require('./hubspot'); | |
const dateFormat = require('dateformat') | |
const DATE_FORMAT = "mmmm d, yyyy, h:MM TT" | |
const mailchimp = require('./mailchimp'); | |
require("dotenv").config() | |
var genearteKpiTable = async function() { | |
} | |
var start = module.exports.main = async function main(event, context, callback) { | |
//let mailchimp2 = await mailchimp.getDeals(); | |
//return; | |
let hubspotDeals = await hubspot.getDeals(); | |
var email = { | |
body: { | |
//name: 'Alan', | |
intro: 'This is the weekly update with the KPIs for DevMatch.', | |
// Call to Action | |
action: { | |
instructions: 'To get started with Mailgen, please click here:', | |
button: { | |
color: '#22BC66', // Optional action button color | |
text: 'Go to the full dashboard', | |
link: 'https://mailgen.js/confirm?s=d9729feb74992cc3482b350163a1a010' | |
} | |
}, | |
// Some Table | |
table: { | |
data: hubspotDeals , | |
columns: { | |
customWidth: { | |
//item: '20%', | |
//price: '15%' | |
}, | |
customAlignment: { | |
Name: 'left' | |
} | |
} | |
}, | |
outro: 'Thanks' | |
} | |
}; | |
// Generate an HTML email with the provided contents | |
var emailBody = mailGenerator.generate(email); | |
// Generate the plaintext version of the e-mail (for clients that do not support HTML) | |
var emailText = mailGenerator.generatePlaintext(email); | |
// Optionally, preview the generated HTML e-mail by writing it to a local file | |
require('fs').writeFileSync('preview.html', emailBody, 'utf8'); | |
return { statusCode: 202 } | |
} | |
start(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment