Giter VIP home page Giter VIP logo

serverless-simple-sms's Introduction

Serverless Simple SMS

Serverless service to send single SMS to the given phone number using Amazon SNS Transactional SMS service through just a POST request.

Installation

  1. Run serverless install --url https://github.com/svtek/serverless-simple-sms to install the service in your current working directory
  2. Next up cd into the service with cd serverless-simple-sms
  3. Ensure you have set up required credentials as described here
  4. mvn install
  5. mvn package
  6. Deploy with serverless deploy. You will see the service information displayed and end-point in it.

Note: Change deployment bucket.

Usage

  • POST https://******.execute-api.us-east-1.amazonaws.com/production/sms_aws with following body (senderId and smsType are optional and default values of them are set below):
    {
    	"message": "enter text message here",
    	"phoneNumber": "+905391234567",
    	"senderId": "svtek",
    	"smsType": "Transactional"
    }
  • curl -X POST https://******.execute-api.us-east-1.amazonaws.com/production/send --data '{ "message": "enter text message here", "phoneNumber": "+905391234567", }'

Details

phoneNumber

When you send an SMS message, specify the phone number using the E.164 format. E.164 is a standard for the phone number structure used for international telecommunication. Phone numbers that follow this format can have a maximum of 15 digits, and they are prefixed with the plus character (+) and the country code. For example, a U.S. phone number in E.164 format would appear as +1XXX5550100.

message

Each SMS message can contain up to 140 bytes, and the character limit depends on the encoding scheme. For example, an SMS message can contain:

160 GSM characters 140 ASCII characters 70 UCS-2 characters If you publish a message that exceeds the size limit, Amazon SNS sends it as multiple messages, each fitting within the size limit. Messages are not cut off in the middle of a word but on whole-word boundaries. The total size limit for a single SMS publish action is 1600 bytes.

messageType

(Optional ,default="Transactional") You may set one of the following:

  • Promotional – Noncritical messages, such as marketing messages. Amazon SNS optimizes the message delivery to incur the lowest cost.
  • Transactional – (default) Critical messages that support customer transactions, such as one-time passcodes for multi-factor authentication. Amazon SNS optimizes the message delivery to achieve the highest reliability.

senderId

(Optional, default="svtek") For Sender ID, type a custom ID that contains up to 11 alphanumeric characters, including at least one letter and no spaces. The sender ID is displayed as the message sender on the receiving device. For example, you can use your business brand to make the message source easier to recognize.

Support for sender IDs varies by country. For example, messages delivered to U.S. phone numbers will not display the sender ID. For the countries that support sender IDs, see Supported Regions and Countries.

AWS services used

  • Lambda
  • API Gateway
  • SNS

Developed by

serverless-simple-sms's People

Contributors

adamdilek avatar mrsfy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

dmichelena

serverless-simple-sms's Issues

Acess Denied in deploy to lambda

Please can not I do the deploy so the lambda can help me?

C:\Users\Luciano Viana\serverless-simple-sms>serverless deploy
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command create
Serverless: Load command install
Serverless: Load command package
Serverless: Load command deploy
Serverless: Load command deploy:function
Serverless: Load command deploy:list
Serverless: Load command deploy:list:functions
Serverless: Load command invoke
Serverless: Load command invoke:local
Serverless: Load command info
Serverless: Load command logs
Serverless: Load command login
Serverless: Load command logout
Serverless: Load command metrics
Serverless: Load command print
Serverless: Load command remove
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command slstats
Serverless: Load command plugin
Serverless: Load command plugin
Serverless: Load command plugin:install
Serverless: Load command plugin
Serverless: Load command plugin:uninstall
Serverless: Load command plugin
Serverless: Load command plugin:list
Serverless: Load command plugin
Serverless: Load command plugin:search
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Invoke deploy
Serverless: Invoke package
Serverless: Invoke aws:common:validate
Serverless: Invoke aws:common:cleanupTempDir
Serverless: Packaging service...
Serverless: Invoke aws:package:finalize
Serverless: Invoke aws:common:moveArtifactsToPackage
Serverless: Invoke aws:common:validate

Serverless Error ---------------------------------------

Could not locate deployment bucket. Error: Access Denied

Stack Trace --------------------------------------------

ServerlessError: Could not locate deployment bucket. Error: Access Denied
at BbPromise.resolve.then.then.catch.err (C:\Users\Luciano Viana\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\deploy\lib\existsDeploymentBucket.js:26:15)
From previous event:
at AwsDeploy.existsDeploymentBucket (C:\Users\Luciano Viana\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\deploy\lib\existsDeploymentBucket.js:25:13)
at AwsDeploy.BbPromise.bind.then.then (C:\Users\Luciano Viana\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\deploy\index.js:75:25)
From previous event:
at Object.before:deploy:deploy [as hook] (C:\Users\Luciano Viana\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\deploy\index.js:72:10)
at BbPromise.reduce (C:\Users\Luciano Viana\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:390:55)
From previous event:
at PluginManager.invoke (C:\Users\Luciano Viana\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:390:22)
at PluginManager.run (C:\Users\Luciano Viana\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:421:17)
at variables.populateService.then.then (C:\Users\Luciano Viana\AppData\Roaming\npm\node_modules\serverless\lib\Serverless.js:157:33)
at runCallback (timers.js:810:20)
at tryOnImmediate (timers.js:768:5)
at processImmediate [as _immediateCallback] (timers.js:745:5)
From previous event:
at Serverless.run (C:\Users\Luciano Viana\AppData\Roaming\npm\node_modules\serverless\lib\Serverless.js:144:8)
at serverless.init.then (C:\Users\Luciano Viana\AppData\Roaming\npm\node_modules\serverless\bin\serverless:43:50)
at

Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com

Your Environment Information -----------------------------
OS: win32

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.