Automate with n8n
In this tutorial you connect n8n as your workflow engine. Then you create a workflow on the Order Status Changed trigger. The workflow sends a message to your team when an order changes to Cancelled.
What you need
- An n8n instance that the internet can reach, and an n8n API key. You can use n8n Cloud or your own server.
- A permission to manage integrations. The owner and the
Administratorrole have it. - For Telegram: a bot token and the chat identifier of your team chat. For email: SMTP credentials.
Steps
Connect n8n
Open the integrations page and select n8n. Enter the address of your n8n instance and your n8n API key. n8n uses an API key, so Miridia configures and activates it in one step.
If n8n is your first workflow engine, it becomes the default engine. Miridia creates each new workflow in the default engine. Read Workflows and events.
Create the workflow in Miridia
Open the workflows page for orders and create a workflow. Select the trigger Order Status Changed (OnOrderStatusChanged). Enter a title, for example "Tell the team about cancelled orders", and a description.
Leave the single action and multi action options off. The workflow then runs automatically each time the trigger occurs.
Miridia creates a new workflow in n8n. The new workflow has a webhook node that receives the events. Miridia activates the workflow, so the webhook works immediately.
Send a test event
In the portal, change the status of a test order. Then open the new workflow in n8n and look at the list of executions. Open the latest execution to see the order data that Miridia sent. Find the field that holds the new status.
Filter for cancelled orders
In n8n, add an If node after the webhook node. Make the condition true when the status field is Cancelled. The order status values are New, PendingCollection, PendingDelivery, Complete, Cancelled, PendingReturn, and Returned.
Send the message
Connect a Telegram node, or a Send Email node, to the true output of the If node. Write a message with the order code and the customer name from the event data. For example: "Order ORD-1042 for Coastal Deli is cancelled."
Save the n8n workflow. Do not change the webhook node. Miridia sends the events to its address.
Test the workflow
Cancel a test order in the portal. Make sure that the message arrives. Then change another order to Complete, and make sure that no message arrives.
Switch the workflow off
To stop the messages for a period, switch the workflow off in the portal. The workflow stays in n8n, but Miridia does not send events to it. Switch it on again when you need it.
{
"triggerId": 15,
"title": "Tell the team about cancelled orders",
"description": "Sends a message when an order status changes to Cancelled.",
"entityType": "Order",
"isSingleAction": false,
"isMultiAction": false
}
{
"isEnabled": false
}
Read the Workflow reference.