Zenaton Boilerplate

by zenaton-samples

GitHub Readme.md

Zenaton Samples - Abandoned Cart

The workflow launches when a shopper adds their first item to their cart and then, if they do not check out within the wait time, sends a series of communications to re-engage the shopper. The notifications include an in-app notification, an email reminder, and an email with a discount code. The shopper's user profile is updated each time a notification is sent.


The boot.js file is where you tell the Zenaton Agent where to find - by name - the source code of your tasks and workflows.

If you add a task or a workflow to your project, do not forget to update the boot.js file.

Look at Zenaton documentation to learn how to implement workflows and tasks.



This example project uses Slack API to send a notification and uses Sendgrid to send some emails.

Before getting starting, make sure you have a Slack Incomming Webhook URL available to send the Slack notification. If you don't have one yet, you can read the dedicated Slack documentation to set up one.

You will also need a Sendgrid API key to be able to send emails. If you don't have one yet, you can sign-in to your Sendgrid account and get an API here.

Starting the workflow

You can dispatch tasks and workflows by name from everywhere using Zenaton API. They will be processed as soon as you run this project.

Note: tasks and workflows are dispatched in an environment (AppEnv) of your Zenaton application (AppId). They will be processed by this project, if you setup it with the same AppId and AppEnv. You must also provide an Api Token to authorize access to this application (found at https://app.zenaton.com/api)

Run Locally

First, install dependencies:

npm install

Then, fill-in the environment variables referenced in the .env file.

Install a Zenaton Agent:

curl https://install.zenaton.com | sh

and run it:

zenaton listen --boot=boot.js

Run in Docker

Create your .env file

cp -n .env.sample .env

and fill-in the environment variables referenced in the .env file.

Then start your container:

cd docker && docker-compose up

Run on Heroku

Follow this button Deploy, then fill in the env variables and click "deploy".

Run somewhere else

Check our documentation for more options (AWS, Google Cloud, Clever Cloud ...)

Checking that your project is running

Whatever your installation method, you should see that a new Agent is listening from this url: https://app.zenaton.com/agents. If you do not see it, please check again that you have selected the right application and environment.

Dispatching Tasks and Workflows

Tasks and workflows can be dispatched by name from everywhere using the Zenaton API or our Node.js SDK.

You can use also the UI of our example app. After installation, you can (optionally) add your workflows and some examples of input and event in the public/config.json file. eg.

  "workflows": [
      "name": "AbandonedCart",
      "input": [ {"items": [], "email": "john.doh@gmail.com"}],
      "event": { "name": "checkout" }

You need to rebuild your example app after having modified this file. If you prefer, you can update directly dist/config.json and simply reload the page - but your changes will be lost at the next rebuild.

Monitoring Tasks and Worklows Processing

Look at your dashboard (if you do not see your dispatched tasks or workflows, please check that you have selected the right application and environment).