# Personalized Emailing

> Source: https://docs.recombee.com/recipes/e-commerce/personalized-emailing

> For the complete documentation index, see [llms.txt](/llms.txt).

**Table of contents**

* [Introduction](#introduction)
* [Scenario Setup](#scenario-setup)
* [Logic](#logic)
* [Filters](#filters)
* [Boosters](#boosters)
* [Requesting Recommendations](#requesting-recommendations)  
   * [Requesting Dynamic Content from API](#requesting-dynamic-content-from-api)  
   * [Pre-fetching Recommendations](#pre-fetching-recommendations)

# Personalized Emailing

![](/img/recipes/e-commerce/personalized-emailing.png) 

## Introduction

Personalized emailing is essential for e-commerce, ensuring customers receive content that reflects their interests and behaviors, thereby boosting engagement and conversions.

## Scenario Setup

In the Recombee Admin UI, navigate to the **[Scenarios](/scenarios)** section and choose **Create Scenario**.

1. Enter a **Scenario ID**. Select a distinctive label for your recommendation scenario, such as _"email"_ or the name of the particular emailing campaign
2. Choose **Recommendation type** \- _[Items to User](/api#recommend-items-to-user)_

![Admin UI - Scenario Setup](/img/recipes/e-commerce/personalized-emailing-create-scenario.png)

## Logic

The [Logic](/recommendation_logics) defines the behavior of the recommendation engine.

* Choose the **[recombee:emailing](/recommendation_logics#recombee-emailing)** logic type from the **Universal Models**

This model is **fine-tuned for periodic** (e.g. daily) personalized emailing campaigns.

The `rotationPolicy` parameter specifies how the recommendations for the user change with each subsequent email sent.

By default, there is a _smart rotation_ that takes into account the position of recommended items and allows some of the items to re-appear in further e-mails.

If you prefer not to repeat a recommended product in the emails ever again, you can set the parameter value to _total_.

By default, rotation only takes into account recommendations (e-mails) at most 14 days old. Should a longer time period be needed for your use case, kindly contact [support@recombee.com](mailto:support@recombee.com).

![Admin UI - Logic](/img/recipes/e-commerce/personalized-emailing-logic.png)

## Filters

Available Products (Global Settings)

You always want to recommend only the products that are in stock. Therefore you need to apply a [**Filter**](/scenarios#filters) rule to allow only such products.

As it would be tedious and prone to error to add this rule to all the Scenarios, this rule shall be added to the [**Global Settings**](/scenarios#scenarios-in-admin-ui-global-settings), so it is always applied everywhere.

You can select a **predefined rule from the Recombee Library** to allow only the available products.

Depending on how you represent availability in the catalog, it can be **one of the following rules:**

* **Not deleted items** \- when you have a _deleted_ property (true/false)
* **Available items** \- when you have an _available_ property (true/false)
* **Items in stock \[Google Merchant\]** \- when you have a string _available_ property with _"in stock"_ as its value

![Admin UI - Global Settings - Filter](/img/recipes/e-commerce/filter.png)

Tip: Personalized Selection from Recently Added Products

You may want to create an emailing campaign dedicated to recommending the **newly added products**.

1. Navigate to the **[Filters](/scenarios#filters)** tab and **Add first filter**
2. Find _Recent items_ and click on **+**
3. Specify which **property** in your Items catalog specifies the **date of adding the product into the catalog**
4. Set the **Number of days** for which the new item can be recommended

For example, by setting 30 days, each user will get a personalized collection of interesting products that were added during the last month.

An alternative to this approach would be adding the **Boost recent items booster** instead of a filter - especially if you don’t add new products continuously, so there might not be always a sufficient number of candidates.

Tip: Category-specific Items

You may want to create an emailing campaign dedicated to products from a **specific category**.

1. Navigate to the **[Filters](/scenarios#filters)** tab and **Add first filter**
2. **Add one of the following filters** from the library of predefined rules:  
   * _Items from particular category \[string\]_  
   * _Items from particular category \[set\]_  
Used rule depends on whether your products have a single category or multiple categories per product in the catalog.
3. Specify which **property** in your Items catalog specifies the **category**
4. Set the **name of the category**

[![Admin UI - Filter - Category-specific Items - ReQL](/img/recipes/e-commerce/filter-category-specific-items.png)](/img/recipes/e-commerce/filter-category-specific-items.png)

## Boosters

Tip: Boost Items On Sale

You may want to bias the behavior towards a particular business or product goal - for example drive the recommender engine to **push the items that are on sale** more in the sent emails, because you want to completely sell out these products.

1. Navigate to **[Business Rules](/reql#business-rules)** section and **Create Rule**
2. Enter a **Rule name**, such as _"Items On Sale Booster"_
3. Choose **Rule Type** \- [Booster](/scenarios#boosters)
4. Choose **Entity Type** \- Items
5. Assuming you have an item **property** called _on\_sale_, the ReQL expression can look like this:

```
if 'on_sale' then 2 else 1
```

[![Admin UI - Booster - Items On Sale](/img/recipes/e-commerce/booster-items-on-sale-reql.png)](/img/recipes/e-commerce/booster-items-on-sale-reql.png)

**After creating** the [Booster](/scenarios#boosters), you can apply the rule to your Scenario in the Boosters tab.

[![Admin UI - Apply Booster](/img/recipes/e-commerce/booster-items-on-sale-apply.png)](/img/recipes/e-commerce/booster-items-on-sale-apply.png)

**Advanced tip**: To easily test how much the items shall be boosted, you can introduce a [Boosting Coefficient Input Value](/reql#business-rules) and use it in the ReQL:

```
if 'on_sale' then $coefficient$ else 1
```

Then you can set the coefficient directly in the Scenario screen and find the most fitting amount of boosting using the _Preview Results_ function.

## Requesting Recommendations

Choose the way of requesting recommendations compatible with your emailing platform

### Requesting Dynamic Content from API

If the emailing platform can fetch the recommendations directly from the Recombee API:

1. Ensure the platform supports the [authentication scheme](/authentication) directly (e.g. in the case of _Customer.io_), or set up a small proxy that authenticates the requests.
2. In case the authentication proxy needs to be set up, please contact [support@recombee.com](mailto:support@recombee.com) for guidance on how your emailing platform can be connected with Recombee.

### Pre-fetching Recommendations

If the emailing platform does not support requesting a 3rd party API but supports adding personalized content unique to each user:

1. Request the recommendations for each user who shall get the email using the [Recommend Items to User endpoint](/api#recommend-items-to-user).
2. Upload the recommendations to the emailing platform.
3. Send the emails.

You can even request many recommendations at once using the [Batch endpoint](/api#batch).

You can contact [support@recombee.com](mailto:support@recombee.com) to get more information on how this procedure shall be implemented in the case of your emailing platform.