Using Zenaton Node.js SDK

If your application is using node.js, you can us the Zenaton SDK to dispatch tasks and workflows and send events to running workflows. You will need to add it to the package.json file of your application:

  "dependencies": {
    "zenaton": "^0.7.3"

Then install the library:

npm install

In your application code, you can now set up a Zenaton Client with your credentials:

const { Client } = require("zenaton");
const zenaton = new Client("<app id>", "<api token>", "<app env>");

# Dispatch a task"<task name>", ...<task input>);

# Dispatch a workflow"<workflow name>", ...<workflow input>);

# Schedule a task

zenaton.schedule("<cron expression>").task("<task name>", ...<task input>);

"<cron expression>" format is described here.

# Schedule a workflow

zenaton.schedule("<cron expression>").workflow("<workflow name>", ...<workflow input>);

"<cron expression>" format is described here.

# Actions to workflows

Before being able to interact with a workflow, you need a way to identify it. Currently, there are 3 ways to select workflows:

Type selector value
by id"<id>")
by name"<name>")
by name and tag"<name>").withTag("<tag>")

This selector value should be used in requests below. For example:

const selector ="<name>");

# Send an event to workflows

selector.send("<event name>", ...<event data>);

# Pause running workflows


# Resume paused workflows


# Terminate running workflows


# Output

For those requests, the result is an object, such as:

  id: '<uuid>'


  • id is a unique uuid referencing your request. You may want to store this value to be able to reference it later

If you want to get the id or catch an error, you should do:

  .then( function ( result ) { ... } );
  .catch( function (err) { ... } )

or within an async function:

await run.workflow("myWorkflow");