4

We are trying to rewrite integration with Mailchimp by using API v3.0

In v2.0 they have method for adding members to static segments (https://apidocs.mailchimp.com/api/2.0/lists/static-segment-members-add.php)

Can't find this method in new API or some sort of replacement. Possible solution might be creation of new segment each time when new campaign started, but also can't find request sample for this.

If you have other ideas for workaround, please suggest. Any help is greatly appreciated.

ekad
  • 14,436
  • 26
  • 44
  • 46
Alexei P
  • 63
  • 1
  • 7

2 Answers2

1
  1. Make sure the email addresses are inside you main list
  2. issue a post request to /lists/your-list-id/segments
  3. build your data json

{"name":"Test-2",
 "options":{
"match":"all",
"conditions":[
{"condition_type":"EmailAddress","field":"merge0","op":"is","value":"email-1"},
{"condition_type":"EmailAddress","field":"merge0","op":"is","value":"email-2"}] 

} }

I was able to solve my issue looking at : Cannot create segment using MailChimp API v3

Community
  • 1
  • 1
xiarnousx
  • 575
  • 6
  • 18
  • I believe they fixed the API, because we received 404 error, but the path we used was taken from manual. Thanks for the response anyway! – Alexei P Jan 22 '16 at 18:07
  • So what's the right answer here? I still don't see how to do this in v3 – chrismarx Mar 18 '16 at 14:42
  • The right answer use merge0 u can see the fields by issuing api request to merge-fields – xiarnousx Mar 18 '16 at 16:02
  • Making a post request to the above url and with that json, I get a response back about how that segment already exists. It would appear (and it would make sense) that sending a post request to this url is trying to create a new segment, not add members – chrismarx Mar 18 '16 at 19:37
  • Try to make get request to merge_fields. Api docs http://developer.mailchimp.com/documentation/mailchimp/?utm_source=apidocs&utm_medium=internal_ad&utm_campaign=api_v3 – xiarnousx Mar 18 '16 at 19:54
  • One thing to note, segments are created on conditions and you are not allowed to have more than 10 conditions per segment. What I did, I have created a field for each account I am interested in, if the field does not exist then I would issue put request to create that field. Then when I am sending emails to mailcimp then I populate that field with segment name. I monitor the batch processing status and if processed I would issue a put request on segment with a condition to that matches the extra merge field value. That is how I worked it. You may find different approach – xiarnousx Mar 18 '16 at 20:02
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/106764/discussion-between-chrismarx-and-xiarnousx). – chrismarx Mar 18 '16 at 20:24
  • argh, I was looking to add members to a normal segment, which I now realize is automatic, the static segments had be confused, sorry for the confusion! – chrismarx Mar 18 '16 at 20:25
  • I am sorry, it's midnight here tomorrow morning I will update the answer and share my experience. Good night – xiarnousx Mar 18 '16 at 20:29
  • "match": "any" must be, if you set all api will find no result. – atromgame Sep 16 '21 at 10:48
0

v3.0 is RESTful, so just do the normal thing: POST to /3.0/lists/{list_id}/segments/{static_segment_id}/members with a member, you can get the format for that from the schema or take a look at an existing static segment and use that as an example.

TooMuchPete
  • 4,583
  • 2
  • 17
  • 21
  • Pete, thanks for answering. But it's not working. I'm receiving 404 error when trying to send POST or GET request to the specified path. Example: https://us11.api.mailchimp.com/3.0/lists/9d52874ebd/segments/17881/members Also can't find this path in documentation. Thanks again, – Alexei P Jul 29 '15 at 09:09
  • Hello,this did not work I got 404 Resource not found response {"type":"http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/","title":"Resource Not Found","status":404,"detail":"The resource 'Members_Collection' could not be found.","instance":""} – xiarnousx Jan 21 '16 at 12:21