Taking Advantage Of Mailchimp Web Hooks

mailchimp webhooks example

This article will guide you on how we can take the advantage of the Mailchimp web hooks in order to keep our database synchronized with mailchimp data. Actually in our database we stored the data from mailchimp user profile such as emailname and subscription status (i.e subscribed or unsubscribed).

Now to keep our database column updated there are two ways:

  1. Fire an mailchimp API call whenever the user signs in or update data once in day. But its way too costly. What if the profile data of the user updates occasionally ?
  2. Take advantage of the mailchimp web hooks which will only come into picture when data is updated at mailchimp.

Any intelligent programmer would always go with the second option. That a nice decision!

How to add web hooks?

Go to list tab
Select web hook option from settings
Create new web hook button
Add callback URL and option selection

Let’s take an example of Email changed web hook.

Suppose the user changes the email on the mailchimp. This will fire your configured callback URL you will get following parameters.

We can figure out the type of the callback from params[‘type’].

It will be upemail for email change, subscribed when a user subscribes for a list, unsubscribed when a user unsubscribes from the list. etc.

In case of the email change callback we get the following things

So on the basis of the parameters that we get in callback we synchronise the database!

So just follow the above steps and you re good to go !!!

Thanks for reading. If you liked it, press the heart button 🙂

Click here for more details…

At BoTree Technologies, we build enterprise applications with our RoR team of 25+ engineers.

We also specialize in Python, RPA, AI, Django, JavaScript and ReactJS.

Consulting is free – let us help you grow!

Related posts

Ruby on Rails Development Cost Breakdown for MVP & SaaS Platforms

by BoTree Technologies
3 months ago

7 Reasons to Consider React Native for Mobile App Development

by Sanjay Prajapati
5 years ago

How to Add Material UI to your Rails + React App

by Ankur Vyas
8 years ago
Exit mobile version