Skip to content
This repository was archived by the owner on Dec 2, 2024. It is now read-only.

colensobbdo/html2sendgrid

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HTML2Sendgrid

NPM

A CLI command to publish HTML files as Dynamic Templates on Sendgrid.

WTF

In order to automatically publish some HTML templates to SendGrid you can use this script to:

  • scan for existing templates
  • match any existing template by name
  • create a new template if missing
  • rotate template versions (as they are limited to 300 per account)
  • create a new version and set it active

You just need to specify the sendgrid api key as an environment variable named SENDGRID_API_KEY then run the script as per instruction here below.

Usage

export SENDGRID_API_KEY=YOUR_API_KEY
npm start <HTML_DIR>

if you want to upload also some test variables

export SENDGRID_API_KEY=YOUR_API_KEY
npm start <HTML_DIR> <VARIABLES.JSON>

Max version per template

export MAX_VERSION_PER_TEMPLATE=5

If you set this variable the module will automatically rotate the versions of the template by keeping the last N versions.

This is useful because Sendgrid has a limit of 300 versions per account.

If you have multiple template within the same account you might want to limit how many versions of a template you want to keep in order to not hit this limit.

About

A CLI command to publish HTML files as Dynamic Templates on Sendgrid

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 99.8%
  • Shell 0.2%