> For the complete documentation index, see [llms.txt](https://docs.hackle.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hackle.io/en/catalog/selection.md). Agents can also search and read this documentation through its [MCP server](https://docs.hackle.io/~gitbook/mcp).

# Catalog Selection

Learn about selections, which pick Catalog items that match conditions and load them into messages.

A selection is a rule that picks items matching conditions from a Catalog. Once you save the filters, sort order, and result count, the selection picks items with that rule every time a message is sent.

If you know the item IDs, you can load items directly with the `catalog_items` tag. Use a selection when you cannot decide the item IDs in advance. For example, you can pick items by condition, such as "5 discounted products, from the lowest price."

#### Use Cases <a href="#use-cases" id="use-cases"></a>

| Industry          | Example                                                                      |
| ----------------- | ---------------------------------------------------------------------------- |
| Commerce          | A message introducing the top 3 discounted products by discount rate         |
| Content and media | A message recommending the newest releases in the user's favorite genre      |
| O2O and stores    | A notice about stores in the user's area that are running an event this week |

{% hint style="info" %}
**Before you start**

To create a selection, a Catalog and its items must be ready first. For how to create a Catalog, see [Create a Catalog](https://docs.hackle.io/en/catalog/create.md).
{% endhint %}

## Selection Structure <a href="#selection-structure" id="selection-structure"></a>

A selection consists of the following items.

<table><thead><tr><th width="140">Item</th><th>Description</th></tr></thead><tbody><tr><td><strong>Name</strong></td><td>The name used to call the selection in a message. Only letters, numbers, hyphens (-), and underscores (_) are allowed. Names must be unique within a Catalog and cannot be changed after creation.</td></tr><tr><td><strong>Description</strong></td><td>A field for noting what the selection is for. You can edit it at any time.</td></tr><tr><td><strong>Filters</strong></td><td>Conditions for picking items. You can add up to 10, and only items that satisfy all conditions are included in the result.</td></tr><tr><td><strong>Sort</strong></td><td>The order of the result items. Pick one field and sort in ascending or descending order. The default is no sorting.</td></tr><tr><td><strong>Result count</strong></td><td>The maximum number of items to load into the message. Set a value from 1 to 50. The default is 5.</td></tr></tbody></table>

You can create up to 30 selections per Catalog.

## Create a Selection <a href="#create-selection" id="create-selection"></a>

{% stepper %}
{% step %}

### Open the Selection Tab <a href="#open-selection-tab" id="open-selection-tab"></a>

<figure><img src="https://143363954-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyAVlNQhS253reum0Ce94%2Fuploads%2Fgit-blob-4c8b11080e96a0e7e8d2de88351eb3ef8bc575d1%2Fselection_step1_create.png?alt=media" alt=""><figcaption></figcaption></figure>

On the detail screen of the Catalog where you want to create the selection, open the \*\*Selection\*\* tab and click \*\*Create\*\*.
{% endstep %}

{% step %}

### Enter a Name and Description <a href="#enter-name-and-description" id="enter-name-and-description"></a>

<figure><img src="https://143363954-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyAVlNQhS253reum0Ce94%2Fuploads%2Fgit-blob-694ec5a6bc57f2bde6ac5859eabe26066c3bf542%2Fselection_step2_name.png?alt=media" alt=""><figcaption></figcaption></figure>

Enter the selection's name and description. The name cannot be changed after creation, so choose one that is easy to recognize in messages. Example: \`on\_sale\_top5\`
{% endstep %}

{% step %}

### Add Filters <a href="#add-filters" id="add-filters"></a>

<figure><img src="https://143363954-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyAVlNQhS253reum0Ce94%2Fuploads%2Fgit-blob-069dfeb60903bf4699fbc51a11c737e04ddb81ab%2Fselection_step3_filters.png?alt=media" alt=""><figcaption></figcaption></figure>

Choose the field and Operator to use as a condition, then enter a value. For the Operators available for each field type, see \[Filter Operators]\(#filter-operators).
{% endstep %}

{% step %}

### Set Sort and Result Count <a href="#set-sort-and-result-count" id="set-sort-and-result-count"></a>

<figure><img src="https://143363954-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyAVlNQhS253reum0Ce94%2Fuploads%2Fgit-blob-8e259f52cf37929db9186cb155de3a1d72377be1%2Fselection_step4_sort.png?alt=media" alt=""><figcaption></figcaption></figure>

Choose the field and direction to sort by, and set the maximum number of items to load.
{% endstep %}

{% step %}

### Preview the Result and Save <a href="#preview-and-save" id="preview-and-save"></a>

<figure><img src="https://143363954-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyAVlNQhS253reum0Ce94%2Fuploads%2Fgit-blob-2b9b5017ec8219d88ca5ee1ee7358e24770be5d1%2Fselection_step5_preview.png?alt=media" alt=""><figcaption></figcaption></figure>

Use the preview to check which items are picked, then save. If you used personalization variables in filter values, you can enter Property Values directly in the preview to check the result.
{% endstep %}
{% endstepper %}

## Filter Operators <a href="#filter-operators" id="filter-operators"></a>

The available Operators differ by field type.

<table><thead><tr><th width="120">Field type</th><th>Operators</th></tr></thead><tbody><tr><td>String</td><td>Is one of, Is not one of, Exists, Does not exist</td></tr><tr><td>Number</td><td>Is one of, Is not one of, Greater than, Greater than or equal to, Less than, Less than or equal to, Exists, Does not exist</td></tr><tr><td>Time</td><td>Is on the date, Is after the date, Is on or after the date, Is before the date, Is on or before the date, Exists, Does not exist</td></tr><tr><td>Boolean</td><td>Is true, Is false</td></tr></tbody></table>

* Fields used in a selection cannot be deleted. To delete a field, first remove it from the filters and sort of the selections that use it.

### Use Personalization Variables in Filter Values <a href="#personalization-variables-in-filters" id="personalization-variables-in-filters"></a>

You can put User Properties, Event Properties, and API properties into filter values using Liquid syntax. Because the filter is evaluated with each user's values at send time, the same selection can show different items to each user.

For example, if you choose the **Is one of** Operator for the `genre` field and enter the value below, only items in the user's favorite genre are picked.

```liquid
{{ user_properties["favorite_genre"] }}
```

## Use a Selection in Messages <a href="#use-selection-in-messages" id="use-selection-in-messages"></a>

When you add the `catalog_selection_items` tag to the message body, the selection's result is stored in the `items` variable.

{% code overflow="wrap" %}

```liquid
{% catalog_selection_items <catalog_name> <selection_name> %}
```

{% endcode %}

Result items are stored in the sort order set in the selection, so you can output them in order with a `for` tag.

{% code overflow="wrap" %}

```liquid
{% catalog_selection_items Products on_sale_top5 %}{% for item in items %}{{ item.name }} {{ item.price | number_with_delimiter }}원
{% endfor %}
```

{% endcode %}

<figure><img src="https://143363954-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyAVlNQhS253reum0Ce94%2Fuploads%2Fgit-blob-7ebd20fa01cf945a8a15cd68cbf239dc7ce5a551%2Fselection_usage.png?alt=media" alt=""><figcaption></figcaption></figure>

If any of the selection's filters cannot be evaluated, the result is treated as 0 items. The message is still sent in this case, so prepare fallback text with an `if` tag. For detailed tag behavior and examples, see [Advanced Personalization with Liquid](https://docs.hackle.io/en/crm-marketing/message-personalization/liquid-template-reference.md#catalog_selection_items).

Selections can be used in Push, Kakao, Text Message, and Webhook channels.

## Manage Selections by Environment <a href="#selection-by-environment" id="selection-by-environment"></a>

When you create a selection, it is created with the same content in both the Production Environment and the Development Environment. After that, filters, sort, and result count can be edited separately for each Environment. You can change conditions in the Development Environment to check the result, then apply the same conditions to the Production Environment.

## Delete a Selection <a href="#delete-selection" id="delete-selection"></a>

You can delete a selection from its detail screen. Deleting it removes the selection from both the Production Environment and the Development Environment. When you delete a Catalog, all of its selections are deleted as well.

{% hint style="warning" %}
**Check first whether any messages are using it.**

If you delete a selection while a Campaign is using it, messages may be sent without the selection's results.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.hackle.io/en/catalog/selection.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
