tableflip/post

Name: post

Owner: TABLEFLIP

Description: :love_letter: The TABLEFLIP contact form handler

Created: 2016-03-21 15:28:19.0

Updated: 2017-10-13 00:50:35.0

Pushed: 2018-02-14 15:53:22.0

Homepage:

Size: 131

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

POST - The TABLEFLIP contact form handler

Store and forward data posted to it from forms on static sites. Data is stored in leveldb. Periodically sent on to recipients.

Getting started

Copy config/defaults.json to config/local.json and fill out your mailgun credentials. Create a reCAPTCHA key pair here https://www.google.com/recaptcha/ for the domain from which you are posting.

In the post-infrastructure project add the following two pieces of config


ogle: {
captcha: {
  "new-domain.name": "_SECRET_KEY_FROM_GOOGLE_"
}



ogle: {
captcha: {
  "new-domain.name": "{{secret.google.capcha['new-domain.name']}}",
  "another-domain": "{{secret.google.capcha['another-domain']}}"
}


From the command line

Files of note

P O S T usage

Load the google recaptcha api in the <head> of the page

ipt src="https://www.google.com/recaptcha/api.js" async defer></script>

Create an html form. Set method="post" the action to point to

https://post.tableflip.io/butterfield-diet.com

Replace butterfield-diet.com with your domain that will be sending the posts.

m id="your-form-id" action="https://post.tableflip.io/butterfield-diet.com" method="post">
abel for="email" class="label">Your email address</label>
nput id="email" name="email" type="email" required="" class="input border-box">
abel for="info" class="label">Any info</label>
extarea id="info" name="info" rows="3" class="textarea border-box"></textarea>
cript>function onSubmit (token) {document.getElementById('your-form-id').submit()}</script>
utton class="btn btn-primary g-recaptcha" data-sitekey="_PUBLIC_KEY_FROM_GOOGLE_CAPTCHA_" data-callback='onSubmit'>Send</button>
rm>

The name values on your inputs will show up as labels in your notification, to give the values some context.

Use the admin screen at https://post.tableflip.io/routes to configure a route for https://butterfield-diet.com, to tell it where to send the message, and where to redirect the user afterwards.

Skip the spam filter

You can be in a situation where you just want to post to post and skip the Google's recaptcha. You can do this by adding a “skip” flag on your post's payload:


"name": "Bernard",
"email": "bernard@tableflip.io",
"open-source": "true",
"g-recaptcha-response": "skip"

Level DB

See: http://dailyjs.com/2013/04/18/leveldb-and-node-1/

For looking up where to send a message to, we have general purpose domain routes, that'll be used when a more specific domain + path route can't be found.

This let's you configure a default handler for all forms on a site, and occasionally override it for a specific form if you need to. The path can be as deeply nested as you need, it just needs to correspond to the path that you append to https://post.tableflip.io/yoursite.com/path/to/your/special/form/here

e!tableflip.io => { email: 'hello@tableflip.io', frequency: 'daily' }
e!tableflip.io/startup => { email: 'hello@tableflip.io', frequency: 'all' }
e!marmalade-productions.com => { email: 'hello@tableflip.io', frequency: 'daily' }

We look up for a specific match on domain + path, then a domain match if there isn't a specific match.

  1. lookup tableflip.io/foo/bar, not found.
  2. lookup tableflip.io. found; make it so.

A (?°?°???TABLEFLIP side project.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.