adanilev / sms-forwarder

Forward SMSs using Twilio and Lambda

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

  1. Add your AWS credentials to a named profile
  2. 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'
  3. Clone this repo
  4. Copy/rename .env.example to .env and update with your details
  5. Deploy!
    $ yarn
    $ yarn sls-deploy
  6. Copy the endpoint and configure your Twilio phone number to call it (POST webhook) whenever it receives an SMS

Teardown

  1. Delete all the resources that serverless helped create
    $ yarn sls-remove
  2. 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

  1. Only allow our Lambda's API to be called by Twilio servers

About

Forward SMSs using Twilio and Lambda


Languages

Language:JavaScript 100.0%