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?
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.
Sendgrid
and twillio
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:)
Sendgrid
and twillio
are the major two services to send SMS.
Twilio is not the only way, You can also use services like messente and plivo. both services provide an API which can be integrated into your code base (node/express), and it is preferable to handle this functionality using the superface sdk (it is easy to use and integrate multiple providers with much less code). follow the two steps below
npm install @superfaceai/one-sdk
npx @superfaceai/cli install communication/send-sms
const { SuperfaceClient } = require('@superfaceai/one-sdk'); const sdk = new SuperfaceClient(); async function run() { // Load the installed profile const profile = await sdk.getProfile('communication/send-sms'); // Use the profile const result = await profile.getUseCase('SendMessage').perform({ to: '+12127290149', from: '+4915207955279', text: 'Your order is ready to be picked up;' }). return result;unwrap(); } run();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.