Actions

What’s an Action?

Single running unit in Herogi is called as an action. For example sending an email, sms or push, calling a web service. Each action can have several functionality. Herogi scenarios use actions to act on specific events.

Action Structure

Each action consist of multiple parameters which differs from action to action. Parameters are just key/value pairs. As an example you can think email action has parameters like; to, from, subject, body, content-type.


SimpleEmailAction

to =  info@herogi.com 
from =  demo@herogi.com
subject =  Great Documentation!
body = You can learn how to use Herogi via knowledge base
content-type = html/text 

Recurring / Non-recurring Action Parameters

There are two types of action parameters, recurring and non-recurring.

Non-recurring action parameters are easy one, they can only exist once in an action. For example in case of email action there can be only one body or from.

In contrast non-recurring, recurring action parameters can be exist multiple times with different field name. For example, http post action can have headers parameter which is recurring. Then you can add several fields like content-type, Authorization

Customizing Action Parameters

Herogi comes with powerful scripting language, Freemarker. You can use it to generate custom dynamic action parameters.

Actions support loops, conditions, arithmetic operations, localization, variable substitution. To learn more about features check developer guide

Variable Substitution

With variable substitution, Herogi provides powerful customized actions like email, sms, etc. for your user. In each action context along with the functionality discussed above, Herogi brings every single event parameters and session parameters into scope.

For email action, body parameter can be written like;

 <div>
 
     Hello ${event.username.value()},
     <br><br>
     Welcome to <a href="http://herogi.com">Herogi</a>
 
 </div>   
 

This will generate an output for a sample event along with username Jenn like;

 <div>
 
     Hello Jenn,
     <br><br>
     Welcome to <a href="http://herogi.com">Herogi</a>
 
 </div>   
 

later on body will be rendered as html in Jenn’s email client.

Available Actions

Herogi supports different type of action groups like email, sms, utility from multiple vendors like Aws, Sendgrid, Twilio.

To see full list all of available actions check integrations.

Creating Your First Action

Action creating is really simple. Just go scenarios page and select the scenario you want to add action.

Create Action

Setting Action Parameters

After you created the action, you can set predefined action parameters with the actual values.

Add Action Parameters