Call API in Javascript Task Listener

Hello,

I am using Camunda (v. 7.16.0) that I installed in Azure from Docker. I am using Camunda Engine to support my .NET web application and I need to write a script that calls an API when a task is assigned.

I created a task listener of event type “assignment” that works with a simple script. However, when I try to call a REST API, I get the error: “org.graalvm.polyglot.PolyglotException: ReferenceError: $ is not defined”.

I tryed other alternatives to call an API such as “fetch” but I always got the same error.

Here is my example script:

var url = “https://localhost:4001/Workflow/SetDueDate?taskId=307ea72f-40a9-11ec-acb1-bc542fa1319c&dueDate=2022-11-11

var call= $.post( url, function() {});

Is there any example on how to do this? Do I have to change anything in Camunda’s configuration to be able to use the usual javascript methods?

Thank you