The new V3 API no longer provides ability to test segmentation options for new campaigns (v2 example campaignSegmentTest). Right now in latest 7.x version we have in mailchimp_campaign_save_campaign method on line 320

  // Test for valid list segment, if selected.
  if (isset($recipients->segment_opts)) {
    if (mailchimp_test_list_segment($recipients->list_id, $recipients->segment_opts->saved_segment_id) === NULL) {
      return NULL;
    }
  }

which will check only existing segment and stop us to create a new segmentation rules from API when segment_opts is set. As the docs say for segment_opts parameter:

This object should contain a saved_segment_id to use an existing segment, or you can create a new segment by including both match and conditions options.

For reference you can check https://developer.mailchimp.com/documentation/mailchimp/reference/campai... so when we set match and condition options the check from line 320 will fail and campaign will not be saved. I am not really into mailchimp API so I can't propose viable alternative but it seems like there is no substitute for campaignSegmentTest method right now. In all cases above check must be adjusted or removed.

Comments

zlatev created an issue. See original summary.

zlatev’s picture

zlatev’s picture

Status: Active » Needs review
firfin’s picture

For D8 this is fixed in #3079700: saved_segment_id attribute should be optional when a campaign has segment options which is very similar.
I do not have a D7 install handy for testing unfortunately.

xenophyle’s picture

Component: Lists » General
Status: Needs review » Closed (won't fix)

Thanks for submitting this ticket — and sorry we didn’t get back to you about it sooner. We are cleaning up old issues and issue for old versions and are going to close this one. If this issue is still relevant for you, please re-open it and update the “Version” field, and include any updates to the behavior you are seeing.With a smaller issue queue, we’ll have an easier time getting back to you.