Hi @pviljoen,
Depending on what you are trying to do, you might not need to create and publish a node to make use of the woocommerce package.
Some options:
- Create and publish a node-red module with node(s) wrapping the package.
- Create a node-red module ... but expose it to Node-Red by placing it in the correct path (This is good if what you are creating isn't really re-useable ... you wouldn't want non-reusable node-red modules muddying the NPM and nodered.org repositories)
- As per Steve-MCl .. you can try the NPM Node: https://flows.nodered.org/node/node-red-contrib-npm
- Include the package via GlobalContext as per: https://nodered.org/docs/configuration#node-configuration ... this will allow you to call the package in a function node
Just a note - node-woocommerce was last updated 3 years ago.
It would appear that the node you refer to is a fairly simple wrapper around the woocommerce API.
So it is likely to be fairly straight-forwards to use it in a custom node.
However, you've set yourself an interesting challenge by jumping in the deep end rather. Nothing wrong with that, just be aware.
There are several things you might want to consider that may be helpful depending on your knowledge.
-
Firstly, you might want to try calling the woocommerce API's yourself using Node-RED's built-in http-request node. This would familiarise you with the APIs and the data they return, it will also get you to set up the authentication and authorisation you need (see the part in that referenced node about a consumer key and secret).
-
Then perhaps walk through the code that Nick shared which would help you understand the structure of a custom node. I also have an example node here that covers a little more detail.
-
Also try a simple Node.js code file that uses the referenced package to get something simple back from the API so that you can see how that works and whether it is helpful.
Then you can probably put it all together.
Writing a custom node isn't very hard but it is detailed work that you need to go through step-by-step.
If you do decide to have a go, please let us know how you get on. And of course, we will try to help.
Thank you guys all the pointers are greatly appreciated. Give me a few days to work through all the pointers and then will come back with some more question.
Your help is greatly appreciated.