An API to send SMS to any cellphone, this application also stores a record of the sent SMS in a dynamodDB table.
This project uses the AWS SNS SMS publishing functionality.
You can find a full explanation of this project on this medium post.
- NPM, accessible through your CLI console.
- Serverless Framework, installed globally and accessible through your CLI console.
- AWS, an AWS account, and a IAM User with the credentials configured in your CLI console.
- An AWS lambda execution role, with the following permissions:
- AWS SNS access
- AWS DynamoDB access
- (optional) Cloudwatch Logs creation
- Install the required NPM packages
$ npm i
- Copy the
serverless.dist.yml
to a newserverless.yml
file, update the data to match your AWS account. - Run Serverless to deploy the serverless components
$ sls deploy
After your serverless stack is deployed, copy the URL with the endpoint and do a POST request. Sending a JSON with the phone number and the message you want to send to /sendMessage
:
{
"phoneNumber": "+31612345678",
"message": "Hello World!"
}
To retrieve the log of sent messages, make a GET request to the /history
endpoint passing a phoneNumber
query string / parameter and the number you want to query.
You can unit test this application by using:
$ npm test