Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup boilerplate, add outline for function code
- Loading branch information
1 parent
2dadc25
commit b3a891a
Showing
3 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# package directories | ||
node_modules | ||
jspm_packages | ||
|
||
# Serverless directories | ||
.serverless |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
'use strict'; | ||
|
||
module.exports.process = (event, context, callback) => { | ||
// Process event and get values out | ||
var google_token = event["google_token"] | ||
var sms_message = event["sms_message"] | ||
// confirm that the values pass into this from the form | ||
|
||
// process google_token | ||
|
||
// Get fail if Google recaptcha token fails | ||
// If err with the google token not being vaild | ||
const failure_response = { | ||
statusCode: 500, | ||
body: JSON.stringify({ | ||
message: 'The recaptcha failed. Please try again!', | ||
input: event, | ||
}), | ||
}; | ||
|
||
// Setup Twilio | ||
// something like var twilio = require('twilio') | ||
|
||
|
||
// Send twillio message (if google recaptcha passes) | ||
|
||
|
||
// On success | ||
const success_response = { | ||
statusCode: 200, | ||
body: JSON.stringify({ | ||
message: 'Your message was sent successfully!', | ||
input: event, | ||
}), | ||
}; | ||
|
||
|
||
|
||
callback(null, response); | ||
|
||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
service: serverless-node-text-message-app | ||
|
||
provider: | ||
name: aws | ||
runtime: nodejs6.10 | ||
|
||
functions: | ||
processFormSendSms: | ||
handler: handler.process | ||
|