Created
May 10, 2022 22:48
-
-
Save designly1/dd2afa89e4bffd4f90e1b5f062a69acb to your computer and use it in GitHub Desktop.
Node.JS Twilio SMS Example
This file contains 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
/* 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