Closed matejicekme closed 5 years ago
+1 here. I'm having the exact same issue, even if my code looks pretty correct and the request I'm sending looks like the following:
email = info%40docendoacademy.eu
updateContact : {
"attributes": {
"field1": "a1v2",
"field2": "a1v2",
"field3": "a1v2",
"field4": "a1v2",
"field5": "a1v2",
"field6": "81100",
"field7": "+393999831122",
"field8": "+393999831122"
}
@ekta-slit any help with this ? This is the official SendInBlue NodeJS API for customers right ?
Thank you
Hi @matejicekme
Try console.error(error.response.text);
in case of error, you will get complete error message.
Hope that helps!
Thanks
Using code of @matejicekme I get the following error when I try to update a contact:
{
code: "invalid_parameter",
message: "Contact already exist"
}
Of course, contact already exists because I'm trying to update!!! I dont understand my error. It seems simpler to use a regular fetch to use your API
To fix this issue, I didnt pass email address within attributes key as if email is not different, I get this error message.
Did you find a solution for this problem ? I'm getting the same error message.
I'm also getting the same issue. I'm trying to update the token field of existing contact. Please help if someone has the solution.
Code :
exports.updateContact = (email,token, firstname,lastname)=>{
let apiInstance = new SibApiV3Sdk.ContactsApi();
let identifier = email;
let updateContact = new SibApiV3Sdk.UpdateContact();
updateContact.attributes = {"EMAIL":email,"TOKEN": token, "FIRSTNAME": firstname, "LASTNAME": lastname };
Object.keys(updateContact.attributes).forEach(key => updateContact.attributes[key] === undefined ? delete updateContact.attributes[key] : {});
apiInstance.updateContact(identifier, updateContact).then(function() {
return "done";
}, function(error) {
console.log(error);
return error;
});
};
Error:
status: 400, text: '{"code":"invalid_parameter","message":"Contact already exist"}', method: 'PUT', path: '/v3/contacts/shubham%40gmail.com'
Hi @ShubhamChndrvnshi
Just a quick check for you: Go to https://my.sendinblue.com/lists/add-attributes
in your Sendinblue account and see if the token attribute is created.
If that doesn't help then I request you raise a support ticket from your Sendinblue account so that we can replicate it and check your database configuration.
Happy to help!
Hi @ShubhamChndrvnshi
- Your code looks fine and I also tried to update an attribute value in my account to find that it is working good white_check_mark
Just a quick check for you: Go to
https://my.sendinblue.com/lists/add-attributes
in your Sendinblue account and see if the token attribute is created.If that doesn't help then I request you raise a support ticket from your Sendinblue account so that we can replicate it and check your database configuration.
Happy to help!
Hey shubham,
Thanks for the reply. I've got the solution for above query Just need to add updateContact.type = "type";
After adding above the code works fine for me.
Hi there,
Got an issue updating a contact, api return an error : "Bad request". Don't know if I miss something or anything else... Here's my code :
Of course my userInfos object return right datas.
Any idea ?
Thank you