Closed mazero closed 6 years ago
Hi @mazero
Please make sure that req.body
is not empty, if it is it will lead you to error Please provide Email or SMS attribute value to create user
Hope that helps!
Regards SendinBlue Team
Req.body is not empty because if i dont’ use « req.bod » but i write real attribute I have the same error (Error: Bad Request) text: '{"code":"missing_parameter","message":"Please provide Email or SMS attribute value to create user"}',
// if not exsits, create new client sendinblue newsletter too
let newSendInBlueClient = {
listIds: [ '2' ],
email: "testor@testor.ch",
updateEnabled: true,
attributes: {
FIRST_NAME: "aaa",
LAST_NAME: "aaa",
EMAIL: "testor@testor.ch",
SMS: "0645535435"
}
}
let apiInstance = new SibApiV3Sdk.ContactsApi();
let createContact = new SibApiV3Sdk.CreateContact(newSendInBlueClient); // CreateContact | Values to create a client sendinblue
apiInstance.createContact(createContact).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
{ Error: Bad Request
at Request.callback (E:\www\setmassage-final\web\server\node_modules\superagent\lib\node\index.js:675:11)
at E:\www\setmassage-final\web\server\node_modules\superagent\lib\node\index.js:883:18
at IncomingMessage.
Provenance : Courrier pour Windows 10
De : Ekta Gupta Envoyé le :jeudi, 7 décembre 2017 13:07 À : sendinblue/APIv3-nodejs-library Cc : mazero; Mention Objet :Re: [sendinblue/APIv3-nodejs-library] "Please provide Email or SMSattribute value to create user" (#18)
Hi @mazero Please make sure that req.body is not empty, if it is it will lead you to error Please provide Email or SMS attribute value to create user Hope that helps! Regards SendinBlue Team — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast. https://www.avast.com/antivirus
Hi @mazero
Please change your sample to below and request will be good to go.
let apiInstance = new SibApiV3Sdk.ContactsApi();
let createContact = new SibApiV3Sdk.CreateContact(); // CreateContact | Values to create a client sendinblue
createContact = {
listIds: [ '2' ],
email: "testor@sendinblue.com",
updateEnabled: true,
attributes: {
FIRST_NAME: "aaa",
LAST_NAME: "aaa",
EMAIL: "testor@testor.ch",
SMS: "0645535435"
}
}
apiInstance.createContact(createContact).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
Thanks
listIds: [ '2' ] should be listIds: [ 2 ]
This should be included in the example, very helpful
I want to CreateContact but I have this error. "Please provide Email or SMS attribute value to create user" The documentation is very poor to the function 's properties
status: 400, text: '{"code":"missing_parameter","message":"Please provide Email or SMS attribute value to create user"}', method: 'POST', path: '/v3/contacts' },