# html2sendgrid

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

Latest version **1.0.5** (published 2022-02-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install html2sendgrid
pnpm add html2sendgrid
yarn add html2sendgrid
bun add html2sendgrid
```

Provides the command `html2sendgrid`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2022-02-01 |
| First published | 2021-03-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 12 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Fabio Cigliano |
| Maintainers | lidio601 |

## Links

- npm: https://www.npmjs.com/package/html2sendgrid
- Repository: https://github.com/lidio601/html2sendgrid
- Homepage: https://github.com/lidio601/html2sendgrid#readme
- Issues: https://github.com/lidio601/html2sendgrid/issues
- npm.io page: https://npm.io/package/html2sendgrid

## Dependencies (4)

- [dotenv](https://npm.io/package/dotenv.md) ^15.0.0
- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [@lidio601/logger](https://npm.io/package/@lidio601/logger.md) ^1.0.3
- [@sendgrid/client](https://npm.io/package/@sendgrid/client.md) ^7.6.0

## Recent versions

- 1.0.5 (latest) — 2022-02-01
- 1.0.4 — 2021-03-15
- 1.0.3 — 2021-03-15
- 1.0.2 — 2021-03-15
- 1.0.1 — 2021-03-15
- 1.0.0 — 2021-03-15

## README

# HTML2Sendgrid

[![NPM](https://nodei.co/npm/htmltosendgrid.png)](https://npmjs.org/package/htmltosendgrid)

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.

---
_Source: https://npm.io/package/html2sendgrid · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
