mailjet / mailjet-apiv3-nodejs

[API v3] Official Mailjet API v3 NodeJS wrapper
https://dev.mailjet.com
MIT License
232 stars 67 forks source link

contactslist - managecontact : name & properties not saved #267

Open vwasteels opened 7 months ago

vwasteels commented 7 months ago

Hello there,

This is my request :

const mjSubscription = await mailjet
.post("contactslist", {'version': 'v3'})
.id(process.env.MJ_CONTACT_LIST_ID)
.action("managecontact")
.request({
    "Name": user.first_name + ' ' + user.last_name,
    "Properties": JSON.stringify({
        "first_name": user.first_name,
        "last_name": user.last_name,
        "contakt_id": user.id,
        "employer_id": user.employer,
    }),
    "Action": "addnoforce",
    "Email": user.email,
});

const mjContact = mjSubscription.body.Data[0];
console.log(mjContact);

The properties are correctly set in Mailjet Capture d’écran 2023-12-05 à 10 57 25

But the Properties and the Name are not set in Mailjet

Any idea why ?

Thank you Vincent

Bartiff commented 5 months ago

I have the same problem, @vwasteels did you find a solution?

EDIT: After several tests, I observe that it works well. You should not use JSON.stringify. An object is indeed expected for Properties.