How to make REST calls from Camunda Platform 7 using a JavaScript Script Task?

From my understanding, by default, all JavaScript is processed with the GraalVM. However, functions like ‘request’ or ‘import’ is not recognized no matter if I used ecmascript or javascript.

So how does one make a REST call in a Script Task using JavaScript? Or is this just a fool’s errand.

Hi @Durian_Jaykin,

I would not do REST calls in a Java script Script task. These tasks are executed in the Engine on a JVM in the thread of the running process instance.

Your proposed approach will add two layers of complexity: GraalVM and Java Script.

It is much easier if you use the External task pattern (External Task Client | with the node.js external task client (GitHub - camunda/camunda-external-task-client-js: Implement your BPMN Service Task in NodeJS.) and write your REST call as an external task handler.

Hope this helps, Ingo

1 Like