Skip to content

kgrycuk/mailfunnels-server

Repository files navigation

Mail-Funnel-Server API

Coverage Status Coverage StatusStories in Ready

Rails JSON API RESTful Server, that also handles Shopify Webhooks and a Rails Cron-Job Worker.

Mail-Funnel Project:

Usage

You must first start the Sidekiq Worker Server

bundle exec sidekiq -c 10 -q mailers

Then you run the server

bundle && rails db:reset && bundle exec rails s -p 3001
// or simply
bundle exec rails s -p 3001

Then you start the client

bundle && rails db:reset && bundle exec rails s
// or simply
bundle exec rails s

URL + DNS

DNS Entries

Mail-Funnels-Server

TODO: Replace herokudns.com with .herokuapp.com

## PRODUCTION
https://mail-funnel-server.herokuapp.com/

# CNAME ENTRIES
App URL: api.mailfunnels.com
App DNS: api.mailfunnels.herokudns.com


# #STAGING
https://mail-funnel-server-staging.herokuapp.com

# CNAME ENTRIES
APP URL: staging.api.mailfunnels.com
APP DNS: staging.api.mailfunnels.herokudns.com

APP URL: www.staging.api.mailfunnels.com
APP DNS: www.staging.api.mailfunnels.herokudns.com

Mail-Funnels-Client

www.staging.mailfunnels.herokudns.com

## PRODUCTION
https://mail-funnel-client.herokuapp.com/

# CNAME ENTRIES
App URL: mailfunnels.com
App DNS: mailfunnels.herokudns.com


## STAGING
https://mail-funnel-client-staging.herokuapp.com/

# CNAME ENTRIES
APP URL: staging.mailfunnels.com
APP DNS: staging.mailfunnels.herokudns.com

APP URL: www.staging.mailfunnels.com
APP DNS: www.staging.mailfunnels.herokudns.com


Contribute

Contribute code to the mail-funnel-server. Notify us if you are interested in joining the team, or fork us, and submit a pull request!

Github Dev-Ops Integrations (Services)

Github addons that we installed have configured to use automatically when we push or deploy code (depending on when each service is congured to run)!

Slack Commands + Addons

The Slack Services and Tools we have implemented, and their usage.

Screen-sharing Addons

/leap — Share your browser window to a private URL.
/leap screen — Share your entire screen to a private URL.
/leap broadcast browser — Share your browser window to your personal URL.
/leap broadcast screen — Share your entire screen to your personal URL.

Server-Features

The purpose of this server is to serve the mail-funnel-client (soon available in app-store) with the following services: Shopify Webhooks, REST CRUD JSON Web-Services and a Ruby background-job worker.

Shopify Webhooks

  • Shopify Webhooks - Shopify-API is configured and authenticated and the hooks are ready in /app/api/api.rb

REST JSON Web-Services

Sends emails using SendGrid

Possible Rails Libraries:

Background-Jobs Worker

1. Evaluate the Job's "frequency" value and "frequency-value" value. 
   1.1 `Frequency:String` = execute_once (default), (currently disabled: execute_twice, execute_thrice)
   1.2 `Frequency-Value::Integer` (military-style / minutes are multiples of 5) = 0030, 1100, 1345, 2005
2 Check the `Executed:Boolean` param, check if job has been executed yet 
   2.1 (Disabled)'Executed_Count:Integer` param (record how many times it has been executed) 

Workers

Mailers / Sendgrid Mailers

Development

Developer Setup

./ngrok http 3001   # This starts ngrok

You will need to configure your .env first. The .env can be used with the gem 'dotenv'

RAILS_ENV=Development
APP_NAME=mailfunnel-server
APP_KEY=##KEY########
APP_SECRET=##SECRET###
APP_URL=http://GENERATED-URL.ngrok.io/api/ # Or your servers URL
APP_SCOPE = "read_orders, read_products"

Then run the server on port 3001

rails s -p 3001

Mail-Funnel REST Server

Endpoints

Rails JSON REST API
http://mailfunnel.bluehelmet.io

Shopify API Endpoint
http://mailfunnel.bluehelmet.io/api/

API JSON Authentication (Task)

API Docs:

Production Server

Heroku

Travis-CI OR Circle-CI

Reviewable.io

Sentry.io

Dependency Security Analyzer

About

Server Side Code for MailFunnels Shopify App

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published