https://github.com/marteinn/sms-server-remote
Trigger fabric tasks on your server through SMS and AWS Lambda.
https://github.com/marteinn/sms-server-remote
lambda serverless twilio
Last synced: about 1 year ago
JSON representation
Trigger fabric tasks on your server through SMS and AWS Lambda.
- Host: GitHub
- URL: https://github.com/marteinn/sms-server-remote
- Owner: marteinn
- License: mit
- Created: 2016-07-09T01:37:53.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-07-09T14:28:10.000Z (over 9 years ago)
- Last Synced: 2025-01-22T14:24:51.499Z (about 1 year ago)
- Topics: lambda, serverless, twilio
- Language: Python
- Homepage:
- Size: 13.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SMS-Server-Remote
This is a experiment based on [Twilio](https://twilio.com) and [Serverless](http://serverless.com) that lets you trigger fabric tasks on your server through SMS.
## Getting started
- [Install serverless](: `npm install serverless -g`)
- Setup project on AWS (just follow the serverless instructions)
- Update dependencies: `make update_dependencies`
- Write your own fabfile and server handling, store it in `src/incoming/sms/config` (I have included a example for clarification)
- Deploy the function and endpoint `incoming_sms`
- Create a Twilio TwiML app that handles SMS messaging, use your lambda endpoint as request url with HTTP GET
## Usage
- Send a SMS with your fabric command to your Twilio phone number (example: `prod restart_apache`)
- Sends back something like this:
```
service apache restart
restarting apache..
restart complete!
```
- _Please note: Fabric taks that takes longer then 15 seconds are not sent back to Twilio (due to Twilio timeout limitations)_
## Endpoints: incoming_sms
The endpoint incoming_sms requires the following params:
- `Body` (SMS message body delivered from Twilio)
- `From` (Phone number delivered from Twilio)
- `secret` (A simple auth token)
Example:
```
curl -X "GET" "https://XXXXX.execute-api.eu-west-1.amazonaws.com/stage/incoming_sms?Body=mp%20info&From=%2B46000000&secret=myscret"
```
Returns:
```
```
## Git hooks
### Bump version
These hooks will automatically bump the application version when using `git flow release ...`
```
chmod +x $PWD/git-hooks/bump-version.sh
ln -nfs $PWD/git-hooks/bump-version.sh .git/hooks/post-flow-release-start
ln -nfs $PWD/git-hooks/bump-version.sh .git/hooks/post-flow-hotfix-start
```
## Commands
- Deploy function: `npm run serverless function deploy -a`
- Deploy endpoint: `npm run serverless endpoint deploy -a`
- Deploy: `npm run serverless dash deploy`
## Dependencies
- https://github.com/Doerge/awslambda-pycrypto
### References
- http://docs.serverless.com/docs/templates-variables
- http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html
### Tutorials/Examples
- https://serverlesscode.com/post/python-on-serverless-intro/
- https://www.twilio.com/docs/quickstart/php/sms/hello-monkey
- https://github.com/mauerbac/lambda-gateway-twilio-demo/blob/master/lambda_function.py
- https://www.twilio.com/blog/2015/11/sending-selfies-without-servers-how-to-use-twilio-mms-amazon-lamba-and-amazons-gateway.html
## Contributing
Want to contribute? Awesome. Just send a pull request.
## License
sms-server-remote is released under the [MIT License](http://www.opensource.org/licenses/MIT).