Skip to content

Instantly share code, notes, and snippets.

@iMichaelOwolabi
Last active March 31, 2020 22:22
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 iMichaelOwolabi/f53a941ab6c423ea84e6609331a040ba to your computer and use it in GitHub Desktop.
Save iMichaelOwolabi/f53a941ab6c423ea84e6609331a040ba to your computer and use it in GitHub Desktop.
require('dotenv').config();
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const sendSms = (phone, message) => {
const client = require('twilio')(accountSid, authToken);
client.messages
.create({
body: message,
from: process.env.TWILIO_PHONE_NUMBER,
to: phone
})
.then(message => console.log(message.sid));
}
module.exports = sendSms;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment