Node API to change the status of a subscriber to "confirmed"

SoftTimur

Member
(* I understand that node-mialwizz is not your library, but your experience with PHP SDK may help *)

We are creating a web page where a user can set the subscription (or unsubscription) of several different lists. We thus need to update the database in MailWizz via API.

One possible case is that previously a user has unsubscribed from a list, now he wants to subscribe to it. So we need to change the status of this user (which exists already in the MailWizz) to "confirmed".

I have not found how to do that in API docs for Node or for PHP.

Does anyone know?

Thank you
 
Last edited:
Hello,
This is the endpoint that does it: https://api-docs.mailwizz.com/#update-a-subscriber
But you will need to specify the status under a details key, like this:

Code:
$response = $endpoint->update('LIST-UNIQUE-ID', 'SUBSCRIBER-UNIQUE-ID', [
    'EMAIL'    => 'john.doe@doe.com',
    'FNAME'    => 'John',
    'LNAME'    => 'Doe Updated',
    'details'  => [
        'status' => 'confirmed'
    ]
]);
 
Hello,
This is the endpoint that does it: https://api-docs.mailwizz.com/#update-a-subscriber
But you will need to specify the status under a details key, like this:

Code:
$response = $endpoint->update('LIST-UNIQUE-ID', 'SUBSCRIBER-UNIQUE-ID', [
    'EMAIL'    => 'john.doe@doe.com',
    'FNAME'    => 'John',
    'LNAME'    => 'Doe Updated',
    'details'  => [
        'status' => 'confirmed'
    ]
]);
Thank you for the help. I tried the following code in node:

JavaScript:
const { ListSubscribers } = require('node-mailwizz');
const config = {
    publicKey: 'key',
    secret: 'key',
    baseUrl: 'http://mail.mycompany.com/api'
}
// Configuration details directly in the class constructor
const subscribers = new ListSubscribers(config);
function updateSubscriber() {
    const userInfo = { EMAIL: "softtimur@gmail.com", DETAILS: { STATUS: "unsubscribed" } }
    subscribers.update({
        listUid: "at7108ma31614", // list "Company"
        subscriberUid: "dw203o7pwp562", // softtimur@gmail.com
        data: userInfo
    }).then(result => {
        console.log('Subscriber updated:', result);
    }).catch(err => {
        console.error('Error:', err);
    })
}

updateSubscriber();

It returned in the console

```
Subscriber updated: {
status: 'success',
data: {
record: {
subscriber_uid: 'dw203o7pwp562',
email: 'softtimur@gmail.com',
ip_address: '74.125.209.70',
source: 'web',
date_added: '2023-12-11 18:01:22'
}
}
}
```

However, the email is still confirmed in the list on our website of MailWizz. Do you know where may be wrong?
 
Last edited:
Back
Top