A Lambda function to programmatically handle phone calls from my apartment building security.
It accepts calls from Twilio via the AWS API Gateway, builds a TwiML response, and sends a payload about the call via SNS.
I use it so that when the front desk/security at my apartment building calls me to tell me I have a package, someone is here to see me, or deliver something, I can receive notifications how I want and take action.
As an example, when I have someone arrive to see me, when security calls and presses 2 the call forwards to my cell phone and alerts my home automation system to turn entryway lights on.
I have another Lambda function that is run when a new message is put into SNS which processes the payload and alerts my home automation system.
- Copy
config.example.jstoconfig.js. - Change the config as needed. All values are required except values in
say. - Run
grunt deploy. - Configure AWS API Gateway to accept POST requests to your Lambda function.
- In the Method Execution step of your API Gateway resource, add a Body Mapping Template for
application/x-www-form-urlencoded. The contents should only be{"body" : $input.json('$')}. - Point a Twilio phone number to your API Gateway URL.
- ...
- Profit
Ask the caller to provide input.
Alerts me of a package and hangs up the call.
Forwards the call to my cell phone, because someone is here to see me/deliver something/misc. reasons.
grunt test. Change event.json to test different scenarios.
Fork, change, submit PR, done.
MIT