Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@input-output-hk/mailchimp-subscribe

Package Overview
Dependencies
Maintainers
3
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@input-output-hk/mailchimp-subscribe

Lightweight mailchimp subscriber library supporting custom fields

  • 0.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

Mailchimp subscribe library

A lightweight [Mailchimp](https://mailchimp.com/) subscriber library supporting custom fields. Subscribe emails to your mailing lists.

Mailchimp Subscribe issues Fork Mailchimp Subscribe Mailchimp Subscribe stars Mailchimp Subscribe license CircleCI build Test coverage


Contents

  1. Features
  2. Install
  3. Finding mailchimp values
  4. Examples
  5. Contributing

Features

  • Custom fields

Install

npm install --save @input-output-hk/mailchimp-subscribe

or

yarn add @input-output-hk/mailchimp-subscribe

Finding Mailchimp values

Finding the 'uID' value

Mailchimp audience sign up forms instructions Mailchimp audience embedded forms instructions Mailchimp audience embedded forms uid instructions

Finding the 'audienceID' value

Mailchimp audience sign up forms instructions Mailchimp audience name and defaults Mailchimp audience id instructions

Finding the 'listName' value

Mailchimp audience sign up forms instructions Mailchimp audience embedded forms instructions Mailchimp audience embedded forms uid instructions

Examples

Basic without localization

import subscribe from '@input-output-hk/mailchimp-subscribe'

async function submitForm (email) {
  try {
    const result = await subscribe({
      email,
      uID: 'XXXXXXXXX',
      audienceID: 'XXXXXXXXX',
      listName: 'XXXXXX.XXXX'
    })

    // Instance of MailChimpSuccess
    // result.message is the msg value received from Mailchimp
    return result
  } catch (error) {
    // handle error
    // error is instance of MailChimpError when error originates from mailchimp
    // error.message is the message returned from Mailchimp if the error originated on mailchimp
    return error
  }
}

Custom fields

import subscribe from '@input-output-hk/mailchimp-subscribe'

async function submitForm (email) {
  try {
    await subscribe({
      email,
      uID: 'XXXXXXXXX',
      audienceID: 'XXXXXXXXX',
      listName: 'XXXXXX.XXXX',
      customFields: {
        MY_FIELD: 'value',
        MY_SECOND_FIELD: 'value_2'
      }
    })

    // Instance of MailChimpSuccess
    // result.message is the msg value received from Mailchimp
    return result
  } catch (error) {
    // handle error
    // error is instance of MailChimpError when error originates from mailchimp
    // error.message is the message returned from Mailchimp if the error originated on mailchimp
    return error
  }
}

Specifiying a timeout

import subscribe from '@input-output-hk/mailchimp-subscribe'

async function submitForm (email) {
  try {
    await subscribe({
      email,
      uID: 'XXXXXXXXX',
      audienceID: 'XXXXXXXXX',
      listName: 'XXXXXX.XXXX',
      // 6000ms
      timeout: 6000
    })

    // Instance of MailChimpSuccess
    // result.message is the msg value received from Mailchimp
    return result
  } catch (error) {
    // handle error
    // error is instance of MailChimpError when error originates from mailchimp
    // error.message is the message returned from Mailchimp if the error originated on mailchimp
    return error
  }
}

Contributing

Contributions are welcome, see contributing for more info.

Keywords

FAQs

Package last updated on 03 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc