Can I Call a Global Function in Any Workflow in Node?

This topic was automatically generated from Slack. You can find the original thread here.

Can I create a global functions (in node) that I can call in any workflow?

In Pipedream, you cannot create global functions that can be called across different workflows. However, you can create functions within a specific workflow and use them in the steps of that workflow. If you need to reuse code across multiple workflows, you can create a custom action and use that action in different workflows.

you can either publish node actions to your workspace that you can use within any workflow in your workspace, or you can also publish as a public NPM package.

Reusable functions could be nice.

It could be made possible via some kind of extension mechanism for steps, so that we don’t always need to start every node.js step from scratch.

And it would also allow to slightly customize existing actions without completely re-writing them.

Basically, to make this a bit more clear, the idea would be to be able to “import” an existing step/action into a node.js step.

Let’s say I want to do something custom with Slack, instead of writing everything from scratch, I could just import pipedream.actions.slack.send_custom_message;.

And to use “global functions”, I could just import pipedream.my_actions.my_global_function;

Or something along those lines.

Even better if it copies the props from the base action. So I guess it would go a bit beyond a simple import… :sweat_smile: