mailigen

1.0.2 • Public • Published

Mailigen JS

This simple library gives you the ability to add email to your newsletter lists on Mailigen.

Installation

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
  2. Select the list you want to use
  3. On the list page, click "List Actions" -> "Web Signup Forms"
  4. Web Signup forms
  5. Click the link next to "Your hosted web signup form link"
  6. 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 {})
  3. Any extra options to pass to the listSubscribe method (defaults to {})

Here is an example:

import { subscribe } from 'mailigen';

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

Readme

Keywords

none

Package Sidebar

Install

npm i mailigen

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

14 kB

Total Files

5

Last publish

Collaborators

  • hstove