Skip to content

Instantly share code, notes, and snippets.

@dguo
Created August 16, 2020 14:20
Show Gist options
  • Save dguo/a0b56855f7d2b9e4d37ab8c29a4f7668 to your computer and use it in GitHub Desktop.
Save dguo/a0b56855f7d2b9e4d37ab8c29a4f7668 to your computer and use it in GitHub Desktop.
blog - Morning Joy - twilio-sms
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