I’m getting the following error when running this function to add a list of organizations to pipedrive:
if (err) throw err;
^
{
errorMessage: ‘HTTP Response Not OK’,
errorCode: 400,
errorResponse: ‘{“success”:false,“error”:“Organization name must be given.”,“error_info”:“Please check developers.pipedrive.com for more information about Pipedrive API.”,“data”:null,“additional_data”:null}’
My code for this function is:
function addToPipedrive(newHotels) {
newHotels.forEach((element) => {
const input = {
name: element.name
};
Pipedrive.OrganizationsController.addAnOrganization(input, (err, res, context) => {
if (err) throw err;
});
});
}
If I add a line - console.log(input) it shows:
{ name: ‘Meadows Camps’ }
{ name: ‘Hotel Valley View’ }
{ name: ‘Hill Paradise’ }
{ name: ‘OYO 24209 The Pearly Gate’ }