Setting custom icon and utilizing credentials

Hello everyone :wave:

Newbie here and first of all, thanks so much for the product! It’s the thing I didn’t know I need it until I tried it.

After playing around with the default nodes I have started writing my own node (fetching and aggregating some statistical data from an external platform). The core functionality is working as it should (yay!) but currently, it still has two flaws that bother me because I am sure they aren’t actually complicated.

  1. I am currently using credentials from the properties property of my description object but would like to utilize designated credentials like this. Is this even possible using the Create the first basic node steps from the tutorial or would it require the Create own custom n8n-nodes-module approach from that page? If it is possible, where would I define the path to the credentials (given that no package.json exists)?

  2. I can’t figure out how to get a custom icon to work, but how exactly would I reference a 60x60px png file (say, foo.png in the same ~/.n8n/custom/ directory as my node files)?

Thank you so much and sorry if these questions have been answered before (I didn’t manage to figure it out/find these details yesterday).

Welcome to the community @MutedJam and great to hear that you enjoy n8n and already started to create your own nodes.

To your questions:

  1. There is no need for a special package. You can not only have custom nodes in the ~/.n8n/custom folder you can also have custom credentials in it. As with the nodes, if they are present they will be read automatically and then available in n8n. There is this CLI which will make it easier to create and compile them.

  2. You can have the icon simply alongside your node. So if you use the above CLI to compile the nodes it will automatically copy also the icons it finds to the ~/.n8n/custom folder. In your case you can then simply reference it in the node via file:foo.png and it should work.

Hope that helps.

2 Likes

Perfect, thank you so much!

You are welcome. If you have any problems simply comment here again. If not, have fun!