Now that I’ve got voice forwarding working, I’ve got to get
SMS (text message) forwarding working.
I’ve decided to split this into multiple parts since there’s a lot to
do.
The first part, this post, will cover the general idea of
what I’m doing with Amazon Web Services (AWS).
The second part will be a narrated video showing each of the steps to
implement an SMS auto-responder, along with the code. The auto-responder will just send a generic
reply asking to email me. The third part
will be the code to actually forward SMS messages to an email address.
Twilio
Twilio is the service I used to set up the voice
forwarding. It allows you to build
custom voice, SMS, and MMS applications. The general idea is that you
give Twilio a URL to load when it gets a call, text, or MMS. Twilio follows the directions it gets when loading that URL. I need to
set up that URL. The most basic (useful) direction I can give is to reply with another text message, so that’s what I’ll implement first.
In my previous post, I covered International
Call Forwarding. That was easy because Twilio built tools into their service
for forwarding calls. They don't have forwarding for SMS or MMS. I’ll use Amazon for generating the response
text message, and (in the third part) for forwarding the messages to my
email.
The Cloud
For those of you not in the tech world, Amazon is more than
just shopping. About 10 years ago Amazon decided to start opening up some of
their web site infrastructure to the world. They rent out web
infrastructure, such as computers to do processing and serve webpages,
amazingly fast internet connections, firewalls to protect against attackers,
and a few other things. Amazon was the
first company to do this on a large scale and they're the most successful by
far. When someone talks about being "in the
cloud," they are most likely really talking about "using computers rented
from Amazon for a small premium in exchange for a fast internet connection,
redundancy, labor, scalability, and solving a whole host of other
problems." Amazon’s offerings are
collectively called Amazon Web Services or AWS.
I’m going to create an SMS auto-responder using AWS’s Lambda service and API Gateway service. Then I'll build a forwarder with their Simple Email Service.
Building an Auto-Responder
Lambda lets you execute small bits of code in response to
some trigger. You don’t need to rent a
server from Amazon to run that code and pay for all the idle time. Generating a reply to a text message is
simple, so it’s perfect for Lambda.
API Gateway will give you a URL that someone can request and
then pass that request on to a Lambda function.
There are some language differences to work out regarding the language
that Twilio wants to use and the language Lambda wants to use. I’ll cover that in the second part.
Building a Forwarder
Once I've got the autoresponder working, I can set up SMS forwarding to my email using Amazon Lambda and Amazon's Simple Email Service.
Cost
The cost of running the smallest server with Amazon is about
$0.013 per hour, or $9.36 per month. Since I'm using AWS Lambda, I don't need to run any servers with Amazon. Generating a few hundred SMS replies via Lambda costs well under one
cent per month. (As an aside, AWS has a
free tier of service, where if you use very little, it won’t cost you anything
at all. Some of the services I use will
be free, some won’t be. That $9.36 per
month would fall into the free tier, but I’d still need to worry about the
maintenance on the server).
There are some additional costs from other unrelated AWS
services that I use. Overall, my Amazon
bill is less than $1.00 per month.
Twilio charges $1.00 per month per phone number and $0.0075 per SMS sent
or received. I expect the total cost of
SMS forwarding to be under $3.00 per month. Voice
forwarding will cost about the same.
This comment has been removed by a blog administrator.
ReplyDelete