Skip to main content
Version: 2023.3

Multiple Mailchimp Accounts

Optionally it's possible to configure the service container to be able to handle multiple mailchimp accounts. Principally it's handled the same way like newsletter lists via mailchimp provider handler services (see Configuration for an example definition)*[]:

But additionally to the standard constructor arguments of the mailchimp provider handler class it's needed to setup a specialized export service which holds the Mailchimp client with the alternative API key.

An example config might look like this:

class: DrewM\MailChimp
- 'my-example-api-key'

class: CustomerManagementFrameworkBundle\Newsletter\ProviderHandler\Mailchimp\MailChimpExportService
- '@appbundle.cmf.mailchimp.client'

class: CustomerManagementFrameworkBundle\Newsletter\ProviderHandler\Mailchimp
autowire: true
# Shortcut of the handler/list for internal use
$shortcut: list1

# List ID within Mailchimp
$listId: ls938393f

# Mapping of Pimcore status field => Mailchimp status
manuallySubscribed: subscribed
singleOptIn: subscribed
doubleOptIn: subscribed
unsubscribed: unsubscribed
pending: pending

# Reverse mapping of Mailchimp status => Pimcore status field
subscribed: doubleOptIn
unsubscribed: unsubscribed
pending: pending

# Mapping of Pimcore data object attributes => Mailchimp merge fields
firstname: FNAME
lastname: LNAME
street: STREET
birthDate: BIRTHDATE

# Special data transfromer for the birthDate field.
# This ensures that the correct data format will be used.
birthDate: '@appbundle.cmf.mailchimp.birthdate-transformer'

$exportService: '@appbundle.cmf.mailchimp.export-service'

tags: [cmf.newsletter_provider_handler]