Using inline Javascript listener

Hi all, new to this forum, so hello! :wave:

I am using Camunda to piece together a workflow which consists mainly of microservices and a few user tasks, which are all tracked using an external DB populated by my own API. I’m currently using throw messages to trigger a nodejs external task client to update this API, but it occurred to me that I may be able to do something with listeners.
I see that I can specify either an inline or external script, and use JS also. I’m struggling to find any documentation on what methods are available within these scripts, and if it’s possible for instance, to call an external service from this code. Any advise?

Regards

Variables in scripts: https://docs.camunda.org/manual/7.9/user-guide/process-engine/scripting/#variables-available-during-script-execution

If you are already using the external task pattern, what makes you want to move away from this?

Thanks for the reply Stephen. I don’t necessarily, just exploring the framework and my options. It struck me that I may be able to have the service tasks update their status via listeners instead of explicitly having “update” messages either side of a service task. I think if I were using Java that may be feasible, but as things are now, maybe just stay as I am.

Ah yes okay makes more sense now. Yes I have done that many times. Additionally you may want to add another library so make you http calls easier such as: Replacing Http-Connector with Jsoup usage

You could also use the nashorn “load()” function to load a specific Js file on the class path allowing you to have reusable functions and save you some duplication of code