Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pchinjr/sls-twilio
Serverless Framework example with Twilio
https://github.com/pchinjr/sls-twilio
Last synced: 4 months ago
JSON representation
Serverless Framework example with Twilio
- Host: GitHub
- URL: https://github.com/pchinjr/sls-twilio
- Owner: pchinjr
- Created: 2017-07-02T23:34:53.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-07-02T23:50:28.000Z (over 7 years ago)
- Last Synced: 2024-08-01T02:27:45.715Z (7 months ago)
- Language: HTML
- Size: 3.91 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://serverless.io) [](https://norfolkjs.org)
# Send SMS Message with Twilio
![]()
This example demonstrates how to send SMS messages with the Twilio SDK and AWS lambda.[Live the live demo](http://twilio-serverless-example.surge.sh)
## Use Cases:
* Sending users confirmation text messages
## Setup -
1. [Set up your AWS Credentials](https://serverless.com/framework/docs/providers/aws/guide/credentials/)
2. Sign up for a [Twilio account](http://www.twilio.com)
3. Create a [new phone number](https://www.twilio.com/console/phone-numbers/) in your Twilio trial account
4. Grab your ACCOUNT SID and AUTH TOKEN from the [Twilio console](https://www.twilio.com/console) and plug those into the `env.json` file in the next step
5. Create `env.json` variables in `serverless.yml` with your Twilio account values
```yml
environment:
# replace these env variables with your twilio account values
TWILIO_ACCOUNT_SID: ${file(./env.json):TWILIO_ACCOUNT_SID}
TWILIO_AUTH_TOKEN: ${file(./env.json):TWILIO_AUTH_TOKEN}
TWILIO_PHONE_NUMBER: ${file(./env.json):TWILIO_PHONE_NUMBER}
```5. Invoke the function and send an SMS message
Update the `to` phone number the `event.json` file and `message` to send in the SMS
Then invoke the function with the serverless CLI. Set the `--path event.json` so the function knows where to send the SMS.
```bash
serverless invoke -f sendText --path event.json
```6. (Optional) Deploy the front-end application
Update the `API_ENDPOINT` variable in the `/frontend/index.html` file and deploy the `/frontend` folder to a static host of your choice.