Open ZenCocoon opened 6 years ago
Based on the version of SMS to Email with Sendgrid, here's a version with Mandrill.
const got = require('got'); exports.handler = function(context, event, callback) { const requestBody = { key: `${context.MANDRILL_API_KEY}`, message: { to: [{ email: context.TO_EMAIL_ADDRESS, type: 'to' }], from_email: context.FROM_EMAIL_ADDRESS, subject: `New SMS message from: ${event.From}`, text: event.Body } }; got .post('https://mandrillapp.com/api/1.0/messages/send.json', { headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(requestBody) }) .then(response => { let twiml = new Twilio.twiml.MessagingResponse(); callback(null, twiml); }) .catch(err => { callback(err); }); };
Hope this helps, Thanks
Based on the version of SMS to Email with Sendgrid, here's a version with Mandrill.
Hope this helps, Thanks