Automation rules
Every integration does part of its work by itself, in the background: it fetches orders, checks parcel statuses or orders a courier pickup. Complaia creates this work for you as one system rule per integration, and you set it on the integration's page. You can also add your own rules, for example "when an order gets the status Ready, create a DHL shipment". This page explains both.
Where to find it: Integrations → Integrations → Integration rules. To add a rule: Integrations → Integrations → New integration rule
When you'll use it
- Orders should arrive more often, or less often, than they do now.
- You want to stop automatic fetching and fetch orders only by hand.
- The daily courier pickup should be ordered at a different hour.
- A courier shipment should be created by itself when an order reaches a certain status.
- The order status should go to a shop only at a chosen moment, for example when the shipment gets its tracking number.
- A rule shows Error and you want to know what it does and whether it ran.
Key concepts
- System rule — one rule per integration that covers all its background work. Complaia creates it when you connect the integration. You cannot delete it or edit it as a rule. You change what it does with the settings on the integration's page.
- Your own rule — a rule you create. It reacts to something that happens to an order or a box, and it is built like a sentence: When something happens, Do an action, Only if some conditions are met, Then set an order status.
- A rule belongs to one integration. The actions you can choose depend on that integration. See Actions by connector.
- Orders from the integration itself — a rule of a shop, marketplace or hub works only for orders that came from that integration. A courier or printer rule works for orders from any source, and you can limit it to chosen order sources.
- A paused integration runs no rules. Neither its system rule nor your own rules run until you resume it.
- Tracking numbers are not sent by rules. The Automatic tracking push switch on the integration's page does it. See Mappings → Send tracking numbers back.
Rules created for you
The system rule is made of these background tasks:
| Task | Integrations | When it runs | Where you set it |
|---|---|---|---|
| Fetching new orders | Allegro, Apilo, Base, WooCommerce, Shoper, PrestaShop | Every 15, 30 or 60 minutes | Order synchronization on the integration's page |
| Changes in fetched orders — status and payment changes of orders already fetched | The same | At the same interval, but only when the other system sets the status or the payment | The status and payment settings. See Mappings |
| Access refresh | Allegro, Apilo | Once a day, at night | Nothing to set |
| Shipment status check | InPost, DHL, DPD, FedEx | Once a day, at the hour you choose | Background work on the integration's page |
| Courier pickup booking | InPost, DHL, DPD, FedEx | Once a day, at 15:00 unless you choose another hour | Background work, together with the pickup setting in Connection details |
The pickup task orders a courier only when the integration's pickup setting is the automatic one. For DPD with a standing pickup, it prepares the courier handover protocol instead.
The hours use the time zone of Poland. For the daily tasks you choose the hour, and Complaia chooses the minute.
On the rules list and on the integration's page, all these tasks are shown as one card called System rule. Click it to see what it does. To stop all of it, pause the integration.
The screens
Integration rules lists every rule, grouped by integration.
- Four counters at the top: Active, Inactive, Events and Schedules. The system rule counts as a schedule.
- Filters: All, Active, Inactive, and a list to show one integration only.
- Each rule card shows:
- the rule's name and its kind: created by the integration (the system rule), or Event rule;
- an Active or Inactive badge;
- a one-line summary, for example Order → Status changed → Create shipment. For the system rule, the summary lists the tasks that are on;
- the message from the last run, if there is one;
- the result of the last run (OK, Skipped or Error) and its time, or No execution.
- Click a card to open the rule. The bin icon deletes it. On the system rule the bin is switched off.
- New rule at the top opens the rule form. If you have no integration yet, the button is switched off and the list says Add an integration first.
The system rule page has two parts:
- What this rule does — the background work as it is set now, with a badge for each task: for example Every 30 min, Daily, Off or Paused.
- Background tasks — each task with its schedule and the result and time of its last run.
The Go to the integration page button at the top takes you to the place where you change these settings.
The rule form (New integration rule and the edit screen) has these steps:
- Integration — which integration the rule belongs to. You cannot change it after the rule is saved.
- When — the event that starts the rule.
- Do — the action.
- Only if — optional conditions: the new status, the previous status, the order source.
- Then — an optional order status to set after the action.
On the right, the Rule card shows the whole rule as one sentence. Below it are the Rule name and the Rule active switch.
📷 Screenshot to add: the rule form with all steps filled in and the rule sentence on the right
Common tasks
Change how often orders are fetched
- Open the integration from the Integration list.
- In Order synchronization, open the Fetch interval list.
- Choose Every 15 minutes, Every 30 minutes or Every 60 minutes, and confirm.
The next fetch happens after the new interval. Changes in fetched orders get the same interval.
If the section says Synchronization is not configured, click Enable synchronization and confirm. Complaia creates the order fetching again, with a 30-minute interval.
To pause only the fetching of new orders, switch off Fetching new orders in the same section and confirm. The window lists what keeps working, for example sending tracking numbers and fetching with Sync orders. When you switch it on again, the first fetch also picks up the orders placed during the pause, without running rules for them.
Stop fetching orders automatically
Use this when you want orders only when you ask for them.
- Open the integration.
- In Order synchronization, choose Do not fetch automatically in the Fetch interval list.
- Confirm with Do not fetch automatically.
From then on, new orders and changes in fetched orders arrive only when you click Sync orders. The integration's tile on the list shows a red warning icon.
To go back, choose an interval in the same list and confirm with Fetch automatically. The first fetch then picks up the orders placed in the meantime that nobody fetched by hand, without running rules for them.
Change the time of a daily courier task
- Open the courier integration.
- In Background work, open the list next to Shipment status check or Courier pickup booking.
- Choose the hour and confirm with Change time.
The minutes stay as Complaia set them. For example, a task at 13:27 moves to 15:27.
See what the system rule does
- Open Integration rules, or the integration's page.
- Click the card System rule.
The page lists each task with its schedule and last run. If a task shows Error, open the integration: the reason is under Last synchronization.
Create an event rule
Example: when an order from a shop gets the status Shipped, send that status to the shop.
Open New integration rule, or click New rule in Linked rules on the integration's page.
In Integration, choose the integration. A line below it says which orders the rule will apply to.
In When, choose the event:
- A new order arrives — an order is created by hand, or fetched from an integration;
- An order changes status — any status change, made by hand or by Complaia;
- The shipment of an order gets a tracking number;
- A box is closed in the warehouse — only for printing box labels.
For a shop, marketplace or hub, the events name the integration, for example "A new order arrives from" and the integration's name.
In Do, choose the action. Only the actions that match the event are offered.
In Only if, narrow the rule if you need to. An empty field means any value:
- New status and Previous status — for the status change event;
- Order source — for courier and printer rules.
In Then, optionally choose Set the order status. After the action succeeds, the order moves to that status. A completed or cancelled order, and an order whose status someone set by hand, is not moved.
Check the sentence on the right. Complaia suggests a Rule name from it. Change it if you like. Two rules of one integration cannot have the same name.
Leave Rule active on and click Create rule.
A changed rule works from the next event.
Send a status to the other system
There are two ways to send order statuses from Complaia to a shop, marketplace or hub.
Every change, automatically — set Order status is set by to the option named after Complaia. Every status change of an order from that integration is then sent, according to the status mapping. No rule is needed. See Mappings → Who sets the order status and payment.
Only at a chosen moment — use a rule. This works when the status is set by each system separately, or by the other system.
- Make sure the Status mapping of the integration contains the Complaia statuses you want to send.
- Create an event rule for that integration. Choose the event, for example The shipment of an order gets a tracking number.
- In Do, choose Send the status to …. The rule sends the status that the order has at that moment, translated by the status mapping. On the rules list and in the integration's settings, this action is called Update order status.
- Click Create rule.
You can also use Then → Set the order status together with Also send this status to …. The order then gets the new status in Complaia, and the paired status is sent to the other system.
Rules with Send the status to … send nothing while Complaia sets the status, because every change already goes on its own. The rule form and the last run of the rule say so.
Create courier shipments automatically
An event rule on an InPost, DHL, DPD or FedEx integration with the action Create a … shipment creates a shipment for the order and dispatches it to the courier.
- Create an event rule for the courier integration. See Create an event rule.
- Choose the event:
- A new order arrives — the shipment is made the moment the order arrives. Use Order source to limit the rule to the orders that should travel with this courier.
- An order changes status with a New status — the shipment is made when the order reaches that status.
- In Do, choose Create a … shipment and click Create rule.
Before you switch the rule on, note what it does:
- It uses the integration's Default service and default parcel size. The rule has no settings of its own.
- A dispatched shipment is a real, paid label. Try the rule on an integration in test mode first.
- When you fetch older orders with Sync orders, leave Do not run rules for these orders ticked. Otherwise the rule creates labels for those orders too.
If the courier refuses, the rule shows Error and the reason is written to the order's history in the Event log. Correct the problem on the shipment. See Shipments.
For InPost, DHL and FedEx there is also Cancel the … shipment, on the status change event. Use it, for example, to cancel the label when an order gets the status Cancelled.
Switch a rule off, or delete it
To switch a rule off:
- Open Integration rules and click the rule.
- Switch off Rule active.
- Click Save changes. Restore brings back the last saved state.
A switched-off rule stays saved, but does not run.
To delete it:
- On Integration rules, click the bin icon on the rule's card.
- Confirm with Delete rule. This cannot be undone.
The system rule can be neither switched off nor deleted. Change its tasks on the integration's page, or pause the integration.
Check whether a rule ran
- Open Integration rules.
- Find the rule's card. It shows the time of the last run and its result: OK, Skipped (the run was skipped, for example because the integration was paused) or Error. A message from the last run is shown on the card.
For more detail:
- System rule — open the integration and read Last synchronization.
- Your own rule — the card shows only the last run. When a rule fails for an order, the Event log gets an entry for that order with the rule's name and the reason. Search there for the order number.
Old schedule rules and tracking rules
You can no longer create schedule rules or rules that send tracking numbers. Background work is set on the integration's page, and tracking numbers are sent by the Automatic tracking push switch.
If you open an old rule of this kind, the form shows why it cannot be changed. Do this instead:
- An old schedule rule — check that the integration's page has the setting you need, then delete the old rule on the rules list.
- An old tracking rule — switch on Automatic tracking push on the integration's page, then delete the old rule.
Actions by connector
| Connector | Events (When) | Actions (Do) |
|---|---|---|
| Apilo, Base, WooCommerce, Shoper, PrestaShop | A new order arrives · An order changes status · The shipment of an order gets a tracking number | Send the status to the shop or hub |
| Allegro | — | No rule actions. Allegro does everything through its settings on the integration's page |
| InPost, DHL, FedEx | A new order arrives · An order changes status | Create a shipment (both events) · Cancel the shipment (status change only) |
| DPD | A new order arrives · An order changes status | Create a shipment |
| PrintNode (existing integrations only) | A new order arrives · An order changes status · A box is closed in the warehouse | Print the order label · Print the box label (box closed only) |
For a printing rule, the form also asks for the Printer, the Number of copies, a Print title prefix and the Label / PDF template.
When it doesn't work
| What you see | Why | What to do |
|---|---|---|
| The rule form says the integration has no actions that are set in a rule | The integration's work is set only on its page (for example Allegro). | Use the settings on the integration's page. |
| A rule with this name already exists for this integration. Use a different name. | Two rules of one integration cannot share a name. | Change the name. |
| This action does not match the selected event. | The event and the action do not fit together. | Choose the event and the action again from the lists. |
| This rule was created by the integration, so it cannot be deleted. | You pointed at the bin on the system rule. | Change its tasks on the integration's page, or pause the integration. |
| A Send the status to … rule shows Error with The order status has no match in this integration's status mapping | The order's status has no pair in the status mapping. | Add the pair. See Mappings → Map order statuses. |
| A Send the status to … rule sends nothing | Complaia sets the status for this integration, so every change goes on its own. | Nothing to fix. If you want to send only at chosen moments, change Order status is set by. |
| The edit screen says Rule paused | A status used in the rule's condition was deleted. | Choose another status in the condition and switch the rule on. |
| The edit screen says the rule cannot be changed in the form | It is an old schedule or tracking rule. | See Old schedule rules and tracking rules. |
| A rule has No execution for a long time | The integration is paused or not connected, the rule is inactive, or the event has not happened under your conditions. | Check the integration's state, the rule's Active badge and its conditions. |
| New rule is greyed out on the integration's page | The integration is paused. | Resume it first. |
| Order fetching for this integration is set to “Do not fetch automatically” | Fetching cannot be switched on while manual fetching is selected. | Choose an interval in Order synchronization. |
Permissions
| To do this | You need |
|---|---|
| See the rules list and the system rule | Integrations: View |
| Create, edit, switch off or delete a rule; change the fetch interval and the daily hours | Integrations: Manage |
Without Integrations: Manage, the New integration rule menu item, the New rule buttons and the bin icons are hidden, and a rule card does not open, except for the system rule.
Related
- Integrations — pausing an integration and fetching by hand
- Connectors — what each system can do
- Mappings — who sets the status and payment, and the status mapping
- Order statuses — the statuses rules can react to and set
- Shipments — courier shipments, labels and pickups
- Event log — where a rule leaves its result for an order