Skip to content

Instantly share code, notes, and snippets.

@amingilani
Created March 17, 2018 20:30
Show Gist options
  • Save amingilani/e015ab9b7f4718627b958691f09115ae to your computer and use it in GitHub Desktop.
Save amingilani/e015ab9b7f4718627b958691f09115ae to your computer and use it in GitHub Desktop.
Quick script to send a group of people a message through Twilio. I needed this for a workshop I was conducting, and thought I might need it in the future.
// Edit these!
const accountSid = '';
const authToken = '';
const numbers = [];
const message = "";
// script to send the message
const client = require('twilio')(accountSid, authToken);
const sendMessage = (to, body) => {
client
.messages
.create({
to,
body,
})
.then(message => console.log(`Message sent to ${message.to}`))
.catch(message => console.error(`Message NOT sent to ${message.to}`))
}
for (const number of numbers) {
sendMessage(number, message)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment