Skip to content

Instantly share code, notes, and snippets.

@designly1
Created May 10, 2022 22:48
Show Gist options
  • Save designly1/dd2afa89e4bffd4f90e1b5f062a69acb to your computer and use it in GitHub Desktop.
Save designly1/dd2afa89e4bffd4f90e1b5f062a69acb to your computer and use it in GitHub Desktop.
Node.JS Twilio SMS Example
/* Node.JS */
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; // Your Account SID from www.twilio.com/console
const authToken = 'your_auth_token'; // Your Auth Token from www.twilio.com/console
const twilio = require('twilio');
const client = new twilio(accountSid, authToken);
client.messages
.create({
messagingServiceSid: "YOUR_MESSAGING_SERVICE_ID",
body: 'Hello from Node',
to: '+12345678901', // Text this number
from: '+12345678901', // From a valid Twilio number
})
.then((message) => console.log(message.sid));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment