The more data points about your newsletter subscribers you have, the more granular you can segment your lists and the more efficient your newsletters will be.
Often, the data you need is living in other systems, whether it’s your own database, CRM or payment system.

Let's see in this tutorial how to automatically get data from your database, transform it and push it to Mailchimp's merge fields.


Let's imagine a marketplace that lets students book lessons with teachers. All the students are part of a list in Mailchimp.

We have in our database all the data related to bookings. We would like to get in Mailchimp the number of bookings booked by each student and the date of the last booking.

We've created two merge fields in Mailchimp: "number_of_bookings" and "most_recent_booking" respectively with the types number and date.

Mailchimp Merge tags


Building the workflow

Let's import the table students and bookings from our MySQL database

Importing tables from our database

On the table bookings, in order to compute the number of bookings and the most recent booking data for each student, let's build a pivot table with the following parameters:


To be able to able to match a student in the database with a student in Mailchimp, we'll use the email as a unique identifier
Let's first get the email from the students table by doing a vlookup with the following parameters:

Getting the email address from the table "students"

Then, thanks to the email, let's retrieve the unique mailchimp id for each student. Let's add a vlookup with the following parameters:

We are now ready to program the push of data to Mailchimp:

Click on Program actions
Choose Mailchimp / Update an existing member / choose your mailchimp list
In Members, add id_members as a variable
Then add the mailchimp fields you want to map to fields in your Actiondesk dataset

And you're done, run once this workflow to see the results, and schedule and publish it!
Was this article helpful?
Thank you!