Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add "Tags" to mailchimp subscriber via the api

Tags:

Looking to add tags to my mailing list members via the api. But I don't see where to pass in tags in the documentation. Can someone point to an example of how to update the tags associated with a member via the api?

like image 494
teamteama Avatar asked Sep 12 '18 15:09

teamteama


Video Answer


2 Answers

Tags replaced static segments. So, the endpoints used to create tags and add and remove tags from members are the same endpoints that were previously used to manage segments. Here is the documentation on the endpoints to use to manage your tags via the API that includes the request and response body parameters as well as example requests and responses:

http://developer.mailchimp.com/documentation/mailchimp/reference/lists/segments/

In order to add tags to your members, you need to include their email addresses in the 'static_segment' array parameter.

I hope that helps.

like image 158
Gerald Avatar answered Oct 19 '22 22:10

Gerald


If you want to create a member AND add a tag while doing so you may specify the tag attribute the following way:

$data = array(               'apikey'        => $api_key,               'email_address' => $email,               'status'     => $status,               'tags'  => array('your-tag-name'),               'merge_fields'  => array(                     'FNAME' => $fname,                     'LNAME' => $lname                   )             ); 

Even though MC API some places will tell you to fill out both a name and a status, it helped me to define tags as an array but ONLY pasting in the name of the tag.

Seefan's answer in this thread helped me out and I figured i wanted to help a person who spend days (like me) to figure out how the "tags" is specified: add tags to mailchimp subscriber created via api php

like image 35
m_h Avatar answered Oct 19 '22 22:10

m_h