Home > Mobile >  How to send SMS using node.js
How to send SMS using node.js

Time:09-21

I want to make web app designed to send SMS via web interface. How can I send SMS (from my phone number) to specified recipient using node/express? Is twilio the only way?

CodePudding user response:

Sendgrid and twillio are the major two services to send SMS.

CodePudding user response:

Unless there are some very particular functionalities your mobile carrier is providing, there is nothing like send SMS (from my phone number) ... using node/express.

Only the phone that has your SIM installed within can send SMS from your number.

Possible solutions

  • If you are only interested in sending SMS from a web platform use a provider like Sendgrid and twillio
  • If you need to send SMS from a phone number assigned to a physical SIM owned by you, devices exists that can be connected to your server, will host your SIM, and allow you to send messages.
  • If you need to send SMS from your phone number (and be able to use your number at the same time) you may create a mobile app that regularly downloads updates from your server and send the listed messages.

CodePudding user response:

I have used Twilio to send a Programmable SMS, so little but knowing about the product, you can create a free trial account and try SMS feature of Twilio.

Answer to your this question -> How can I send SMS (from my phone number) to a specified recipient using node/express?

-->

you can procure the Twilio Number to send SMS / (for Inbound or Outbound calls). you need to just choose your favorite number from Twilio.

Node.js Code :

const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = require('twilio')(accountSid, authToken);

client.messages
.create({
      body: 'This is the ship that made the Kessel Run in fourteen 
      parsecs?',
 from: ' 15017122661',
 to: ' 15558675310'
 })
.then(message => console.log(message.sid)); 

you will find accountSid, authToken once you log in to Twilio.

here is the reference link: https://www.twilio.com/docs/sms/quickstart/node

Give your first ever try with Twilio. Enjoy :)

  • Related