# mailigen

> A JS library for using the Mailigen API

Latest version **1.0.2** (published 2018-10-03) · MIT license · 0 weekly downloads

## Install

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

## 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.2 |
| Published | 2018-10-03 |
| First published | 2018-10-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 13.6 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Hank Stoever |
| Maintainers | hstove |

## Links

- npm: https://www.npmjs.com/package/mailigen
- Repository: https://github.com/hstove/mailigen-js
- Homepage: https://github.com/hstove/mailigen-js#readme
- Issues: https://github.com/hstove/mailigen-js/issues
- npm.io page: https://npm.io/package/mailigen

## Dependencies (2)

- [request](https://npm.io/package/request.md) ^2.88.0
- [request-promise](https://npm.io/package/request-promise.md) ^4.2.2

## Recent versions

- 1.0.2 (latest) — 2018-10-03
- 1.0.1 — 2018-10-03
- 1.0.0 — 2018-10-03

## README

# Mailigen JS

This simple library gives you the ability to add email to your newsletter lists on [Mailigen](https://www.mailigen.com/).

### Installation

~~~bash
yarn add mailigen
~~~

### Environment Variables

To use this library, you need to set 2 API keys as environment variables.

- `MAILIGEN_LIST`
  - Set this to your List ID. See below for finding your list ID.
- `MAILIGEN_API_KEY`
  - Your API key

### Finding your List ID

To find your List ID:

1. View [all of your lists](https://admin.mailigen.com/contacts/lists)
2. Select the list you want to use
3. On the list page, click "List Actions" -> "Web Signup Forms"
  1. ![Web Signup forms](https://cl.ly/91910cd70235/Image%2525202018-10-03%252520at%25252011.35.34%252520AM.png)
4. Click the link next to "Your hosted web signup form link"
5. Copy the `id` URL parameter on the link that opens. This is your List ID for use with the API

### Using Mailigen JS

The `subscribe` method uses 3 arguments:

1. The email to add
2. Any merge variable you want to use (defaults to `{}`)
4. Any extra options to pass to the [`listSubscribe` method](http://dev.mailigen.com/functions/list-management/adding-new-email-to-list) (defaults to `{}`)

Here is an example:

~~~javascript
import { subscribe } from 'mailigen';

async function addEmail(email, firstName) {
  const response = await subscribe(email, { 'FNAME': firstName }, { 
    send_welcome: true
  });
}
~~~

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