Mailchimp API v3.0将订阅者添加到段,而不是在管理员中显示

I am trying to add a user that is in the list to a segment using drewm's Mailchimp php API wrapper

Creating the segment if it doesn't exist works fine, and it displays in the MailChimp environment. If I then try to add a subscriber using POST /lists/{list_id}/segments/{segment_id}, the API responds like it should, stating that the subscriber has been added to the segment, or telling me the subscriber hasn't been added if the subscriber is already in the segment. But in the MailChimp admin, the segment still displays as empty. Here is my code, I have no idea where I'm going wrong:

// Segmentation
// Check if event has segment linked, if not, create segment and add to post meta
$event_segment = get_post_meta($event->post_id, 'byron_mailchimp_segment', true);

if (empty($event_segment)) {
    // Create new segment,
    $create_segment_response = $MailChimp->post('/lists/' . $event_list . '/segments/', [
        'name' => 'Aangemeld',
        'static_segment' => [],
    ]);

    $event_segment = $create_segment_response['id'];
    // Save segment ID to post meta
    add_post_meta($event->post_id, 'byron_mailchimp_segment', $event_segment);
}

$add_to_segment_response = $MailChimp->post('/lists/' . $event_list . '/segments/' . $event_segment, [
    'members_to_add' => [$member['user_email']],
]);

echo "<pre>";
var_dump($add_to_segment_response);
echo "</pre>";

I've already checked if the $event_segment contains the right ID, and it does.

It's probable that this is a caching issue!

I've experienced something like this before, and it always shows up up a few minutes to an hour later.

Two suggestions to help diagnose:

  1. Try the API playground for extra confirmation that it's indeed there, while you wait!
  2. You may also be able to look "around" the problem by searching up the user's email and seeing if the segment's reflected on their individual entry. That wouldn't likely be cached.