2017 © Pedro PelĂĄez
 

craft-plugin craft-mailchimplists

Create, manage and monitor your MailChimp Lists from within Craft.

image

lukeyouell/craft-mailchimplists

Create, manage and monitor your MailChimp Lists from within Craft.

  • Friday, April 20, 2018
  • by lukeyouell
  • Repository
  • 0 Watchers
  • 24 Stars
  • 377 Installations
  • HTML
  • 2 Dependents
  • 0 Suggesters
  • 3 Forks
  • 1 Open issues
  • 7 Versions
  • 53 % Grown

The README.md

icon, (*1)

MailChimp Lists plugin for Craft CMS 3.x

Create, manage and monitor your MailChimp Lists from within Craft., (*2)

Screenshot, (*3)

Requirements

This plugin requires Craft CMS 3.0.0-RC11 or later., (*4)

Installation

To install the plugin, follow these instructions., (*5)

  1. Open your terminal and go to your Craft project:, (*6)

    cd /path/to/project
  2. Then tell Composer to load the plugin:, (*7)

    composer require lukeyouell/craft-mailchimplists
  3. In the Control Panel, go to Settings → Plugins and click the “Install” button for MailChimp Lists., (*8)

Configuring MailChimp Lists

You will be required to supply a MailChimp API key which is used to source the relevant data center and authenticate requests., (*9)

Your API key is available here., (*10)

A MailChimp account is required, if you don't already have one click here to create one., (*11)

Free & paid plans are available., (*12)

Using MailChimp Lists

Once you have provided the plugin with your MailChimp API key you will be able to create, manage and monitor your lists directly from within Craft., (*13)

Example Form

Your list subscription form template should look something like this:, (*14)



{{ csrfInput() }}

Form Parameters

Name Required Hashed Expected value
listId Yes Yes The unique id for the list
status Yes Yes subscribed, unsubscribed, cleaned or pending
email_address Yes No Email address for a subscriber
email_type No No html or text
merge_fields[] No No An individual merge var and value for a member
interests[] No No The name of this field is the ID of the interest in question.
language No No If set/detected, the subscriber’s language ISO 3166 Country Code
vip No No VIP status for subscriber
location[latitude] No No Subscriber location latitude
location[longitude] No No Subscriber location longitude

The above field names are case-sensitive., (*15)

Redirecting After Submit

If you have a redirect hidden input, the user will be redirected to it upon successful submission. This must also be a hashed value., (*16)

If you don't have a redirect hidden input, the plugin will respond with json (handy for debugging), (*17)

Ajax Submissions

You can optionally post submissions over Ajax if you’d like. Just send a POST request to your site with all of the same data that would normally be sent (except for the redirect field), (*18)

$('form').submit(function(ev) {
  // Prevent the form from actually submitting
  ev.preventDefault();

  // Send it to the server
  $.post({
    url: '/',
    dataType: 'json',
    data: $(this).serialize(),
    success: function(response) {
      if (response.success && response.statusCode == 200) {
        alert('Success!');
      } else if (response.statusCode !== 200) {
        alert('MailChimp error: ' + response.body.title)
      } else {
        alert('An error occurred. Please try again.');
      }
    }
  });
});

Example Responses

Successful

{
   "success": true,
   "statusCode": 200,
   "reason": "OK",
   "body": {
      "id": "24d2b4y97c4fe95a2d6a3d3ba2018cb0",
      "email_address": "joe.bloggs@email.com",
      "unique_email_id": "84a5q243cd",
      "email_type": "html",
      "status": "subscribed",
      "merge_fields": {
         "FNAME": "Joe",
         "LNAME": "Bloggs",
      },
      "stats": {
         "avg_open_rate": 0,
         "avg_click_rate": 0
      },
      "ip_signup": "",
      "timestamp_signup": "",
      "ip_opt": "8.8.8.8",
      "timestamp_opt": "2018-02-21T13:37:36+00:00",
      "member_rating": 2,
      "last_changed": "2018-02-21T13:37:36+00:00",
      "language": "",
      "vip": false,
      "email_client": "",
      "location": {
         "latitude": 0,
         "longitude": 0,
         "gmtoff": 0,
         "dstoff": 0,
         "country_code": "",
         "timezone": ""
      },
      "list_id": "t74m4dbg9r"
   }
}

MailChimp Error

{
   "success": true,
   "statusCode": 400,
   "reason": "Bad Request",
   "body": {
      "type": "http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/",
      "title": "Member Exists",
      "status": 400,
      "detail": "joe.bloggs@email.com is already a list member. Use PUT to insert or update list members.",
      "instance": "a6d8eac9-3456-123a-a01b-22r4342d6432"
   }
}

Request Failed

{
   "success": false,
   "reason": "cURL error 6: Could not resolve host: us17.api.mailchimp.co.uk (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)"
}

Overriding Plugin Settings

If you create a config file in your config folder called mailchimp-lists.php, you can override the plugin’s settings in the Control Panel. Since that config file is fully multi-environment aware, this is a handy way to have different settings across multiple environments., (*19)

Here’s what that config file might look like along with a list of all of the possible values you can override., (*20)

<?php

return [
    'apiKey' => '',
];

MailChimp Lists Roadmap

Some things to do, and ideas for potential features:, (*21)

  • List growth
  • Edit members
  • Member activity
  • Sort members by date
  • Dashboard widget
  • Custom progress bar parameters

Brought to you by Luke Youell, (*22)

The Versions

20/04 2018

v1.x-dev

1.9999999.9999999.9999999-dev

Create, manage and monitor your MailChimp Lists from within Craft.

  Sources   Download

MIT

The Requires

 

mailchimp cms craftcms craft-plugin craft mailchimp lists

26/02 2018

1.0.5

1.0.5.0

Create, manage and monitor your MailChimp Lists from within Craft.

  Sources   Download

MIT

The Requires

 

mailchimp cms craftcms craft-plugin craft mailchimp lists

25/02 2018

1.0.4

1.0.4.0

Create, manage and monitor your MailChimp Lists from within Craft.

  Sources   Download

MIT

The Requires

 

mailchimp cms craftcms craft-plugin craft mailchimp lists

23/02 2018

1.0.3

1.0.3.0

Create, manage and monitor your MailChimp Lists from within Craft.

  Sources   Download

MIT

The Requires

 

mailchimp cms craftcms craft-plugin craft mailchimp lists

23/02 2018

1.0.2

1.0.2.0

Create, manage and monitor your MailChimp Lists from within Craft.

  Sources   Download

MIT

The Requires

 

mailchimp cms craftcms craft-plugin craft mailchimp lists

21/02 2018

1.0.1

1.0.1.0

Create, manage and monitor your MailChimp Lists from within Craft.

  Sources   Download

MIT

The Requires

 

mailchimp cms craftcms craft-plugin craft mailchimp lists

21/02 2018

1.0.0

1.0.0.0

Create, manage and monitor your MailChimp Lists from within Craft.

  Sources   Download

MIT

The Requires

 

mailchimp cms craftcms craft-plugin craft mailchimp lists