Skip to content

Instantly share code, notes, and snippets.

@thinkingserious
Last active March 15, 2019 17:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thinkingserious/6988c6eca7e09ddb4390646f34a572bf to your computer and use it in GitHub Desktop.
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
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: 'outgoing@example.com',
from: 'incoming@example.com',
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