/verify

API to perform code verification by SMS

Primary LanguageTypeScriptMIT LicenseMIT

Serverless verify-code

This is an API to perform code verification by SMS.

Usage

Deployment

Install dependencies with:

npm install

and then deploy with:

serverless deploy

After running deploy, you should see output similar to:

Deploying aws-verify-api-project to stage dev (us-east-1)

✔ Service deployed to stack aws-node-express-dynamodb-api-project-dev (196s)

endpoint: ANY - https://xxxxxxxxxx.execute-api.us-east-1.amazonaws.com
functions:
  api: aws-verify-api-project-dev-api (766 kB)

Invocation

After successful deployment, you can verify one phone by calling the corresponding endpoint:

curl --request POST 'https://xxxxxx.execute-api.us-east-1.amazonaws.com/sms' --header 'Content-Type: application/json' --data-raw '{"phone": "+551122334455"}'

Which should result in the following response:

{"msg":"success"}

You can check a code by code by calling the following endpoint:

curl https://xxxxxxx.execute-api.us-east-1.amazonaws.com/sms/:code

If you try to check code that does not exist, you should receive the following response:

{"error":"Could not find code"}