Skip to content

DataFire-repos/contact-us-base

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

Contact Us Backend

This project creates a backend for a "Contact Us" form. It uses a Gmail account to send you an e-mail on behalf of someone else, e.g. a visitor to your site.

Run this project on DataFire.io

Running on DataFire.io

  • Go to the Integrations tab, and add a new Gmail account.
  • Select the https://www.googleapis.com/auth/gmail.send scope.
  • Click "Add Account" and log into the Gmail account you want to send messages from
  • Navigate to the Actions tab, and click on contact_me
  • Replace YOUR_EMAIL@gmail.com with your own email address
  • Click "Deploy"
  • Select prod
  • Click "Deploy Project"

Running Manually

To run this project manually:

git clone https://github.com/DataFire-repos/contact-us-base
cd contact-us-base
npm install
datafire authenticate google_gmail
# Choose the gmail.send scope
# Edit ./actions/contact_me.js and replace YOUR_EMAIL@gmail.com with your email address
datafire serve

Using the API

There is one URL for this API - POST /contact. It accepts both urlencoded and JSON content.

If you're running your project on DataFire.io, replace http://localhost:3000 with your project's host, e.g. https://project-name.prod.with-datafire.io.

HTML form

<form action="http://localhost:3000/contact" method="post">
  <input type="text" name="emailAddress">
  <textarea name="message"></textarea>
</form>

cURL

curl -X POST "http://localhost:3000/contact" \
  -d 'message=hi&emailAddress=me@example.com'
curl -X POST "http://localhost:3000/contact" \
  -d '{"message": "hi!", "emailAddress": "me@example.com"}'
  -H 'Content-Type: application/json'

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published