DEV Community

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

Posted on

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

Oldest comments (0)