Bulk update mailchimp tags via API in BATCH process not working

Viewed 160

I am using DrewM Mailchimp API v3. I tried to bulk update tags of my existing contacts using "BATCH" process and it is not working.

Can anyone help me out? Attaching the code snippet for reference.

I tried with both "PUT" and "PATCH". But both are not working.

    $Batch     = $MailChimp->new_batch();

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

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

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

    $Batch->put("op3", "lists/$list_id/members", [
                'email_address' => 'hije@example.com',
                '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);
0 Answers
Related