top of page
Writer's pictureYuri Falcão

Sending SMS with JavaScript - NodeJS

Updated: Apr 11, 2023


Have you ever wondered how web and mobile apps send messages to your phone? It is one of the most important features for #cybersecurity and double factor #authentication, that validates users and protect your personal data.


The idea is to check not only if the user to log in knows the password but also to check if he is who he should be by verifying if he has a physical item (the phone) at the moment of login. This not only creates a second layer of certainty and protection but also demands more time and cuts some of the login bots that are set to infiltrate vulnerable #websites.


In this short tutorial we will learn how to send SMS messages with #nodejs and Twilio, one of the most used #microservices.


We won't be digging into the authentication protocols as there are many approaches, but we will learn how to implement in an efficient way the SMS message microservice that can be set in any situation.


(I am assuming the learner has VS Code, basic JavaScript and NodeJS/Express knowledge)


STEP 1:

The very first step is to create an account on Twilio and set up a mobile number (it needs to be loaded [paid] to be able to send SMS messages continuously: The local phone number has a monthly price of $1.00 and SMS text messages have a price of $0,0075 to send (prices in US dollars and without taxes).


I consider this a very reasonable price for small business and professionals that want to use a SMS messaging systems (even more when compared to the high prices of these services (combined with others) charged by WIX, Squarespace and others.


Since Twilio charges directly your Credit or Debit card, it is super recommended that you set a double factor authentication on their website to make any login on you account more secure.


STEP 2:

Now let's start setting the #webapplication itself. Check out the following video tutorial, the code is also available here.




STEP 3:

Now it is your time to shine! Ideas to apply this SMS messaging system: 2 factor authentication, confirmation of purchase via SMS, SMS alarm system for notifying crash and error events from the server (very useful when you want to monitor something even being out of your computer).


I applied this system in an Inventory Management and Reporting System for Patties Express (the best Patties in Toronto!), where the reports are stored in a #mongodb database and also sent to the management via SMS.


I hope this tutorial helps you! Don't forget to subscribe to stay tuned for more tutorials!









Comments


Post: Blog2_Post
bottom of page