1up-lab / contao-mailchimp

Contao bundle for MailChimp subscribe/unsubscribe forms (using MailChimp API V3.0)
MIT License
7 stars 3 forks source link

Implement form subscriptions #35

Closed fritzmg closed 2 years ago

fritzmg commented 3 years ago

Often times our customers also want to enable the possibility to subscribe to a Mailchimp newsletter in regular Contao forms. i.e. the form is collecting other data (possibly stored with terminal42/contao-leads for example) but then the email address should also be subscribed to a Mailchimp newsletter (may be when clicking a checkbox).

So far we have implemented our own processFormData listeners in these projects, but since we need it in yet another project now, I thought it would be good to have this integrated directly into this extension :)

Usage:

  1. Set up the Mailchimp API credentials first as usual.
  2. Enable in the form's settings.
  3. Select a Mailchimp list.
  4. Optionally activate interest groups. Every subscription will have these interest groups enabled.
  5. Optionally set a confirm form field's name. The subscription will only be done, if the value of that form field is not empty.
  6. Optionally enable Mailchimp double opt-in.
  7. Define the merge tags. The "Key" is the Mailchimp merge tag while the "Value" is the form field's name. You need at least the EMAIL merge tag in order to indicate which form field holds the email address. Also the Mailchimp API requires at least the EMAIL merge tag.

Notes:

bytehead commented 3 years ago

oneup/mailchimp-api-v3 currently does not provide much error information when subscribing. So the logging can only log whether it was successful or not - without access to the reason when not successful.

I'm all in to update the API library to fit for future needs. 👍 Probably needs a update/rewrite anyway (PHP 8).

fritzmg commented 2 years ago

Took a while to properly test this with the customer, but this is RTM now 😁

bytehead commented 2 years ago

Thank you @fritzmg! Really nice feature!

bytehead commented 2 years ago

Would you mind to add some usage notes to the README.md as well?

fritzmg commented 2 years ago

Would you mind to add some usage notes to the README.md as well?

Ah, yes I meant to, but forgot.