Created
March 17, 2018 20:30
-
-
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.
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
// 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