sms-forwarder
Forward messages from a Twilio number to another phone number
About
I wanted to set up a local US number that could receive messages and forward them to my mobile in another country. Unfortunately, Twilio numbers have certain limitations which mean they don't work for my use case. Sharing the code anyways...
Pre-requisites
- AWS account
- Twilio account with an SMS capable number
Setup
- Add your AWS credentials to a named profile
- Add your Twilio Account SID and Auth Token to AWS Systems Manager Parameter Store
$ export AWS_DEFAULT_PROFILE=your_profile_name $ aws ssm put-parameter --name '/prod/sms-forwarder/twilio/account-sid' --type 'SecureString' --value 'YOUR_ACCOUNT_SID' $ aws ssm put-parameter --name '/prod/sms-forwarder/twilio/auth-token' --type 'SecureString' --value 'YOUR_AUTH_TOKEN'
- Clone this repo
- Copy/rename
.env.example
to.env
and update with your details - Deploy!
$ yarn $ yarn sls-deploy
- Copy the endpoint and configure your Twilio phone number to call it (POST webhook) whenever it receives an SMS
Teardown
- Delete all the resources that serverless helped create
$ yarn sls-remove
- Delete the secrets we added to SSM Parameter Store
$ aws ssm delete-parameter --name '/prod/sms-forwarder/twilio/account-sid' $ aws ssm delete-parameter --name '/prod/sms-forwarder/twilio/auth-token'
TODO
- Only allow our Lambda's API to be called by Twilio servers