Last active
March 15, 2019 17:25
-
-
Save thinkingserious/6988c6eca7e09ddb4390646f34a572bf to your computer and use it in GitHub Desktop.
A Twilio Function using Twilio SendGrid to forward information from an SMS to an Email
This file contains hidden or 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
exports.handler = function(context, event, callback) { | |
const sgMail = require('@sendgrid/mail'); | |
sgMail.setApiKey(process.env.SENDGRID_API_KEY); | |
msgBody = 'We just received a donation from ' + String(event.donation_from); | |
const msg = { | |
to: '[email protected]', | |
from: '[email protected]', | |
subject: 'Audrey just received a donation!', | |
text: msgBody, | |
html: '<strong>' + msgBody + '</strong>', | |
}; | |
sgMail.send(msg); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment