Skip to content

Commit

Permalink
Setup boilerplate, add outline for function code
Browse files Browse the repository at this point in the history
  • Loading branch information
fernando-mc committed Jun 23, 2017
1 parent 2dadc25 commit b3a891a
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
@@ -0,0 +1,6 @@
# package directories
node_modules
jspm_packages

# Serverless directories
.serverless
42 changes: 42 additions & 0 deletions handler.js
@@ -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);


};
10 changes: 10 additions & 0 deletions serverless.yml
@@ -0,0 +1,10 @@
service: serverless-node-text-message-app

provider:
name: aws
runtime: nodejs6.10

functions:
processFormSendSms:
handler: handler.process

0 comments on commit b3a891a

Please sign in to comment.