Add Organization Node.js not working

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 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 = {
    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’ }

Hi @Apoorva_Verma

You need to pass input as an object with content type and body. In your case

        contentType: 'application/json',
        body: input
}, (err, res, context) => {
    if (err) throw err;

More about that in SDK docs