Code Action

The Code Action provides a great method to maximize your flows flexibility using Javascript language.

The language you can use is actually Javascript. We plan to add more languages in the future, starting with Python support.

You will mainly use the Code Action to develop “low code” automation when you need advanced features only provided by a programmatic approach. Keep in mind that no async features are allowed. You can only use synchronous coding. If you need to get some data from a remote web services you can do it prepending a Web Request action to the Code Action.

Use context.attributes.KEY or context.attributes[KEY] to read the value of a flow attribute


let age = context.attributes.age;

Use context.setAttribute(KEY, VALUE) to set the value of an attribute


context.setAttribute('age', 35);

In the following example published on Tiledesk Community you can test how the Code Action works.

Community Code Action example

In this example we execute a couple of tasks:

  1. Modify the existing “age” attribute set up using the Set Attribute action (age = 2)
  2. Add a totally new attribute (jsondata) to the flow

You are the able to see the result printed in the reply:


Use case: A/B testing with Code Action

Take a look at this Community Chatbot to create an A/B testing chatbot using the Code Action.


If you have questions about the Code Action or other Tiledesk features feel free to send an email to  or leave us a feedback.