Postponed on #3470738: Brevo newsletter (un)subscribe (via SDK)
Problem/Motivation
Webforms are super popular in Drupal and Brevo module should provide webform integration in a brevo_webform submodule.
It should allow adding a checkbox element to subscribe to the selected newsletter on form submission. Maybe this also needs a dedicated webform handler, I'm not sure about the most flexible architecture here. Maybe this is already solved for other newsletter modules?
It might make sense to sponsor @jrockowitz (see https://www.drupal.org/project/webform) as Brevo for a smart implementation (and because he and open source is worth the donation!)
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork brevo-3471021
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
anybodyComment #3
anruetherHello again! We also have https://www.drupal.org/project/brevo_webform_handler
Comment #4
anybodyThank you @anruether! Nice, I created #3553922: Join forces and merge this into the Brevo module? accordingly. What do you think?
Comment #5
anruether@anybody As a sitebuilder I appreciate if I only have to enter my credentials once :)
Comment #6
kensae commentedSince there has been no response to the issue regarding the brevo_webform_handler, should we move forward and begin developing the handler ourselves?
Comment #7
anybody@kensae yes please feel free to do that! You can still try contacting https://www.drupal.org/project/brevo_webform_handler about the issue and leave a note there.
Comment #10
renrhafMerged into 1.0.x ✅
The Brevo newsletter subscription webform handler is now integrated directly into the Brevo module (brevo_contact), reusing the shared ContactsApiClientHelper so the module's single API key is used — per the "join forces" discussion in #3553922.
Features: email element mapping, one or more contact lists (fetched live), optional opt-in checkbox gating, attribute mapping, and double opt-in. Subscription runs in postSave() on completed submissions.
Includes a kernel test (subscription, opt-in gating, missing email, double opt-in) and config schema. The MR also cleaned up some pre-existing PHPCS naming and a PHPStan ignore so the module is fully green.
Thanks to @anybody, @stijnstroobants, @anruether and @kensae from the brevo_webform_handler project whose module and discussion led to this. This may also let us deprecate the contrib brevo_webform_handler in favour of the in-module handler (#3553922).