# Shopify Event

**Shopify Event** starts a workflow when your Shopify store reports a change to an order: a new order, a payment, a shipment, a delivery, a cancellation or a refund (**Runs when: When an order, shipment or refund changes**). It does **not** need an agent attach.

Typical uses:

- **Confirm cash-on-delivery orders.** New order, payment method *Cash on Delivery* → the AI agent calls the customer to confirm the order and address before you ship. Fewer refused parcels.
- **Ask for feedback after delivery.** Shipment status *Delivered* → a call or SMS a day later.
- **Tell the customer about a cancellation or refund.** Order cancelled or refund created → SMS or email with the amount.
- **Alert your team about big orders.** New order over a set total → email or ticket.

## What you need before you start

- [Shopify connected](https://docs.voicelogica.ai/integrations/eshops/shopify/) to the company.
- For shipment events only: the store must grant Voice Logica access to shipments (`read_fulfillments`). The trigger shows a **Grant access in Shopify** link when this is needed; the store owner approves it once in Shopify.

## First setup

1. **+ Add Trigger - Shopify Event**

   **Shopify Events** — pick one or more:

   | Event | When it happens |
   |---|---|
   | Order created | A customer places an order |
   | Order paid | The order is marked paid |
   | Order fulfilled / partially fulfilled | You fulfil all or part of the order |
   | Order cancelled | The order is cancelled |
   | Refund created | Money is refunded |
   | Shipment created | A fulfillment is created, usually with a tracking number |
   | Shipment status changed | The carrier reports a new status (in transit, out for delivery, delivered, failed…) |

   Shipment statuses come from the carrier through Shopify. If your carrier doesn't send tracking updates to Shopify, **Shipment status changed** never fires.

2. Narrow it down (all optional; empty means any):

   - **Payment Status** — e.g. *Payment pending* for unpaid orders.
   - **Fulfillment Status** — e.g. *Unfulfilled*.
   - **Shipment Status** — shipment events only, e.g. *Delivered*.
   - **Payment Method** — matches if the method name contains the text, e.g. `Cash on Delivery`.
   - **Order Tags** — the order has at least one of these tags.
   - **Minimum / Maximum Order Total**.

3. From **Work Flow Triggered**, add the nodes. Use the values below in any text field, e.g. an SMS: `Hi {{customer.first_name}}, order {{order.name}} is on its way: {{fulfillment.tracking_url}}`.

4. **Save**. Voice Logica subscribes the store to the selected events a few seconds after saving. Removing the trigger or the workflow unsubscribes it.

5. **Test run**: fill in a sample order (event, payment status, phone…) and run. The filters are applied exactly as for a real event.

## Values you can use

| Value | Example |
|---|---|
| `{{event.topic}}` | `orders/create` |
| `{{order.name}}` | `#1001` |
| `{{order.financial_status}}` | `pending`, `paid`, `refunded`… |
| `{{order.fulfillment_status}}` | `unfulfilled`, `partial`, `fulfilled` |
| `{{order.total_price}}` / `{{order.currency}}` | `42.50` / `EUR` |
| `{{order.items}}` | `2× T-shirt M, 1× Hat` |
| `{{order.payment_gateways}}` | `Cash on Delivery (COD)` |
| `{{order.tags}}`, `{{order.note}}` | |
| `{{order.status_url}}` | The customer's order status page |
| `{{customer.name}}`, `{{customer.first_name}}`, `{{customer.phone}}`, `{{customer.email}}` | |
| `{{shipping.address}}`, `{{shipping.city}}`, `{{shipping.phone}}` | |
| `{{fulfillment.shipment_status}}` | `in_transit`, `out_for_delivery`, `delivered`… |
| `{{fulfillment.tracking_company}}`, `{{fulfillment.tracking_number}}`, `{{fulfillment.tracking_url}}` | |
| `{{refund.amount}}` | `10.00` |

Each value is also available as `{{node_<trigger id>.<name>}}`, e.g. `{{node_1.order.name}}`.

## Example: confirm cash-on-delivery orders

1. **Shopify Event** — Events: *Order created*. Payment Method: `Cash on Delivery`.
2. **Make Outbound Call** — Phone Number `{{customer.phone}}`, an agent prompted to confirm orders, and in **Context Info**: `Confirm order {{order.name}} ({{order.items}}, {{order.total_price}} {{order.currency}}) and the delivery address {{shipping.address}}.`
3. Optionally, on **Call Ends** of that agent, tag or cancel the order based on the answer.

## Set it up from your AI assistant (MCP)

Ask your assistant to create the workflow; it uses `add_trigger` with `triggerType: "onShopifyEvent"` and a `triggerConfig` such as:

```json
{ "topics": ["orders/create"], "paymentGateways": ["Cash on Delivery"] }
```

`connect_integration` with `shopify` shows the event status (`events`): events in use, events subscribed, access still missing and the last error. Step `install-url` with `extraScopes: ["read_fulfillments"]` returns the link the store owner opens to allow shipment events.

To check the workflow once for real (emails and SMS really go out and are charged), an admin or account manager can ask the assistant to call `run_workflow` with the Shopify trigger's `triggerId` (from `get_workflow`) and a `payload` with the order values the nodes use, e.g. `{ "event.topic": "orders/fulfilled", "customer.email": "you@example.com", "order.name": "#1001" }`. The result lists each node and which ones failed. `test_workflow` does the same as a dry run, without sending.

## Troubleshooting

**Why doesn't my Shopify event workflow run?**

Open the Shopify trigger: a warning shows if access is missing or Shopify refused the subscription (with **Retry**). Check that the order actually matches every filter, e.g. a *Payment pending* filter skips paid orders. Run a test with the same values to see which filter stops it.

**My store is connected with its own Shopify app token. Why don't Shopify events reach my workflow?**

Stores connected with an Admin API access token (the older custom-app method) can only send events if the app's API secret key was saved with the connection. Reconnect the store through the Voice Logica Shopify app.

**Why is the customer name or phone empty in my Shopify order workflow?**

The customer did not enter it at checkout. Add an **If/Then** on `{{customer.phone}}` before the node that places the call.

## Next Steps

[Shopify integration](https://docs.voicelogica.ai/integrations/eshops/shopify/) - connect the store.  
[Make Outbound Call](https://docs.voicelogica.ai/workflow-nodes/make-outbound-call/) - [SMS](https://docs.voicelogica.ai/workflow-nodes/sms/) - [If/Then](https://docs.voicelogica.ai/workflow-nodes/if-then-decision/).
