MailchimpService Admin Config Form

This project is not covered by Drupal’s security advisory policy.

MailChimp Service for Drupal 8

The Drupal 8 module for MailChimp Service.

Installation

To install from this repository:

Clone the repository into your Drupal site modules directory:

git clone --branch 8.x-1.x https://git.drupal.org/project/mailchimp_service.git
cd mailchimp_service

This module require drewm/mailchimp-api": "^2.2

Install mailchimp-api by adding drewm/mailchimp-api": "^2.2" in composer.json and composer install

Install the module, as usual, using Drush or the Drupal UI.

Configuration

Get Mailchimp API Key from http://admin.mailchimp.com/account/api
Configure Mailchimp API Key in admin/config/mailchimp_service/mailchimpserviceadmin

How to use API:

Example :

    // Include service file in your file.
    use Drupal\mailchimp_service\MailchimpService;
    
    // Create profile array for mailChimp.
    $userProfile = [
      'FNAME' => 'FirstName of the user',
      'LNAME' => 'FirstName of the user,
    ];
    
    // Set type of sybscrption.
    $type = 'subscribed'; // Type can be 'Status','pending','Update','unsubscribed', or 'subscribed'
    
    // Subscription Email.
    $email = 'youremail@example.com';
    
    // MailChimp list id.
    $mail_chimp_list_id ='xxxx'; // Add MailChimp list id.
    
    $result = $this->mailchimpService->mailchimpSubscription($userProfile, $type, $email, $mail_chimp_list_id);

Project information

Releases