Site Building

Configure MailChimp Webhooks for Drupal 7

This page is archived

We're keeping this page up as a courtesy to folks who may need to refer to old instructions. We don't plan to update this page.

Sprout Video

MailChimp has the ability to trigger a webhook, or push notification, whenever someone takes an action on their MailChimp account. For example, when someone unsubscribes from your mailing list by clicking the link in their email, instead of logging in to their Drupal account and using the checkbox provided there. Drupal, can be configured to listen for these webhook notifications, and take action whenever one is received. This is particularly useful for allowing Drupal to update cached data about subscribers in real time.

If you're using MailChimp with Drupal I highly recommend configuring the webhook integration. It helps to keep the information contained in Drupal and in MailChimp in sync. And, it is super easy to do. In addition, whenever a notice is received, the MailChimp module triggers hook_mailchimp_process_webhook(), documented in mailchimp.api.php. This allows your custom modules to respond to someone subscribing or unsubscribing from your mailing list in any way you want.

In this short tutorial we'll look at how to enable web hooks for your lists in MailChimp, and then talk about why this is an important feature to enable.

In order for the webhook integration to work your Drupal site needs to be accessible to the internet so that it can receive HTTP posts from MailChimp's API.

By the end of this tutorial you should be able to configure Drupal to respond to MailChimp webhook notifications.

Further your learning

  • Why is it important to configure the MailChimp webhooks?
  • Can you give an example of an action that would cause a MailChimp webhook to be triggered?

Series Sponsored by MailChimp