# Where to start to import your npm package

**URL:** <https://discourse.nodered.org/t/where-to-start-to-import-your-npm-package/11799>\
**Category:** General\
**Created:** [3 June 2019 15:39 UTC](https://discourse.nodered.org/t/where-to-start-to-import-your-npm-package/11799 "2019-06-03T15:39:57Z")\
**Posts on this page:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![dustinw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dustinw/32/3426_2.png) [@dustinw](https://discourse.nodered.org/u/dustinw)\
**Post date:** [3 June 2019 18:37 UTC](https://discourse.nodered.org/t/where-to-start-to-import-your-npm-package/11799/21 "2019-06-03T18:37:22Z")

</div>

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:

1. Create and publish a node-red module with node(s) wrapping the package.
2. 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](http://nodered.org) repositories)
3. As per Steve-MCl .. you can try the NPM Node: [https://flows.nodered.org/node/node-red-contrib-npm](https://flows.nodered.org/node/node-red-contrib-npm)
4. Include the package via GlobalContext as per: [https://nodered.org/docs/configuration#node-configuration](https://nodered.org/docs/configuration#node-configuration) ... this will allow you to call the package in a function node

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [3 June 2019 18:46 UTC](https://discourse.nodered.org/t/where-to-start-to-import-your-npm-package/11799/22 "2019-06-03T18:46:44Z")

</div>

Just a note - node-woocommerce was last updated 3 years ago.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [3 June 2019 19:54 UTC](https://discourse.nodered.org/t/where-to-start-to-import-your-npm-package/11799/23 "2019-06-03T19:54:31Z")

</div>

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](https://github.com/TotallyInformation/node-red-contrib-jktesting) 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.

---

<div class="post-metadata">

**Author:** ![pviljoen](https://avatars.discourse-cdn.com/v4/letter/p/ba9def/32.png) [@pviljoen](https://discourse.nodered.org/u/pviljoen)\
**Post date:** [4 June 2019 21:54 UTC](https://discourse.nodered.org/t/where-to-start-to-import-your-npm-package/11799/24 "2019-06-04T21:54:40Z")

</div>

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.

[Previous page](https://discourse.nodered.org/t/where-to-start-to-import-your-npm-package/11799.md?page=1)
