How to add additional Node Library

I want to add new node library in n8n https://www.npmjs.com/package/node-suitetalk

Hey @robin_singh!

You can refer to this thread to get your answer.

1 Like

@harshil1712 thanks for the info and I perform the below step:

  1. npm install n8n node-suitetalk
  2. export NODE_FUNCTION_ALLOW_EXTERNAL=node-suitetalk
  3. n8n
    n8n started,but I am unable to see the node-suitetalk node. I am new here and want to complete process how to use the external node library

Hey @robin_singh!

Do you want to create a node? The steps that you performed will allow you to use the library in the Function node and it won’t create a node for you. If you want to create a node you can refer to the documentation here.

Hope this helps! :slightly_smiling_face:

Hey @harshil1712,
Finally able to include the my custom node library in the Function node but I am stuck in code unable to get the input.Below is the reference code same code working locally but not working in n8n.

const NetSuite = require("node-suitetalk");
const Configuration = NetSuite.Configuration;
const Service = NetSuite.Service;
const Record = NetSuite.Record;
let customer_data = []; 
customer_data.push({
    json: {
      data:{}
    }
 }); 
const config = new Configuration({
    account: "******",
    apiVersion: "2019_2",
    accountSpecificUrl: true, // Enable for new format
    token : {
        consumer_key: "************",
        consumer_secret: "*******",
        token_key: "*******",
        token_secret:"****************"
    },
    wsdlPath: "https://webservices.netsuite.com/wsdl/v2019_2_0/netsuite.wsdl",
    //wsdlPath: "./wsdl/WSDL_  v2019_2_0/netsuite.wsdl",
});
 
const service = new Service(config);

service
    .init()
    .then((/*client*/) => { 
     
       const recordRef = new Record.Types.RecordRef();
       recordRef.internalId = 325;
       recordRef.type = "customer";
       customer_data[0].json.data= 2;
       return service.get(recordRef);
    }).then((result) => {
        console.log("result");
        console.log(JSON.stringify(result));
        customer_data[0].json.data= 3;
    
}).catch(function (err) {
    console.log("error");
    console.log(service.config.client.lastRequest);
    console.log("message");
    console.log(JSON.stringify(err));
});
 
return customer_data;

What do you mean with you are unable to get the input?
The incoming data can be accessed via the variable items.

The documentation of the Function-Node can be found here:

I mean to say that I install a node-suittalk library in the n8n and for same I added the above initialization code but the the flow not comes under the init method