Skip to main content

How to Integrate Webform with Mailchimp (Drupal 10)

1. Install Webform Mailchimp, Mailchimp and Webform modules using composer

https://www.drupal.org/project/webform

https://www.drupal.org/project/mailchimp

https://www.drupal.org/project/webform_mailchimp

2. Go to https://us1.admin.mailchimp.com/lists/

3. Add a New List https://us1.admin.mailchimp.com/lists/new-list/

4. List Name: <name of the list>

5. From Email and From Name

6. Campaign URL Settings.
Choose a verified Campaign URL Settings

7. Remind People how they Signed up to your audience
Clearly Mention the Sign-up Source

"You had shown interest to <clear source>"

8. Choose Daily Summary - For Notification

9. In Drupal 9 website, go to admin/config/services/mailchimp

10. Get Account API at https://us1.admin.mailchimp.com/account/api/

11. Enter the API

12. You will see the Failed to Load PHP Library Error. Refresh the page

13. Go to Webfom -> Build -> Email/Handlers

14. Add handler

15. Choose Mailchimp (Add handler Button)

16. Choose the List

17. Match the Fields

Let us say Webform has Name and Email, Mailchimp List Forms should also have the same - Name and Email. Other fields should be deleted to avoid errors.

key from the webform will be mapped to the Field tag in mailchimp

18. Only Email is mapped by default. For the rest, you have to add them manually in the 

"Merge vars" textfield 
NAME: "[webform_submission:values:name]"

Note: Double Quotes are mandatory around [] for the first field. Otherwise, you will see a 400 error like: An error occurred subscribing email@example.com to list <list unique identifier> "400: Invalid Resource - Your merge fields were invalid. 

For multiple fields, enter each field in a new line
LNAME: '[webform_submission:values:LNAME]'
PHONE: '[webform_submission:values:PHONE]'
ADDRESS: '[webform_submission:values:ADDRESS]'

Single Quote is sufficient for 2nd entries onwards

P.S: the mapping is case insensitive. So lower will map to UPPERCASE (default) at mailchimp

NAME (mailchimp) --> name (webform)

Marketing
Drupal