Flow Manager — Actions Reference
This page is the developer-level reference for Flow Manager actions in yStore v2.2.1. For an overview of how flows work, see Flow Manager.
Architecture
Class hierarchy
Every built-in action extends AbstractActionDefinition, which implements StepDefinitionInterface.
Actions that can be executed also implement ExecutableActionInterface.
StepDefinitionInterface
└ ── AbstractStepDefinition (shared helpers, toArray())
└── AbstractActionDefinition (TYPE = 'action')
└── YourAction implements ExecutableActionInterface
All class paths are under the yui\craft\flow namespace:
| Class / Interface | Namespace path |
|---|---|
StepDefinitionInterface | yui\craft\flow\steps |
AbstractStepDefinition | yui\craft\flow\steps |
AbstractActionDefinition | yui\craft\flow\steps |
ExecutableActionInterface | yui\craft\flow\executors |
FlowContext | yui\craft\flow |
NodeResult | yui\craft\flow |
RegisterFlowDefinitionsEvent | yui\craft\events |
StepDefinitionInterface — required methods
Every action must implement these static methods:
| Method | Return type | Purpose |
|---|---|---|
handle() | string | Machine-readable identifier used in flow JSON (kebab-case) |
name() | string | Human-readable label shown in the flow editor |
description() | string | Long description shown in the node panel |
summary() | string | Short one-liner; defaults to description() |
when() | string | When-to-use guidance (optional, defaults to empty) |
how() | string | How-it-works text (optional, defaults to empty) |
usageExamples() | string[] | Bullet-point examples shown in the editor |
fields() | array[] | Field definitions — see field schema |
toArray() | array | Serialised representation for the flow editor API |
AbstractStepDefinition provides sensible defaults for all optional methods.
Additional static methods from AbstractStepDefinition:
| Method | Default | Purpose |
|---|---|---|
category() | 'general' | Groups the action in the node picker sidebar |
icon() | 'default' | Icon handle shown in the editor |
outputVariables() | [] | Keys this action writes to NodeResult::$data |
outputHandles() | ['default'] | Connection output slots (e.g. ['true','false'] for branches) |
inputHandles() | ['default'] | Connection input slots |
Field schema
Each element in the fields() array describes one configuration field in the node editor.
| Key | Type | Description |
|---|---|---|
handle | string | Required. Key used in $properties inside execute() |
label | string | Required. Field label in the editor |
type | string | Required. See field types below |
required | bool | Whether the field must be filled. Default false |
default | mixed | Pre-filled default value |
instructions | string | Help text below the field |
placeholder | string | Placeholder hint inside the input |
options | array | For select / selectize — array of ['value'=>…,'label'=>…] |
min | int|float | For number — minimum value |
max | int|float | For number — maximum value |
step | float | For number — step increment |
Field types:
| Type | Rendered as |
|---|---|
text | Single-line text input |
textarea | Multi-line text area |
number | Numeric input |
select | Dropdown |
selectize | Searchable select |
lightswitch | Toggle (boolean) |
boolean | Checkbox |
url | URL input with validation |
credential | Credential handle picker |
All text and textarea fields support Twig tokens referencing the flow context
(e.g. {{ customer.email }}, {{ order.reference }}).
FlowContext API
FlowContext is the shared data bus for a flow run.
It is passed to execute() and can be read and written by any action.
| Method | Signature | Description |
|---|---|---|
get | get(string $key, mixed $default = null): mixed | Read a context value |
set | set(string $key, mixed $value): void | Write a context value |
has | has(string $key): bool | Check key existence |
merge | merge(array $data): void | Bulk-import an array |
all | all(): array | Return all context data (used for Twig rendering) |
isDryRun | isDryRun(): bool | True when the flow is running in test/preview mode |
Public properties:
| Property | Type | Description |
|---|---|---|
$run | FlowRunModel | The current flow run record |
$flow | FlowModel | The flow definition |
NodeResult API
Return a NodeResult from execute() to signal success or failure.
| Static constructor | Description |
|---|---|
NodeResult::success(array $data, string $message, string $outputHandle) | Mark node as succeeded; $data keys become output variables |
NodeResult::failure(string $message, string $outputHandle) | Mark node as failed; stops the current branch |
NodeResult::paused(string $message) | Pause the run at this node (used by delay / wait nodes) |
The outputHandle parameter controls which outgoing connection the flow follows next
(e.g. 'default', 'true', 'false'). Default is 'default'.
Built-in actions reference
Actions are grouped by category as they appear in the flow editor node picker.
Communication
send-email — Send Email
Send a personalised email to one or more recipients using a system template, a Marketing Email Template, or a custom Twig template path.
| Field | Type | Required | Description |
|---|---|---|---|
recipients | text | Yes | Comma-separated addresses or Twig tokens resolving to addresses |
subject | text | Yes | Email subject line. Twig tokens supported |
templateHandle | selectize | No | System or marketing template handle. Prefix marketing:<id> for marketing templates |
templatePath | text | No | Path to a custom Twig template (used when templateHandle is empty) |
delayMinutes | number | No | Minutes to wait before dispatch. Default 0 |
Output variables: sentTo (array of addresses), subject
templateHandle takes precedence over templatePath. A value prefixed marketing:<id>
resolves to a Marketing Email Template from yStore → Marketing → Flows → Templates.
System handles are resolved through EmptyTemplate::getEmailTemplateByHandle().
send-email-template — Send Email Template
Simpler variant that sends a saved marketing template by handle.
| Field | Type | Required | Description |
|---|---|---|---|
templateHandle | text | Yes | Handle of the marketing email template |
to | text | Yes | Recipient email address. Twig tokens supported |
Output variables: templateHandle, to, sent
send-sms — Send SMS
| Field | Type | Required | Description |
|---|---|---|---|
phoneNumber | text | Yes | Recipient phone number. Twig tokens supported |
message | text | Yes | SMS body (max 160 characters recommended). Twig tokens supported |
provider | select | No | twilio (default), vonage, or generic |
from | text | No | Sender ID or phone number |
providerEndpoint | url | No | Custom endpoint for generic provider |
apiKey | text | No | API key or account SID. Twig tokens supported |
apiSecret | text | No | API secret or auth token |
send-push-notification — Send Push Notification
| Field | Type | Required | Description |
|---|---|---|---|
provider | select | Yes | firebase (FCM), onesignal, or custom |
title | text | Yes | Notification title. Twig tokens supported |
body | textarea | Yes | Notification body. Twig tokens supported |
url | text | No | Action URL opened on tap. Twig tokens supported |
recipients | text | No | Comma-separated user IDs, segment handles, or all |
send-telegram-message — Send Telegram Message
| Field | Type | Required | Description |
|---|---|---|---|
botToken | text | Yes | Telegram bot API token |
chatId | text | Yes | Chat, group, or channel ID. Twig tokens supported |
message | textarea | Yes | Message text. Twig tokens supported |
parseMode | select | No | HTML (default) or Markdown |
slack-notification — Slack Notification
| Field | Type | Required | Description |
|---|---|---|---|
webhookUrl | text | Yes | Slack incoming webhook URL |
message | textarea | Yes | Message text. Twig and Slack markdown supported |
channel | text | No | Override the webhook's default channel (e.g. #general) |
send-discord-notification — Discord Notification
Sends a message to a Discord channel via webhook.
send-teams-notification — Teams Notification
Posts to a Microsoft Teams channel via incoming webhook.
send-whatsapp — WhatsApp Message
Sends a WhatsApp message via a configured provider.
send-messenger — Messenger Message
Sends a Facebook Messenger message via a configured provider.
send-mailchimp — Add to Mailchimp
Adds or updates a subscriber in a Mailchimp audience. Requires a Mailchimp credential configured under Flows → Credentials.
send-in-app-message — Send In-App Message
Creates an in-app notification for the customer visible in the storefront notification centre.
create-notification — Create Notification
Creates an internal system notification visible in the Craft CP.
notify-team — Notify Team
Sends an internal notification to one or more Craft users or user groups.
Marketing
create-coupon — Create Coupon
Generates a new single-use coupon and attaches it to the flow context.
| Field | Type | Required | Description |
|---|---|---|---|
discountType | select | Yes | percentage, fixed, or free_shipping |
discountValue | number | No | Discount amount or percentage (not used for free shipping) |
expiresInDays | number | No | Days until expiry. Default 30 |
prefix | text | No | Code prefix (e.g. FLOW-) |
usageLimit | number | No | Max uses. Default 1 |
name | text | No | Admin label. Twig tokens supported |
siteId | number | No | Target site ID. Defaults to current site |
stackable | lightswitch | No | Allow stacking with other stackable coupons |
exclusive | lightswitch | No | Override all other coupons when used |
priority | number | No | Processing priority. Higher = evaluated first |
apply-discount — Apply Discount / Incentive
Generates and applies an incentive to the triggering order.
| Field | Type | Required | Description |
|---|---|---|---|
incentiveType | select | Yes | coupon, gift-card, or store-credit |
amount | number | Yes | Incentive value |
expiresInDays | number | No | Days until the incentive expires |
Output variables: incentiveType, amount, code
add-to-segment / remove-from-segment — Segment Membership
| Field | Type | Required | Description |
|---|---|---|---|
segmentHandle | text | Yes | Handle of the customer segment |
The customer ID is resolved automatically from the flow context (customer.id).
Output variables: segmentHandle, customerId
abandoned-cart-sequence-step-1 / -2 / -3 — Abandoned Cart Email (Step 1/2/3)
Renders one of the plugin's built-in abandoned-cart recovery emails. See Abandoned Carts → Built-in 3-step recovery sequence actions for the full sequence and placement rules.
| Action | Intended position | Content |
|---|---|---|
abandoned-cart-sequence-step-1 | Immediately after the Cart Abandoned trigger | "Did you forget something?" |
abandoned-cart-sequence-step-2 | After a 24-hour Wait node | "Your cart is still waiting for you" |
abandoned-cart-sequence-step-3 | After a further 48-hour Wait node (72 h total) | Final reminder with a coupon block — pair with create-abandoned-cart-coupon upstream |
Output variables: sentTo for Step 1; sentTo, couponCode for Step 2 and Step 3.
create-abandoned-cart-coupon — Create Abandoned-Cart Coupon
Generates a single-use recovery coupon for an abandoned cart, using the store's abandoned-cart coupon defaults unless overridden.
| Field | Type | Required | Description |
|---|---|---|---|
cartId | text | Yes | Used to deduplicate — an existing active coupon for the same cart is returned instead of creating a new one |
email | text | No | Customer email, stored for the Coupons admin list |
discountType | select | No | percent or fixed — override the store default |
discountValue | number | No | Override the store default discount value |
expiryHours | number | No | Override the store default expiry |
prefix | text | No | Override the store default code prefix |
Output variables: coupon (with coupon.code and coupon.discount available to downstream nodes, e.g. the Step 3 email).
subscribe-to-newsletter — Subscribe to Newsletter
Sets the customer's subscriber status to active.
No required fields — customer is resolved from context.
manage-subscriber — Manage Subscriber
Fine-grained subscriber management (status, lists, preferences).
win-back-campaign — Win-Back Campaign
Triggered win-back sequence for lapsed customers.
nps-csat-follow-up — NPS / CSAT Follow-Up
Sends a Net Promoter Score or CSAT survey to the customer.
channel-optimization — Channel Optimization
Selects the best communication channel for a customer based on engagement history.
churn-prediction-triggered — Churn Prediction Triggered
Executes a churn intervention action when the prediction model flags a customer.
Order management
update-order-status — Update Order Status
| Field | Type | Required | Description |
|---|---|---|---|
newStatus | text | Yes | Status handle to set on the order |
addNote | textarea | No | Note appended when changing status. Twig tokens supported |
Order is resolved from context (order.id / orderId).
add-order-note — Add Order Note
| Field | Type | Required | Description |
|---|---|---|---|
note | textarea | Yes | Note text. Twig tokens supported |
orderId | text | No | Order ID override. Defaults to context order |
isCustomerVisible | lightswitch | No | When enabled, triggers customer notification. Default false |
Output variables: orderId, note, isCustomerVisible, saved
add-order-tag / remove-order-tag — Order Tags
| Field | Type | Required | Description |
|---|---|---|---|
orderId | text | No | Order ID. Defaults to context order. Twig tokens supported |
tag | text | Yes | Tag string. Twig tokens supported |
cancel-order — Cancel Order
| Field | Type | Required | Description |
|---|---|---|---|
orderId | text | No | Order ID. Defaults to context order. Twig tokens supported |
reason | textarea | No | Cancellation reason for the audit log. Twig tokens supported |
restoreStock | lightswitch | No | Restore stock levels for cancelled items. Default true |
create-refund — Create Refund
| Field | Type | Required | Description |
|---|---|---|---|
orderId | text | No | Order ID. Defaults to context order. Twig tokens supported |
amount | number | No | Refund amount. Set to 0 for a full refund |
reason | textarea | No | Reason for the refund. Twig tokens supported |
Output variables: orderId, refundAmount, refundId
update-order-shipping-method — Update Shipping Method
| Field | Type | Required | Description |
|---|---|---|---|
orderId | text | No | Order ID override. Twig tokens supported |
shippingMethod | text | Yes | Shipping method handle |
shippingAmount | number | No | Override the shipping cost |
update-order-payment-method — Update Payment Method
| Field | Type | Required | Description |
|---|---|---|---|
orderId | text | No | Order ID override |
paymentMethod | text | Yes | Payment method handle |
paymentAmount | number | No | Override the payment amount |
update-order-address — Update Order Address
| Field | Type | Required | Description |
|---|---|---|---|
orderId | text | No | Order ID override |
addressType | select | No | shipping (default) or billing |
addressJson | textarea | Yes | JSON object with address fields |
The JSON object is written directly to shipping_address or billing_address on the order record.
Use the same keys as the order address model (e.g. firstName, lastName, address1, city, zipCode, countryCode).
update-order-item-custom-data — Update Order Item Custom Data
| Field | Type | Required | Description |
|---|---|---|---|
orderItemId | text | No | Item ID override. Twig tokens supported |
sku | text | No | SKU fallback when item ID is not provided |
customData | textarea | Yes | JSON object to write (e.g. {"giftMessage":"Thanks"}) |
mergeWithExisting | lightswitch | No | Merge into existing data instead of replacing. Default true |
update-order-customer — Reassign Order Customer
Reassigns the order to a different customer record.
generate-invoice-pdf — Generate Invoice PDF
| Field | Type | Required | Description |
|---|---|---|---|
orderId | text | No | Order ID. Defaults to context order. Twig tokens supported |
templateHandle | text | No | PDF template handle (e.g. invoice, receipt). Default invoice |
Output variables: orderId, pdfUrl, pdfPath
recalculate-order — Recalculate Order
Re-runs all price calculations (taxes, discounts, shipping) on the order.
| Field | Type | Required | Description |
|---|---|---|---|
orderId | text | No | Order ID. Defaults to context order |
Output variables: orderId, newTotal
Customer management
update-customer — Update Customer
| Field | Type | Required | Description |
|---|---|---|---|
customerId | text | Yes | Customer ID. Twig tokens supported ({{ customer.id }}) |
email | text | No | New email address |
firstName | text | No | New first name |
lastName | text | No | New last name |
phone | text | No | New phone number |
customFields | textarea | No | JSON object of custom field updates (keys = field handles) |
notes | text | No | Audit note for this update |
Leave any field empty to keep the existing value.
update-user — Update Craft User
| Field | Type | Required | Description |
|---|---|---|---|
userId | text | Yes | Craft user ID. Twig tokens supported |
firstName | text | No | New first name |
lastName | text | No | New last name |
email | text | No | New email address |
create-user — Create Craft User
| Field | Type | Required | Description |
|---|---|---|---|
email | text | Yes | User email address. Twig tokens supported |
username | text | No | Username. Defaults to email if empty |
firstName | text | No | First name |
lastName | text | No | Last name |
groupHandle | text | No | User group handle to assign the new user to |
block-customer — Block / Unblock Customer
| Field | Type | Required | Description |
|---|---|---|---|
customerId | text | Yes | Customer ID. Twig tokens supported |
blocked | lightswitch | No | true to block, false to unblock. Default true |
reason | text | No | Reason for the action (audit log) |
assign-user-group — Assign User Group
| Field | Type | Required | Description |
|---|---|---|---|
userId | text | Yes | Craft user ID. Twig tokens supported |
groupHandle | text | Yes | User group handle |
remove-user-group — Remove User Group
Same fields as assign-user-group — removes instead of adding.
update-customer-group — Update Customer Group
Updates the customer's yStore customer group.
suspend-user — Suspend User
Suspends the Craft user account. Suspended users cannot log in.
activate-user — Activate User
Activates a pending or suspended Craft user account.
Product
adjust-stock — Adjust Stock
| Field | Type | Required | Description |
|---|---|---|---|
productId | text | No | Product or variant ID. Twig tokens supported. Defaults to context product |
adjustment | number | Yes | Quantity adjustment. Negative values reduce stock |
reason | text | No | Reason for the adjustment (audit log) |
apply-catalog-rule — Apply Catalog Rule
Applies or re-evaluates a catalog pricing rule against a product.
Integration
http-request — HTTP Request
Make an arbitrary HTTP request to any external API.
| Field | Type | Required | Description |
|---|---|---|---|
url | text | Yes | Request URL. Twig tokens supported |
method | select | No | GET (default), POST, PUT, PATCH, or DELETE |
credentialHandle | credential | No | Reusable credential for auth headers |
headers | textarea | No | One header per line in Key: Value format. Twig tokens supported |
body | textarea | No | Request body for POST / PUT / PATCH. Twig tokens supported |
responseVariable | text | No | Context key to store the response data. Default httpResponse |
Requests to localhost, 0.0.0.0, .local addresses, and non-http/https schemes are blocked.
send-webhook — Send Webhook
Simplified HTTP action for webhook delivery.
| Field | Type | Required | Description |
|---|---|---|---|
url | text | Yes | Webhook endpoint URL. Twig tokens supported |
method | select | No | POST (default), PUT, or GET |
headers | textarea | No | One header per line. Twig tokens supported |
bodyTemplate | textarea | No | Custom JSON body. If empty, the full flow context is sent |
crm-sync — CRM Sync
Syncs customer or order data to a configured CRM integration.
ad-audience-sync — Ad Audience Sync
Adds or removes the customer from an ad platform audience (Google, Meta, etc.).
warehouse-erp-sync — Warehouse / ERP Sync
Pushes order data to a configured warehouse or ERP system.
bi-event — BI Event
Emits a structured event to a business intelligence pipeline.
google-sheets-append — Google Sheets Append
Appends a row to a Google Sheets spreadsheet. Requires a Google credential configured under Flows → Credentials.
send-mailchimp — Mailchimp
Adds or updates a subscriber in a Mailchimp audience list.
Entry / Element actions
These actions operate on Craft CMS element types.
- Entries
- Categories
- Users
- Other elements
| Handle | Action |
|---|---|
create-entry | Create a new entry in a specified section and type |
update-entry | Update fields on an existing entry |
delete-entry | Delete an entry by ID |
change-entry-status | Enable or disable an entry |
duplicate-entry | Duplicate an entry |
set-entry-field | Set a single field value on an entry |
copy-entry-field | Copy a field value from one entry to another |
relate-entries | Create or remove a relation between entries |
lookup-entry | Find an entry by query criteria and store it in context |
| Handle | Action |
|---|---|
create-category | Create a new category |
update-category | Update a category's fields |
delete-category | Delete a category |
lookup-category | Find a category by query and store in context |
| Handle | Action |
|---|---|
create-user | Create a Craft user account |
update-user | Update user fields |
lookup-user | Find a user by email / ID and store in context |
| Handle | Action |
|---|---|
lookup-order | Find an order by ID / reference and store in context |
lookup-product | Find a product and store in context |
update-global-set | Update fields on a Craft global set |
create-asset | Create an asset element |
delete-asset | Delete an asset |
Utility
set-variable — Set Variable
| Field | Type | Required | Description |
|---|---|---|---|
variableName | text | Yes | Context key to write |
variableValue | textarea | Yes | Value to assign. Twig tokens supported |
The value is rendered as a Twig string and stored in context under variableName.
conditional-set-variable — Conditional Set Variable
Sets a variable only when a condition evaluates to true.
log — Log
| Field | Type | Required | Description |
|---|---|---|---|
message | textarea | Yes | Log message. Twig tokens supported |
level | select | No | info (default), warning, or error |
Writes to Craft's application log under the flow category.
Useful for debugging flow runs without triggering a failure.
run-flow — Run Flow
Triggers another flow from within the current flow (sub-flow).
| Field | Type | Required | Description |
|---|---|---|---|
flowHandle | text | No | Target flow handle. Twig tokens supported |
flowId | number | No | Fallback flow ID when handle is empty or not found |
triggerHandle | text | No | Child trigger handle. Default manual |
mergeTriggerContext | boolean | No | Merge current context into the child flow trigger data. Default true |
math-expression — Math Expression
Evaluates a mathematical expression and stores the result.
| Field | Type | Required | Description |
|---|---|---|---|
expression | text | Yes | Math expression string. Twig tokens supported |
resultVariable | text | No | Context key to store the result |
Output variables: result
format-date — Format Date
Parses and reformats a date value.
| Field | Type | Required | Description |
|---|---|---|---|
inputDate | text | Yes | Date string or Twig token |
outputFormat | text | No | PHP date format string (default Y-m-d H:i:s) |
inputFormat | text | No | Input format for parsing. Auto-detected if empty |
Output variables: formattedDate
generate-hash — Generate Hash
Generates a hash or UUID value and stores it in context.
generate-qr-code — Generate QR Code
| Field | Type | Required | Description |
|---|---|---|---|
content | text | Yes | Text or URL to encode. Twig tokens supported |
size | number | No | Image size in pixels (64–1024). Default 256 |
Output variables: qrUrl, qrData
generate-pdf — Generate PDF
Renders a Twig template to PDF.
| Field | Type | Required | Description |
|---|---|---|---|
templatePath | text | Yes | Twig template path (e.g. _pdfs/invoice) |
filename | text | Yes | Output filename. Twig tokens supported |
variables | textarea | No | JSON object of additional template variables |
compress-image — Compress Image
Compresses an image asset to reduce file size.
json-parse — JSON Parse
| Field | Type | Required | Description |
|---|---|---|---|
jsonString | textarea | Yes | JSON string to parse. Twig tokens supported |
outputVariable | text | No | Context key to store parsed data. Default parsedData |
Output variables: parsedData, keyCount
json-build — JSON Build
Assembles a JSON string from Twig-rendered key-value pairs.
Output variables: jsonString
string-manipulate — String Manipulate
| Field | Type | Required | Description |
|---|---|---|---|
input | text | Yes | Source string. Twig tokens supported |
operation | select | Yes | trim, uppercase, lowercase, replace, substr, slug, etc. |
Output variables: result, originalLength, newLength
array-operation — Array Operation
Performs operations on array context variables (filter, map, sort, merge, unique, count, etc.).
Output variables: result, resultCount
cache-operation — Cache Get / Set
Reads or writes a value in the Craft data cache.
| Field | Type | Required | Description |
|---|---|---|---|
operation | select | Yes | get or set |
cacheKey | text | Yes | Cache key. Twig tokens supported |
value | text | No | Value to store (only for set) |
ttl | number | No | Cache TTL in seconds (only for set) |
Output variables: cacheKey, cacheValue, cacheHit
transform-data — Transform Data
Applies a Twig template transformation to reshape or extract values from context data.
Output variables: result
export-csv — Export CSV
Generates a CSV file from a context array variable.
| Field | Type | Required | Description |
|---|---|---|---|
filename | text | Yes | Output filename. Twig tokens supported |
headers | text | Yes | Comma-separated column header names |
rowTemplate | textarea | Yes | Twig template for each row. Each line = one row; columns separated by commas |
sourceVariable | text | No | Context key containing the array to iterate |
share-cart — Share Cart
Generates a shareable cart URL from the current order context.
create-task — Create Task
Creates a task in the yStore task management system.
Shopware-specific actions
These actions apply only to stores using the Shopware integration.
| Handle | Action |
|---|---|
shopware-send-voucher | Send a Shopware voucher to the customer |
shopware-update-customer-group | Move the customer to a different Shopware customer group |
Output variable reference
Output variables written by an action are available in subsequent nodes via the
Variable Picker ({}). The variable name is prefixed with the node's handle in the editor.
| Category | Action handle | Output variables |
|---|---|---|
| Communication | send-email | sentTo, subject |
| Communication | send-email-template | templateHandle, to, sent |
| Marketing | apply-discount | incentiveType, amount, code |
| Marketing | add-to-segment | segmentHandle, customerId |
| Marketing | remove-from-segment | segmentHandle, customerId |
| Marketing | abandoned-cart-sequence-step-1 | sentTo |
| Marketing | abandoned-cart-sequence-step-2 | sentTo, couponCode |
| Marketing | abandoned-cart-sequence-step-3 | sentTo, couponCode |
| Marketing | create-abandoned-cart-coupon | coupon |
| Orders | create-refund | orderId, refundAmount, refundId |
| Orders | update-order-address | orderId, addressType |
| Orders | recalculate-order | orderId, newTotal |
| Orders | generate-invoice-pdf | orderId, pdfUrl, pdfPath |
| Integration | http-request | configurable via responseVariable |
| Utility | set-variable | the named variable itself |
| Utility | math-expression | result |
| Utility | format-date | formattedDate |
| Utility | json-parse | parsedData, keyCount |
| Utility | string-manipulate | result, originalLength, newLength |
| Utility | array-operation | result, resultCount |
| Utility | cache-operation | cacheKey, cacheValue, cacheHit |
| Utility | transform-data | result |
| Utility | generate-qr-code | qrUrl, qrData |
Custom actions
Registering a custom action
Listen to FlowService::EVENT_REGISTER_ACTION_DEFINITIONS and push your class
into $event->classList.
use yui\craft\events\RegisterFlowDefinitionsEvent;
use yui\craft\services\marketing\FlowService;
use ycraft\craft\Event;
Event::on(
FlowService::class,
FlowService::EVENT_REGISTER_ACTION_DEFINITIONS,
function (RegisterFlowDefinitionsEvent $event): void {
$event->classList[] = MyCustomAction::class;
}
);
Registration should happen in your plugin or module's init() method.
Implementing a custom action
A minimal executable action:
<?php
namespace my\plugin\flow\actions;
use yui\craft\flow\executors\ExecutableActionInterface;
use yui\craft\flow\FlowContext;
use yui\craft\flow\NodeResult;
use yui\craft\flow\steps\AbstractActionDefinition;
use Craft;
class TagLoyaltyCustomerAction extends AbstractActionDefinition implements ExecutableActionInterface
{
public static function handle(): string
{
return 'tag-loyalty-customer';
}
public static function name(): string
{
return 'Tag Loyalty Customer';
}
public static function description(): string
{
return 'Adds a loyalty tier tag to the customer record.';
}
public static function category(): string
{
return 'customers'; // Groups this action in the node picker
}
public static function outputVariables(): array
{
return ['customerId', 'tag', 'applied'];
}
public static function fields(): array
{
return [
[
'handle' => 'tag',
'label' => 'Loyalty tier tag',
'type' => 'select',
'required' => true,
'options' => [
['value' => 'bronze', 'label' => 'Bronze'],
['value' => 'silver', 'label' => 'Silver'],
['value' => 'gold', 'label' => 'Gold'],
],
'default' => 'bronze',
'instructions' => 'The loyalty tier to assign.',
],
];
}
public function execute(FlowContext $context, array $properties): NodeResult
{
// Bail out during test runs without side effects
if ($context->isDryRun()) {
return NodeResult::success(
['customerId' => null, 'tag' => $properties['tag'], 'applied' => false],
'Dry run — no changes made.'
);
}
$tag = $properties['tag'] ?? '';
if ($tag === '') {
return NodeResult::failure('Tag is required.');
}
$customerId = $context->get('customer.id') ?? $context->get('customerId');
if (!$customerId) {
return NodeResult::failure('No customer ID found in context.');
}
// ... your business logic here ...
Craft::info("Flow: tagged customer #{$customerId} as {$tag}", 'my-plugin');
return NodeResult::success(
['customerId' => $customerId, 'tag' => $tag, 'applied' => true],
sprintf('Customer #%s tagged as %s.', $customerId, $tag)
);
}
}
Available registration events
| Event constant | Class | Registers |
|---|---|---|
EVENT_REGISTER_ACTION_DEFINITIONS | FlowService | Action nodes |
EVENT_REGISTER_TRIGGER_DEFINITIONS | FlowService | Trigger nodes |
EVENT_REGISTER_CONDITION_DEFINITIONS | FlowService | Condition nodes |
EVENT_REGISTER_LOGIC_DEFINITIONS | FlowService | Logic / control flow nodes |
All four events use RegisterFlowDefinitionsEvent with a $classList array of fully-qualified class names.
Testing a custom action
Use the flow editor's Test button to trigger a dry run. Inside execute(),
check $context->isDryRun() to skip side-effecting operations and return
a NodeResult::success() with mock data.
if ($context->isDryRun()) {
return NodeResult::success(['applied' => false], 'Dry run skipped.');
}
Log detailed information during development with Craft::info($message, 'my-plugin').
Flow run logs are visible at yStore → Logs → Automation.
Audience check
| Perspective | Assessment |
|---|---|
| Customer / storefront | No direct customer exposure. Actions run server-side during flow execution |
| Admin / Craft CP | Actions are configured in yStore → Marketing → Flows. Each action node renders fields from fields() in the flow editor panel. Flow run results and error messages appear in yStore → Logs → Automation |
| Developer / integrator | Full custom action support via EVENT_REGISTER_ACTION_DEFINITIONS. Implement ExecutableActionInterface, extend AbstractActionDefinition, define fields() and execute(). Use FlowContext for data exchange and return NodeResult |