I'm a beginner with npm and Js. Can someone ELI5 a bit how it all works?

If I find an npm module that is not written for node-red, can I do anything with it, in the context of node-red?

For example, I've been working with the Roblox API and came across this: https://www.npmjs.com/package/noblox.js

Can I work with this in node-red somehow?

Getting even deeper into details, using the API I can get back a URL of my user's avatar. I'd like node-red to then download the avatar and store it / display it.

Thanks for any hints!

You can build a node-red node (see the docs)

You can require a module in settings.js and use it like regular node in a function node. (Again see the docs)

You can use node-red-contrib-npm node to do ad-hoc require and use it in situ. (Search flows library)

However if it's just a rest API, just use the built in nodes.

There isn't much you can't do.

I've actually written protocol drivers for an old PLC in node-red using standard nodes.

Thanks!! So in theory I could build "Roblox nodes" for node-red using this module?

Also, Yes, it's just a rest API. I found it pretty easy, using Postwoman, for example to make queries and get the responses I expected. I guess I'm missing the point, why would someone create this npm module if working with the API directly is straightforward? What are the benefits? I guess if I knew what I was talking about, these questions would be obvious haha.

What I need to do is save the responses into variables so that I can build a kind of live dashboard.

Beats me. But seriously, it will likely simplify the requests to simple function calls. But if you are comfortable preparing URLs and setting headers etc, there is no real need.

You would store them in flow or global context of you need later retrieval.

If you're just beginning node red (or you aren't yet up to full steam ahead) this playlist is an easy watch and packed with top tips. https://www.youtube.com/playlist?list=PLyNBB9VCLmo1hyO-4fIZ08gqFcXBkHy-6

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.