An open API service indexing awesome lists of open source software.

https://github.com/thestackshack/serverless-contact-us-form

Simple Contact Us form for static websites
https://github.com/thestackshack/serverless-contact-us-form

Last synced: 12 months ago
JSON representation

Simple Contact Us form for static websites

Awesome Lists containing this project

README

          

# Serverless Contact Us Form

The template: [cloudformation.yml](cloudformation.yml)

Quickly deploy an endpoint to handle your `contact us` form on your static website. We don't want to have servers running just to handle our `contact us` form which rarely gets invoked. Oh, and we also need Captcha because we don't have time in our lives for spam.

You can get your reCAPTCHA secret here: https://www.google.com/recaptcha/admin#list

## What AWS resources does this template use?
* Lambda (API Function)
* API Gateway (HTTP proxy to Lambda)
* S3 (Lambda files)
* SES (Send us the email)
* CodeCommit (GIT repo)
* CloudFormation (Infrastructure as Code)
* IAM (AWS permissions & users)

## HTML Form
```


Name



Email address



Phone number



Message


Thanks! We'll contact you soon.


Submit

```
JQuery example...
```
$.post($("#contact-us-form").attr('action'), JSON.stringify({
name: $("#contact-us-form input[name='name']").val(),
email: $("#contact-us-form input[name='email']").val(),
phone: $("#contact-us-form input[name='phone']").val(),
message: $("#contact-us-form textarea[name='message']").val(),
'g-recaptcha-response': $("#contact-us-form textarea[name='g-recaptcha-response']").val()
}), function (data) {
$(".thanks").show();
$("#contact-us-form button").hide();
}, 'json');
```