Camunda Node.js External Task Client 0.2.0 Released

  • Blog
  • >
  • Camunda Node.js External Task Client 0.2.0 Released

30 Day Free Trial

Bring together legacy systems, RPA bots, microservices and more with Camunda

Join the Camunda Developer Newsletter

Get the latest events, release notes, and product updates straight to your mailbox


We are so excited to announce a new alpha release of camunda-external-task-client-js,
an Node.js module that makes it possible to handle your BPMN Service Tasks.

This release is focused on making it more flexible to handle variables.
It improves setting variables and brings up two major features:

  • setting local variables
  • support for Date & File typed variables

The following example will illustrate these features and show how they can be used.


A Workflow for Handling Orders

1. Setup

  • first, make sure to have Camunda running
  • download the following model
    and deploy it using the Camunda Modeler
  • create an invoice.txt file with some data and place it in the same folder as the script
  • install camunda-external-task-client-js from npm using:
    npm install -s camunda-external-task-client-js


    yarn add camunda-external-task-client-js

2. Node.js Service Task Implementation

const {
} = require("camunda-external-task-client-js");

// configuration for the Client:
//  - 'baseUrl': url to the Workflow Engine
//  - 'logger': utility to automatically log important events
const config = { baseUrl: "https://localhost:8080/engine-rest", use: logger };

// create a Client instance with custom configuration
const client = new Client(config);

// subscribe to the topic: 'invoiceCreator'
client.subscribe("invoiceCreator", async function({ task, taskService }) {
  // Put your business logic
  // complete the task
  const date = new Date();
  const invoice = await new File({ localPath: "./invoice.txt" }).load();
  const minute = date.getMinutes();
  const variables = new Variables().setAll({ invoice, date });

  // check if minute is even
  if (minute % 2 === 0) {
    // for even minutes, store variables in the process scope
    await taskService.complete(task, variables);
  } else {
    // for odd minutes, store variables in the task local scope
    await taskService.complete(task, null, variables);

3. Results

The terminal output should be:

✓ subscribed to topic invoiceCreator
✓ polled 1 tasks
✓ completed task 21d19522-3e4c-11e8-b8df-186590db1cd7

Moreover, the added variables should be available in Cockpit in the history view of the process instance:

Cockpit History View

Documentation & More Detailed Examples

This example illustrates a basic usage of the new alpha release of camunda-external-task-client-js.
To find out more about this release, you can check out the documentation
or get the example running.


Your feedback is extremely important, so don’t hesitate to share it with us by:

Try All Features of Camunda Platform

Related Content

What are business processes, and why are they important? Learn how they work, types of business processes, & why well-orchestrated processes are critical.
Study demonstrates significant benefits to adopting Camunda and provides a powerful customizable tool to help you understand the impact it can have on your organization.
Learn how Samantha, as a developer and a new Camunda user, explored Camunda Optimize to enhance their development process.