Parameters

Parameters are placeholders that are used to modify the content and behaviour of actions when they are executed. You can enter any parameter placeholders into any text field in a WunderAutomation action. When the action is executed the placeholder values are replaced with values from the WordPress environment and the provided objects.

Find the full list of built in parameters here.

Let’s say you want to send an email to a WordPress user after the first login. You create an "Send email" action and set recipient to {{ user.email }} and perhaps set the email subject to "Hello {{ user.firstname }}. When the workflow is executed, the parameter names inside the double curly brackets will be replaced with the actual values for that user.

The easiest way to use parameters is via the parameter section in the top right corner of each action. It always shows the available parameters based on the objects that are available in the workflow.

image-20210319142403681

When clicking on a parameter name, the parameter editor pops to make it easier to define the exact behaviour of the selected parameter:

parameter editor

Depending on the selected parameter you will get different options. The resulting parameter is always displayed at the bottom of the parameter editor pop-up.

Parameter syntax

Most of the time, you will be able to get the parameter place holder using the popup parameter editor so you don’t have to learn the syntax by heart. The resulting placeholder syntax is always visible at the botton of the editor screen.

img

The parameter placeholders are always enclosed in double curly braces, {{ }}. The content of the placeholder is then divided into parts:

Part Description
Parameter name The name of the parameter. Always written in small caps. Most parameter names consists of two parts, the name of an object and the name of the parameter name, i.e post.id or user.email
Divisor | If the parameter placeholder also has modifiers, the name and the modifiers needs to be separated with a single pipe (|) character
Modifiers Modifiers are used to modify how the parameter is resolved at execution time. They can provide formatting patterns, default values etc. A modifier has the syntax name: ‘value’. Multiple modifiers are separated with comma (,)

Modifiers

To control the exact output of a resolved parameter, modifiers can be used.

Modifier Code Values Description
Return field as return value or label By default, parameters will return its internal value as represented in the database. Some parameters can also have a label, or "human readable" representation. I.e the post status "publish" is almost always written using the label "Published".
Treat field as type text, date, phone With some parameters, the returned value might need to be converted to a specific format.
Format (date) format Relevant for fields that return date values. Formats the date using PHP date() function (I.e Y-m-d H:i:s). If left blank, defaults to using WunderAutomation standard date time format. Read more about working with date parameters.
Add or subtract add Relevant for fields that return date values. Modifies the returned value using PHP strtottime() function. Read more about working with date parameters.
Format (phone) format e.164 Optionally formats the phone number in E.164 format for sending. SMS etc. If no country code is typed in by customer, E.164 formatting will use country code from customer billing country or WooCommerce shop address
Url encode urlenc yes / no If the returned value is going to be used in an API call, it’s sometimes needed to URL-encode it first.