Skip to content

Mailchimp Batch bulk update tags not working with PUT method #312

@ashwindas77

Description

@ashwindas77

Hi,

I tried to bulk update mailchimp tags using batch method. I used put method to do the same. But it is not working.

Attaching my code snippet. Please help me out,

$Batch = $MailChimp->new_batch();

    $list_id = "listID";
    $tagsSelected = ['tagFromAPI 99','tagFromAPI 00'];

    $Batch->put("op1", "lists/$list_id/members", [
        'email_address' => '[email protected]',
        'status_if_new'        => 'subscribed',
        'tags'          => $tagsSelected,
        'merge_fields' => [
                         'FNAME' => 'Jish3' ?: '',
                         'LNAME' => 'win' ?: '',
        ]
    ]);

    $Batch->put("op2", "lists/$list_id/members", [
                'email_address' => '[email protected]',
                'status_if_new'        => 'subscribed',
                'tags'          => $tagsSelected,
                'merge_fields' => [
                    'FNAME' => 'Lax2' ?: '',
                    'LNAME' => 'Sav' ?: '',
   ]
            ]);

    $Batch->put("op3", "lists/$list_id/members", [
                'email_address' => '[email protected]',
                'status_if_new'        => 'subscribed',
                'tags'          => $tagsSelected,
                'merge_fields' => [
                    'FNAME' => 'Lenity1' ?: '',
                    'LNAME' => 'Lancer' ?: '',
   ]
            ]);
    
    
    $result = $Batch->execute();
    $MailChimp->new_batch($batch_id);
    $result = $Batch->check_status();
    echo '<pre>';print_r($result);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions