pigeonpost

0.0.0 • Public • Published

E-Mail Scheduler / API

The following outlines the details for collaborating on this Node application.

Prerequisites

You will need the following things properly installed on your computer.

Note: Due to the dependency on Crontab, this application will not run easily on Windows.

Installation

  • git clone git@github.com:bocoup/email this repository
  • cd email change into the new directory
  • mkdir config && scp nest.bocoup.com:/mnt/secrets/ses.json config - get creds
  • npm install install the third-party dependencies

Note: If you are forking this for personal use, AWS credentials must be provided at ./config/ses.json in the following format:

{
  "key": "AWS_KEY",
  "secret": "AWS_SECRET"
}

Usage

By design this application is meant to be standalone on a server and act as a server daemon. If you would like to directly integrate with your pre-existing server, this application also acts as express middleware.

API

The Bocoup E-Mail API should follow JSON-API for errors and data. You must set the content type request header to JSON.

Note: jQuery and other popular request libraries may add this automatically.

Content-Type: application/json

The API is versioned and the current stable is v1. Therefore you should format your requests like so:

http://email.bocoup.com/api/v1/

Documentation

Sending

This is the endpoint you'll hit when you want to immediately send an email. Useful for one off emails, such as new account registration or forgot password.

Description URL Method Request Response
Send an e-mail `/send` `POST`
{
  "to": ["tim@tabdeveloper.com"],
  "from": "tim@bocoup.com",
  "subject": "Testing this out!!!",
  "body": "The HTML capable email message body!"
}
Body:
{}

Pollers

These are jobs that are executed on a specific schedule. They are assigned using Crontab, and allow any valid schedule expression within that format. You would use this endpoint to schedule emails to be sent every day/month/year, schedule an email to be sent 5 minutes from now, etc.

Description URL Method Request Response
Create a new poller `/poll` `POST`
{
  "id": "test-uuid"
}
{
  "id": "test-uuid"
}
Create or update new poller `/poll` `PUT`
{
  "id": "test-uuid"
}
{
  "id": "test-uuid"
}
Get all pollers `/poll` `GET`
null
{
  "data": [{
    "id": "test-uuid"
  }]
}
Get a specific poller `/poll/:id` `GET`
null
{
  "data": {
    "id": "test-uuid"
  }
}
Delete a specific poller `/poll/:id` `DELETE`
null
{
  "data": {
    "id": "test-uuid"
  }
}

Running / Development

Running Tests

  • npm test

Deploying

Vagrant

vagrant up

Production

Deploy & Provision:

npm run deploy
npm run provision

OR (more verbose)

./deploy/deploy-production.sh
./deploy/provision-production.sh

Readme

Keywords

none

Package Sidebar

Install

npm i pigeonpost

Weekly Downloads

0

Version

0.0.0

License

MIT

Last publish

Collaborators

  • tbranyen