Created
February 19, 2021 03:34
-
-
Save jlengstorf/470c02e1909e5c473ba7400935ee51c2 to your computer and use it in GitHub Desktop.
An example of a serverless function that sends an SMS message using Twilio (deployable to Netlify Functions).
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
const accountSid = process.env.TWILIO_ACCOUNT_SID; | |
const authToken = process.env.TWILIO_AUTH_TOKEN; | |
const client = require('twilio')(accountSid, authToken); | |
exports.handler = async () => { | |
const response = await client.messages.create({ | |
// RIP Mitch Hedberg | |
body: 'Is a hippopotamus a hippopotamus... or a really cool opotamus?', | |
from: '+15552888588', | |
to: '+15558675309', | |
}); | |
return { | |
statusCode: 200, | |
body: JSON.stringify(response), | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment