DEV Community

Cover image for Setup Mobile OTP using AWS
Ali Abbas
Ali Abbas

Posted on

8 2

Setup Mobile OTP using AWS

Recently I was working on a project where I had to integrate an OTP System with Transactional SMS.

I used the Amazon (AWS) SNS (Simple Notification Service) for sending SMS and implemented the API using Express.js (Node.js)

Checkout the project here

AWS-SNS-SMS-OTP API in NodeJS (Express.js)

Setup

  • Create an account on AWS
  • Navigate to SNS
  • Create Security Credentials
  • Apply for Extension in Message Limit by contacting customer support in case the OTP fails

API Endpoint

GET Request to / route with following paramaters in the GET Request

  • message String
  • number String
  • subject String

Instructions

Send a GET Request from browser,

http://localhost:3000/?message=[Message]&number=[Number]&subject=[Subject]

After triggering the API, you will receive the OTP.

OTP from AWS SNS API Nodejs

The mobile number should be E.164 format but without the + character.

Example:

You want to send a message to a number,

The country code is 44

The mobile number is (0)7700 900123

The E.164 format would be +447700900123

Remove the + character

Then Visit

http://localhost:3000/?message=my message&number=447700900123&subject=My Subject

Star the project

SurveyJS custom survey software

Build Your Own Forms without Manual Coding

SurveyJS UI libraries let you build a JSON-based form management system that integrates with any backend, giving you full control over your data with no user limits. Includes support for custom question types, skip logic, an integrated CSS editor, PDF export, real-time analytics, and more.

Learn more

Top comments (0)

SurveyJS custom survey software

Simplify data collection in your JS app with a fully integrated form management platform. Includes support for custom question types, skip logic, integrated CCS editor, PDF export, real-time analytics & more. Integrates with any backend system, giving you full control over your data and no user limits.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay