Camunda Node.js External Task Client 0.1.1 Released

  • Blog
  • >
  • Camunda Node.js External Task Client 0.1.1 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 recently published the first alpha release of camunda-external-task-client-js,
an NPM module that makes it possible to handle your BPMN Service Tasks in Node.js.

Today, a new alpha release is ready, bringing up major features that revolve around easily exchanging process variables between
Service Tasks and the Workflow Engine.

The feature set includes:

  • Accessing single/all variables
  • Creating/Updating single or multiple variables
  • Support for primitive (e.g. Integer) and complex variable types (e.g. JSON)

Let’s walk through a basic example to showcase some of these features:


A Workflow for Granting Loans

1. Running Camunda

First, make sure to have Camunda running.

2. Deploying the Workflow

Download the following model
and deploy it using the Camunda Modeler.

3. Installing the NPM package

Install camunda-external-task-client-js from npm using:

npm install -s camunda-external-task-client-js


yarn add camunda-external-task-client-js

4. Consuming Service Tasks in Node.js

const { Client, logger } = 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);

// create a handler for the task
const handler = async({ task, taskService }) => {
  // get task variable 'defaultScore'
  const defaultScore = task.variables.get('defaultScore');

  // set task variable 'creditScores'
  task.variables.set('creditScores', [defaultScore, 9, 1, 4, 10]);

  // complete the task
  try {
    await taskService.complete(task);
    console.log('I completed my task successfully!!');
  } catch (e) {
    console.error(`Failed completing my task, ${e}`);

// subscribe to the topic 'creditScoreChecker' & provide the created handler
client.subscribe('creditScoreChecker', handler);

The output should be:

✓ subscribed to topic creditScoreChecker
✓ polled 10 tasks
✓ completed task 897ce191-2dea-11e8-a9c0-66b11439c29a

Documentation & More Detailed Examples

The main goal of this post is to show a basic usage of the new alpha release of camunda-external-task-client-js.
To find out about the full range of features, you can check the documentation
or a more in-depth example.


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.