Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/DataFire-repos/contact-us-base


https://github.com/DataFire-repos/contact-us-base

Last synced: 5 days ago
JSON representation

Awesome Lists containing this project

README

        

# 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](https://app.datafire.io/projects?baseRepo=https:%2F%2Fgithub.com%2FDataFire-repos%2Fcontact-us-base)

## 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 `[email protected]` with your own email address
* Click "Deploy"
* Select `prod`
* Click "Deploy Project"

## Running Manually

To run this project manually:

```bash
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 [email protected] 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
```html


```

### cURL
```bash
curl -X POST "http://localhost:3000/contact" \
-d 'message=hi&[email protected]'
```

```bash
curl -X POST "http://localhost:3000/contact" \
-d '{"message": "hi!", "emailAddress": "[email protected]"}'
-H 'Content-Type: application/json'
```