Actions in Rivery Logic can be useful when there is a need to communicate with any REST service during the Logic’s run. It is possible to run an action which returns variables and then use those variables in other steps of the Logic. It is possible to run an action which uses variables and sends to this action variable of the Logic.
Why Using the Action Step in Logic?
Imagine a case you have a table which contains information about marketing campaigns, and there is a need to open a Support ticket in Zendesk service for any campaign that reaches some low limit of performance.
In Logic, you would be able to create a logic which its first step will be a query to get all of those campaigns, and then, for each campaign you’ll be able to call an Action that sends a REST API request to open a Zendesk ticket for this campaign - this action will get the campaign details during the logic’s run.
Add An Action to A Logic
Add a new Logic step using the button Add Logic Step at the bottom of the Logic screen.
In the newly added Logic step, click on the list in the top-left corner and select an Action.
If the Action already exists, select it in the list of Action rivers
(it is possible to search in that list)
Click on the button New Action to create a new action.
A new tab will opened with the screen of the new Action to create
(follow the instructions to create a new Action)
Once an Action is being selected in the Logic step, its input and output variables will be available in the step, and it will be possible to use those variables.
When an action is being selected, its action is shown in the connection input. If necessary, change the selected connection of the action, or create a new one. In case no connection is being selected, the action will use its original connection.
Using Actions Variables in Logic
In the following example, we have created a Logic of two steps.
The first step calls an Action that connects to Mixpanel API and returns a variable which is an array of events. Then, the second step, use this array and sends a variable to another Action.
Pass variables to action in Logic
Select the Required action in the Logic step (after the step type was selected as Action)
If the action has some variables (which are not private), all of those variables will be visible under its Input variables:
If the variable has some value that was configured in the Action, it will visible here.
Insert any other value to pass to the action. It is also possible to use here Logic variables (see example below).
Leave the value in order the action will run using its own variables values. In the example above the action variable “num_of_events” has a default value of 5 (which was configured in the action). We can send here any other number to the action.
Example: Send a Logic variable to an Action
In the following example, we send the Logic variable “event_name” to the Action variable “event”. The rest of the input variables of the Action are not being filled up, to the Action will run using its original variables values.