Best answer

Removing tags in mailchimp that match a pattern

  • 20 December 2022
  • 9 replies
  • 169 views

Userlevel 1
Badge

I am using tags in mailchimp to track characteristics of my contacts, e.g.:

  • payment tier status in our app (free, premium, enterprise) -- with tags ‘tier:free’, ‘tier:premium’ and so on
  • their role in their organization (physician, nurse, IT, etc.) -- with tags: ‘role:physician’, ‘role:nurse’ and so on

and a few others.  When things change (especially payment tier), I would like to remove the old tag and replace with a new one. 

 

Is there a way to avoid searching for each tier tag specifically (i.e. expressly searching for ‘tier:free’, then for ‘tier:premium’, etc.) but just search for any tags that start with ‘tier:’? 

icon

Best answer by MohSwellam 20 December 2022, 15:29

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

9 replies

Userlevel 7
Badge +8

Hi @RunForestRun 

 

What exactly is the trigger? “New or Updated Subscriber” in Mailchimp ? 

 

How will the Zap know which Tag is the new one and which is the old one? 

 

Also, are you updating those tags manually in MailChimp ? 

 

Please share more details (with screenshots if available) and phrase your question in the form of “When this happens, do that” so we can help you more. 

 

 

Userlevel 1
Badge

The trigger is a new or changed contact in hubspot, triggering an update to the corresponding contact in Mailchimp. 
 

each tag has a corresponding hubspot property, so setting the tag is easy.  But before I set the new value, I want to remove the old one. 
 

what I am focused on here in this question is whether there is a shortcut to removing the previous version of the tag when the corresponding property has been updated, rather than for example searching for each variation of the ‘tier’ tags.

Userlevel 7
Badge +12

Hi @RunForestRun 

you can only remove tags in Mailchimp using the Remove Subscriber from Tag in Mailchimp action. That action will only remove tags if the subscriber has the tag and it can only remove one tag at a time. 

My suggestion (if you Mailchimp plan supports it) would be to build some automations in Mailchimp so that when a person is added to a tag, old tags are removed. 

I.e.. Contact added to tier:premium => remove the tag tier:free. 

If that doesn’t work for you, then you could always attempt to build something out custom with the API to remove tags from a contact using a match expression. https://mailchimp.com/developer/marketing/api/list-member-tags/ 

Userlevel 1
Badge

I’ll investigate if that is a possibility -- thanks!

Userlevel 7
Badge +8

Hi @RunForestRun 

 

How will Zapier know which new property was recently added? This is going to be very difficult with the current setup. 

 

My workaround would be to use Airtable and have a separate field for all the properties / tags that you want to add. So we KNOW that this is the new tag that needs to be added and then we can use Paths + Filters to remove the corresponding tags before adding the new one. 

Userlevel 1
Badge

Oh, no, it’s actually easy w/ Hubspot -- there is an event for when a contact is updated, and you can trigger it based on any particular property getting updated, so that part is easy.  It is the tag management in mailchimp that is the problem.  Thanks for the follow up @MohSwellam !

Userlevel 7
Badge +8

Ah I see, 

 

This makes it a bit easier then. 

 

First, you will have a different zap for each Property in Hubspot. (so one for Payment and one for Role)

 

Then, once it triggers, you will use the Mailchimp action Find Subscriber which should return the current tags they have. (assuming its using this endpoint below. If it isn't, then you can use this with a Webhook. im not sure how you are currently looking up the member you want to update?). 

 

https://mailchimp.com/developer/marketing/api/list-members/get-member-info/ 

 

Once you get this data, you can use Paths by Zapier to REMOVE the current tag for this particular Property.

 

Example: 

 

John Smith has an updated Payment Property in Hubspot which will trigger a zap

 

The zap will search for John Smith in Mailchimp 

 

The data returned CONTAINS “tier:free” in the Tags

 

Path A > If Tags contains “tier:free”

Action Remove John Smith from this Tag

Action: Add John Smith to new tag. 

 

Path B > If Tag contains “tier:premium” > Will not run because he doesn't currently have this tag. 

 

Hope this was an easy to follow answer :)

 

Userlevel 5
Badge +7

Hey there @RunForestRun (🏃) 

 

Checking in with Moh’s newest post, are you all set now or is there anything else we can clarify for you in this thread? Looking forward to hearing from you! 

Userlevel 1
Badge

It’s fine.  There is no way to pattern match for the tags, so as Moh’s post says you still need to explicitly remove each one.  


Thanks everyone for the assistance!