---
updatedAt: 2026-07-28T10:31:50.000Z
agentTools:
  siteIndex: https://documentation.bloomreach.com/llms.txt
  projectIndex: https://documentation.bloomreach.com/engagement/llms.txt
---

# Low voucher stock notification

This guide shows you how to build a scenario that monitors your voucher pools and sends an email notification when codes drop below a threshold you define.

## Prerequisites

* Basic familiarity with scenarios, aggregates, and custom events in Bloomreach.
* Voucher codes imported into at least 1 voucher pool and used in a campaign.

## Overview

The scenario runs once a day, checks the available voucher count for a pool, stores the result in a custom event, and sends an email if the count falls below your threshold. You can scale it to cover multiple pools and multiple recipients.

## Set up the notification scenario

### Create sample customer

To store voucher data without attaching it to real customer profiles, create a dedicated customer in Bloomreach. This customer acts as a data container—the scenario saves custom events to it, and the email reads data from it.

1. Go to **Data & Assets** > **Customers** and create a new customer.

   <Image src="https://files.readme.io/3dcfa55c3860481a46b638c6d64157f0a3bd27729b54839c2f944affd82f82b7-Create_sample_customer.png" alt="Customers section with a new customer profile being created." align="center" />

2. Fill in only the customer ID—this is the identifier you'll use to filter for this customer in the scenario.

### Create a monitoring event

Create a custom event to store voucher count data. The scenario writes to this event on each run, and the email reads from it.

1. Go to **Data & Assets** > **Data manager** and select the **Events** tab.

2. Create a new event at the bottom of the list.

   <Image src="https://files.readme.io/081818981f715495f49d126bd8bebb7bd5e5ffaf7e4fb4076274fff2b35f0ea3-Add_new_event.png" alt="Data manager Events tab with a new custom event being added at the bottom of the list." align="center" border={true} />

3. Add the following properties — rename them if needed:
   1. `pool_name`: The name of the voucher pool.
   2. `total_codes`: Total number of codes in the pool.
   3. `available_codes`: Number of codes still available.
   4. `threshold`: the count below which a notification is sent.

### Build the voucher pool check scenario

The scenario runs once a day, checks a voucher pool, saves the values to the custom event on your sample customer, waits 2 minutes, then sends an email if the available count is below the threshold.

<Image src="https://files.readme.io/61939bc409156e168c65fff4f12f06f795b2c56dcacef8ed4c8a9030b8740ca1-image.png" alt="Scenario flow showing daily trigger, condition, add event, wait, condition, and email nodes." border={true} />

1. Start this scenario with a **daily trigger**.
2. **I**n the **Condition** node, add a **Voucher customer&#x20;**&#x66;ilter to target only the sample customer you created. This scopes all subsequent actions to that customer.

<Image src="https://files.readme.io/860351d6ccef78ce775bc3a58b29fc907060386fdddae14ceb7797d45ddc1769-image.png" alt="Condition node configured to filter for the voucher sample customer." align="center" width="80%" border={true} />

3. Add event action: In the **Add event** "voucher\_notification" action, configure the 4 fields:

* `total_codes` and `available_codes`: Click on the curly brackets {} to access the **Personalization** tab and pull the counts from the voucher pool. Learn more [how to personalize vouchers](https://documentation.bloomreach.com/engagement/docs/vouchers?isFramePreview=true#personalize-vouchers) using [Jinja.](https://documentation.bloomreach.com/engagement/docs/jinja)
* `pool_name`: Set manually to the name of the voucher pool. This appears in the email so you know which pool is running low.
* `threshold`: Set per pool based on how much lead time you need to top up codes.

<Image src="https://files.readme.io/571d8170a8e73d8a2d8bcd9a09ee82dfa65597a1643d8ff857b7ab859654bf51-image.png" alt="Add event node configured with pool_name, total_codes, available_codes, and threshold fields." border={true} />

4. Add a **Wait** node and set it for 2 minutes for data to settle.
5. Add a **Condition** node to compare the number of available codes is less than the threshold. To compare 2 event attributes rather than a manual value, switch to Attributes mode using the toggle next to the field.

<Image src="https://files.readme.io/867d648df3cfa741a21395e21a59aa8f8fc35739e5ab76d5f3ec14d12acc3635-image.png" alt="Condition node comparing available_codes attribute to threshold attribute in attributes mode." align="center" width="80%" border={true} />

6. Before setting up an **Email** node, go to  **Data manager > Definitions** to create 2 aggregates that read the latest values from the custom event:

* **Pool name aggregate:** Returns the last value of pool\_name from the monitoring event.

<Image src="https://files.readme.io/679c7d6201f82ea9e9f2da53b28d4e9105a8e5be98b582e560a21252468b1f64-image.png" alt="Aggregate definition returning the last value of pool_name from the voucher notification event." border={true} />

* **Available codes aggregate:** Returns the last value of `available_codes` from the monitoring event.

<Image src="https://files.readme.io/5ca8618daccac87d2b5623e69657a78f336db30992fe63b584ba2d20c31a6513-image.png" alt="Aggregate definition returning the last value of available_codes from the voucher notification event." border={true} />

<br />

Reference both aggregates in the **Email** node using the **Personalization** tab in the email builder. You can use our sample text and replace the aggregate IDs using your references.

```text
Hello!
Vouchers in the pool {# Last voucher pool name with less available than threshold #}{{ aggregates['5c76a20a900ce50010329c50'] }} are running out!
There is currently {# Last voucher codes count with less available than threshold #}{{ aggregates['5c76a237a5b5f700157727 61'] }} voucher codes available.
Please import more voucher codes to prevent campaigns from not being sent.
Have a nice day! :)
```

<Image src="https://files.readme.io/6ba79600dc9665cf565c4bc67ae46223d5ce161193c3290d12c7a5a4d962b683-image.png" alt="Email editor showing sample notification text with aggregate placeholders for pool name and available codes." align="center" width="80%" border={true} />

### Configure email settings

Set the recipient and sending policy in the **Settings** tab of the email.

Set the policy to 0 hours and use **General consent** if you're using the consent framework. This ensures the notification is sent regardless of the recipient's marketing consent status.

## Scale the setup

## Add more recipients

Duplicate the email action, connect it to the same condition, and change the recipient in the email settings for each copy.

<Image src="https://files.readme.io/49772367f66ebd043b23a476299c32e41da95bd8f03f1c3f1421ee632fdf249e-image.png" alt="Scenario with duplicate email nodes connected to the same condition for multiple recipients." border={true} />

## Add more voucher pools

Duplicate the scenario tab for each additional pool. In the duplicated tab, update:

* The `pool_name` field in the **Add event** action.
* The Jinja in `total_codes` and `available_codes` to reference the correct pool.
* The threshold value for that pool.

<Image src="https://files.readme.io/2b1c98f3038b0e6d030d14aaf360d358129da8e6049b84053888735b89643d84-image.png" alt="Scenario with multiple tabs set up for different voucher pools." border={true} />

Stagger the tabs by at least 10 minutes apart. The email reads the last occurrence of the monitoring event, so tabs running too close together may overwrite each other's data before the email is sent.