- Issue created by @sagesolutions
- Status changed to Closed: works as designed
about 1 year ago 1:26pm 20 October 2023 - 🇨🇦Canada sagesolutions
After reading the docs for mailchimp at https://github.com/thinkshout/mailchimp-api-php, it turns out the way you pass in the api_key has changed in version 3.0. Now you pass in an authentication array to get the api_class variable, then pass that into the MailchimpLists.
$config = Drupal::config('mailchimp.settings'); $api_key = $config->get("api_key"); // Instantiate MailchimpApiInterface $authentication_settings = [ 'api_key' => $api_key, 'api_user' => 'api_key', ]; // Use Mailchimp class for api_key. $api_class = new Mailchimp($authentication_settings); $mailChimpLists = new MailchimpLists($api_class); $listID = '123456789'; $email = 'myemail@gmail.com'; $member = $mailChimpLists->getMemberInfo($listID, $email);