Skip to content

arisAlexis/landing-subscriber-sendgrid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

landing-subscriber-sendgrid

Landing page backend API endpoint working with Sendgrid

Intro

This helps you to keep the subscribers on a simple landing page on a sendgrid contacts list for later use.
It solves the problem of hosting your website statically without any scripts running to write the emails to databases or text files.

Usage

git clone this repo
npm i
mkdir config; nano config/default.json

The default.json file should have these:

{
  "port": "my_port_number",
  "sendgridKey": "your_secret_sendgrid_api_key"
}

You can find your list number by going to the sendgrid iface and seing the viewList link

Then you need to install the letsencrypt certs (tutorials available online) and make a folder named keys under the root and paste there privkey.pem, cert.pem and chain.pem.

Then you can use your favorite daemon such as PM2 and run pm2 start js/server.js.

From your webpage you need to hit the endpoint eg. with jQuery:
$.get('https://your_host:8080/fn/subscribe?list=your_list_number&email='+$('#emailField').val());

About

Landing page backend API endpoint working with Sendgrid

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published