Created
August 16, 2020 14:20
-
-
Save dguo/a0b56855f7d2b9e4d37ab8c29a4f7668 to your computer and use it in GitHub Desktop.
blog - Morning Joy - twilio-sms
This file contains 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 twilio = require("twilio")( | |
process.env.TWILIO_ACCOUNT_SID, | |
process.env.TWILIO_AUTH_TOKEN | |
); | |
async function sendText(body, mediaUrl) { | |
const text = await twilio.messages.create({ | |
body, | |
mediaUrl: mediaUrl ? [mediaUrl] : [], | |
from: process.env.TWILIO_PHONE_NUMBER, | |
to: process.env.DESTINATION_PHONE_NUMBER | |
}); | |
return text; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment