# Custom n8n nodes - Bram Knuever

## Метаданные

- **Канал:** n8n
- **YouTube:** https://www.youtube.com/watch?v=bq4n0LsY2S8
- **Дата:** 06.05.2024
- **Длительность:** 16:21
- **Просмотры:** 4,148

## Описание

Learn about the possibilities of extending n8n with custom nodes, and the pros and cons of doing so, in this presentation by community member Bram Knuever.

This presentation was part of the April 12 hangout - see the full video here: https://www.youtube.com/watch?v=K9P9phm33m4

## Содержание

### [0:00](https://www.youtube.com/watch?v=bq4n0LsY2S8) Intro

um so what do you do if there's no native apps uh or no native notes uh for your app um of course you can not automated not we we'll skip that um you can find a community note there's uh 563 at least when I created this uh this thing um that that's plenty I think um there's also uh more notes coming uh pretty much every day so maybe it's more you can use the HTP Noe like was just shown uh that's a little bit complicated for some things uh but sometimes the API is fine and can easily be used depends on documentation of course and on your level of expertise which can also develop your own um you can do this for apis but you can also do it for logic so for example if you have a little bit of code where you do uh some modification of the data or stuff like that um you can also just create a note for that one example is for example the uh node that we created to compare two sets of Json uh where you actually just yeah you push into Data ass sets and then the comparison is revealed uh that was made with an external package making it very easy and if you do not have um the capability or the time to create your own noes you can also hire someone like me or one of the other partners or developers that are available uh to create your nodes so of course always a choice now as you can see there's a lot of notes uh you can find them on mpm uh pretty much all of them should be o open cuz that's npm of course uh there's also some duplicates so for example a Discord we'll probably have more than one note probably more than five actually um so then you have to choose what works best for you of course you can just test them out and see how it works and if it's doing what you want or even install multiple if one has the one function the other has as other function that you want to use um there's plenty to

### [2:35](https://www.youtube.com/watch?v=bq4n0LsY2S8&t=155s) Pros and cons

choose I get asked a lot um if uh they should develop a node for my clients there are some pros and cons of course um and it's basically these things so the usability is of course a lot better if you have just a node then almost everyone can use it so you don't have to do all those things like uh was just shown it makes a lot simpler for the less technical people um and of course you can then reuse it and make and use it easily uh you only have to research the API once as you have seen with amadan um if you have to search the API if you if you need a new functionality uh and for example if it's like 3 months later uh good luck because then you have to pretty much start from scratch at least I don't remember a lot of things three months later uh so if you create the note you only have to research everything once because you're diving into it you're creating the note and everything is in it right uh of course maybe not with all the functionality but probably that you're actually going to use and as well the credentials also showed you uh that you can use predefine uh credentials it's very nice to just create your own node have your credentials in there and everything works um sometimes an API is uh fairly annoying with their credentials and then it's very easy to just have it in the node and it works instead of having your generic credentials even some options are not possible in the generic uh credentials and then you can add those things in the custom credentials as well uh there's of course some cons uh yeah it takes a lot of time to create a node uh depends on on your skill level and experience with creating nodes of course and also um how much functionality you're going to put in it but of course you can um uh just have it uh be done by some someone else and then it might take less time of your own time at least um and you cannot start automatic directly because of course the node needs to be created so if you need something quick then you'll just use the HTTP node um and it will be fine um so the flexibility is also of course an issue uh or at least not an issue but uh if you need to add some functionality that's going to be annoying to um to add because the guy that created the node has to add it them um so that's a bit of an annoyance but you can use the HTTP request Noe as amadon showed uh to use at least the same credentials and everything is set up and then you just have to do that one thing with um with the HTTP request Noe and of course if it's something that you need to do once and it's not too big of a deal you cannot have it be uh put into the node itself that's of course a choice uh you can

### [6:08](https://www.youtube.com/watch?v=bq4n0LsY2S8&t=368s) Logic nodes

make and for the logic nodes there's pretty much the basic uh or the same uh pros and cons but you have um also the reusability because of course if you use code and for example with parameters that you can change and then reuse the code somewhere or whatever um for a less technical person having them going into the code changing something and then uh moving ahead with that uh that's not going to happen probably uh or at least it will only cause issues uh at least in my experience uh which cause causes more time to fix it and and deburing and stuff like that so that's very annoying so for the logic as well it's very nice to just create a note out of it doesn't have to be very difficult like I just said as well with the Json compare node there's simply an external package um you can just make sure that's installed with the node that you just have the options for that and then you can just use that so the uh Json compare node I think was created in like two or 3 hours um and that was while also talking to the person I was making it for um talking and explaining how it works and stuff like that it can go very fast uh and it's very useful so if you have stuff like that then it can be worth it to just create it and then use that and of course flexibility again but yeah uh you can use cod note that and

### [7:52](https://www.youtube.com/watch?v=bq4n0LsY2S8&t=472s) Community nodes

stuff sadly um and Cloud doesn't support Community nodes I had to include it I'm sorry for the NN team but uh I I have to do it um it's fair we know I I really want to promote Cloud more but yeah I I'm a big user of community noes and stuff so and we are aware of course right so we are having conversations about how to fix this there's obviously some security issues around this that's that give us pause however we are working on a lot of in infrastructure improvements and with luck we can actually support custom no and Cloud later as well that would be perfect because then I can finally push some of my clients to Cloud because they don't need their own server but yeah all well so how do we

### [8:44](https://www.youtube.com/watch?v=bq4n0LsY2S8&t=524s) Note nodes

get started if you have a note you want to create I'm not going through the whole thing because there's enough documentation and there's a video of Marcus uh doing it and everything um so I'm just going to do a few little things and some tips there is a node starter which is uh actually perfect because I've always used it uh when I started creating notes there wasn't a not stter but now there is uh so since it was there I've used it uh you can just go to the ga page and then use this template then you get a copy of the repo uh there's two different nodes in there as an example so the programmatic style one and the declarative Style one I've never used a declarative style so I cannot even help you with that uh because when I started creating notes it wasn't an option so I stick with what I have learned in the past um so you basically get this template and then remove the one that you don't want uh so for example if you want the programmatic style one then you keep the example Noe and remove the HTTP bin Noe after that

### [9:58](https://www.youtube.com/watch?v=bq4n0LsY2S8&t=598s) Baby steps

make sure to go with baby steps uh so for example if you start with starter just make sure to delete everything you don't need so the other node and maybe if you doing a logic node uh remove the credentials stuff like that and change the names of the node and the parameters that needs to be changed uh and just test if it works because the example node should work uh out of the box bit the template of course um so make sure it still works after you change the names and stuff like that on the logo maybe uh just make sure it works before you even start building the node itself um and then design the node before you actually start building the functionality inside it because if you just start coding away you might recognize it if you have coded anything uh it's going to get messy very fast so just make sure you know what to build and then uh build it I always start with the UI because then you get a feeling of all the things that you want to be able to do with it makes you also think about those things so if you are not uh designing it per se at the start then the UI will force you to still think about uh the actual functionalities and after that you can just uh create the functionality like the API calls or the logic or whatever you need and do not reinvent the wheel I am not actually a programmer I used to be a bi consultant uh know a lot of scripting and stuff like that but I'm not a programmer I can do it a bit um you just grab whatever you need because all the source code is available uh so you can just uh Peak into the code of the notes uh that have the certain um options uh that you need so for example if you need the button with options with a M multiple options that you can um select and stuff like that just grab it from a note that you already know that it has it um you don't have to reinvent the wheel and saves a lot of time and Hassle and stuff like that are any questions

### [12:25](https://www.youtube.com/watch?v=bq4n0LsY2S8&t=745s) Questions

uh there are I have two questions here on the list so far uh well one is a suggestion um let me start with a question can I create private Community nodes as well so do you always need to publish them to mpm or are there other delivery methods you don't have to publish them uh you just have to make sure you install them with nadn when you want to use them uh that's a question I always ask my clients um do you want to publish them and I always recommend just publish them because it's easier to install them if you do and it's also just giving back to the community uh so like 90% just want me to publish them after nice that's really cool yeah and second one is a suggestion which I think is interesting um that says it would be very nice if you could simply convert the code node into a custom node so that you could use you could predefine inputs the moment I make do with creating a corresponding workflow and executing it either via HTTP node or execute workflow node so that's kind of an interesting idea so you could like convert it into a uh a ready to use or share yeah I actually created a node which started as a logger node where you can put uh parameters in and then it will run um a sub workflow and then you can choose if it Returns the data from the sub workflow or it doesn't and you let it not do that if you just log it cuz then it will just continue the flow and it has locked some data for example but you can use that sort of a function node where you can just put the parameters in and then move to a sflow and then grab those parameters do something with a code for example and if you make that smart enough with expressions and stuff like that you can basically uh create whatever you want inside that Z workflow and then it's also not bound to the code no so it's already doable then if you are not in Cloud yes yes yes I know uh okay um next question it's a bit long um regarding custom nodes are there any plans to add JS doc strings to the different interfaces and properties in the n8n base it can be difficult to understand what the different property values are Etc um that's really a question for our uh product and engineering team I do not have an answer for you but we can definitely look into that and share more information one for the Forum y exactly um unless there is someone from those teams online who can jump in real quick now not even John knows it happens you still in my shed okay last question I have here is there documentation for the API to custom nodes for example node API error is a document apart from in the n8n IO code sorry what I don't really follow this question is there documentation for the API to custom for custom nodes for example node API error again let's look into that and we can post about the Forum afterwards if it's about a code that you have to use for the errors um you can just steal it from other nodes that's basically how I do it okay all right that's the questions I have here unless there's more Louis are we all good yeah all good those are all the ones okay well BR this is why you do your pitch for your services no I just have it on screen and you can email me if you need me all right well everyone already knows you I suppose right so

---
*Источник: https://ekstraktznaniy.ru/video/15668*