---
title: "Recipe: low stock alert to Slack - Workflow Suite"
description: "Post a Slack message when the available quantity of an item at a location drops to your threshold, and add the product name with a query step."
canonical: "https://docs.workflow-suite.app/recipe-low-stock-alert-to-slack"
---

# Recipe: low stock alert to Slack

**Goal:** a Slack message when the available quantity of an item at a location drops to 5 or below.

**Template:** Low stock alert (category Inventory). **Steps:** 1. **Needs:** access to inventory, and a Slack incoming webhook URL.

## Create it

1. Create a Slack incoming webhook for the channel. Open **Secrets**, select **Create secret**, name it `SLACK_WEBHOOK_URL` and paste the URL as the value. See [Secrets](https://docs.workflow-suite.app/secrets.md).
2. Open **Workflows**, select **Browse templates**, search for `low stock` and select **Use template** on **Low stock alert**.

## How it is built

| Part | Setting |
| --- | --- |
| Trigger | **Inventory quantity changed** |
| Trigger filter | `event.payload.available` **is at most** `5` |
| **Send Slack message** | **Webhook URL** `{{ secrets.SLACK_WEBHOOK_URL }}` |

The message:

```liquid
Low stock: inventory item {{ event.payload.inventory_item_id }} has {{ event.payload.available }} left at location {{ event.payload.location_id }}
```

The rule sits on the trigger, not in a Condition step. Inventory changes all day; only the changes at or below your threshold start a run and count against your plan.

## Make it yours

1. Select the trigger and change the filter's **Value** to your threshold.
2. **Test** as a preview. Set `available` in the **Event (JSON)**. In a preview nothing is posted; the step shows the message it would have sent. Choose **Run for real** to see it arrive in Slack.
3. **Save** and **Turn on**.

## Add the product name

Shopify's inventory event carries ids, not names. The template **Low stock email with the product name** shows the fix: look the item up first.

1. Press **+** above the Slack step and select **Get Shopify data**. Pick the query `inventoryItem`, or paste:

```graphql
query ($id: ID!) {
  inventoryItem(id: $id) {
    sku
    variants(first: 1) { nodes { displayName product { title } } }
  }
}
```

2. **Variables (JSON)**:

```liquid
{ "id": "gid://shopify/InventoryItem/{{ event.payload.inventory_item_id }}" }
```

3. Run a **Test**, then pick the name for the message from the variable picker. With a step id of `item` it reads:

```liquid
Low stock: {{ steps.item.output.inventoryItem.variants.nodes[0].displayName }} has {{ event.payload.available }} left
```

The query needs access to products as well.

## One message, not ten

An item that goes from 5 to 4 to 3 posts three times. To be told once:

- Use the change trigger **Out of stock at location** instead, which starts only at the moment an item reaches zero. See [Change triggers with before and after values](https://docs.workflow-suite.app/change-triggers.md).
- Or remember that you posted: a **Key-value store** step writes `low:{{ event.payload.inventory_item_id }}` with **Forget after (seconds)** set to a day, and a Condition before the message checks that the key **is empty**. See [Key-value store and Storage](https://docs.workflow-suite.app/key-value-store-and-storage.md).
- Or send one summary a day with the template **Daily low stock report by email**.

See also [Slack, Discord and Teams messages](https://docs.workflow-suite.app/slack-discord-teams.md).
