Slide 29
Slide 29 text
Create Serverless (Send Email)
const sgMail = require('@sendgrid/mail');
module.exports.run = async event => {
try {
let {
table: { name: table_name, schema },
event: {
data: {
new: { to, from, subject, content: html, id },
},
},
} = JSON.parse(event.body);
sgMail.setApiKey(process.env.SENDGRID_API_KEY);