---
title: "Direct mail | Customer&#x27;s Canvas Hub"
canonical: "https://customerscanvas.com/docs/hub/dev-center/scenarios/direct-mail/"
---

# Direct mail

> You can use Customer's Canvas direct mail and other variable data printing scenarios. The API generates these images by using data samples.

Some products may require the personalization of every printed copy, for example, when you are preparing letters and pre-addressed envelopes for mass mailings (a so-called mail merge, direct mail marketing), creating wedding invitations, or printing business cards in a corporate style.

For example, you are building a marketing campaign, where you have a catalog of such products as postcards, letters, and invitations. For this campaign, you select one or more products and one or more mailing lists. Then, you select templates for the products, and may want to customize these templates with static design elements and variable fields, like text, images, or barcodes. You may want to generate preview images on a small sample of addresses.

This article provides an overview of how this scenario can be implemented with Customer's Canvas.

## General idea

To implement direct mail marketing, a customer creates a campaign and adds templates to it. Customer's Canvas allows you to arrange templates into folders by category as well as create product variants based on these templates. The customer then selects a template, personalizes it as necessary, provides a data set to be applied, previews the design with a data sample, and proceeds to checkout if the result looks good.

![Use cases of direct mail marketing.](images/direct-mail-case.png)

Let's split this process into steps.

## Roadmap for direct mail

### 1. Pre-designing variable templates

A **template** is a basic public design file for rendering. Customer's Canvas supports templates created in Adobe Photoshop, Adobe InDesign, and the Customer's Canvas Template Editor. You can add variable fields such as text placeholders, image placeholders, and barcode placeholders to these templates.

For details, refer to [Pre-designing variable templates](https://customerscanvas.com/docs/hub/dev-center/scenarios/direct-mail/pre-designing-variable-templates.md) and [Specifying paths for variable images](https://customerscanvas.com/docs/hub/dev-center/scenarios/direct-mail/specifying-paths-for-variable-images.md).

### 2. Organizing a catalog

Upload your templates to your Customer's Canvas tenant and organize them into folders in the **Assets** > **Designs** section to make it easy to navigate them. For example, you may create the following hierarchy:

- Products (e.g., postcards, letters, invitations, ...)
  - Options (e.g., size, material, ...)
    - Variants (combinations of all option values with assigned SKUs)

This hierarchy fits the PIM products. Using this approach, you can easier manage designs, enable price support, and link product variants in Customer's Canvas with products in your application using SKUs.

When creating [products](https://customerscanvas.com/docs/hub/admin-guide/pim.md), select valuable options to define product variants, and in this case, a template will represent a **product variant design**. For more details, refer to the [PIM](https://customerscanvas.com/docs/hub/dev-center/concepts/pim.md) topic.

### 3. Personalizing templates

After the customer selects a template, open an editor so that the customer can personalize it. For example, you can use the [Design Editor](https://customerscanvas.com/docs/hub/dev-center/frontend-integration/about-design-editor.md). In your tenant, an instance of this editor is installed by default.

For details about opening products for editing and initializing the editor, refer to [Opening products for editing](https://customerscanvas.com/docs/hub/dev-center/scenarios/online-store/opening-products-for-editing.md) and [Starting personalization session](https://customerscanvas.com/docs/hub/dev-center/scenarios/online-store/starting-personalization-session.md).

### 4. Preview design with data

When the customer finishes the personalization, you can display a design preview with applied data sets on the approval page. You can use different strategies for data substitution, for example, displaying the first and the last records of the data set, or some corner cases such as the longest field values.

For details, refer to [Previewing variable data designs](https://customerscanvas.com/docs/hub/dev-center/scenarios/direct-mail/previewing-variable-data-designs.md).

### 5. Adding a dataset

When the customer finishes editing a template and clicks **Save**, the personalization results are saved to the private user's storage as a **private state file**. A state file not only defines design elements but also may contain a data sample that will be applied to this design.

For details, refer to [Adding a dataset](https://customerscanvas.com/docs/hub/dev-center/scenarios/direct-mail/adding-a-dataset.md).

### 6. Rendering designs

For rendering, create a pipeline with a [render-vdp-hires task](https://customerscanvas.com/docs/hub/printer-guide/pipelines/tasks/render-vdp-hires.md) and create a **project** based on this pipeline. Once the project is created, the **rendering job** begins immediately.

For details, refer to [Starting print file rendering](https://customerscanvas.com/docs/hub/dev-center/scenarios/direct-mail/starting-print-file-rendering.md).

### 7. Cleaning up private assets

Since this task involves a large flow of data and assets, you need a cleanup procedure for the storage. You can either rely on the retention policy implemented in BackOffice or clean up the assets on your own.

According to the default retention policy in BackOffice, once a day, a background task that finds and deletes outdated assets for all tenants with `EnableAssetsRetention` set to `true` is performed on the backend. Assets are considered outdated if both of the following conditions are met:

- `RetentionPolicy` is set to `Default`.
- `LastAccessTime` is earlier than the `AssetsRetentionPeriodInDays` defined in the tenant settings.

To run this task through the API, use the endpoint [`POST /api/storage/v1/tenants/{id}/clean-up`](https://customerscanvas.com/docs/hub/dev-center/api/asset-storage.md#tag/tenants/CleanUp). You can also clean up the assets manually or write scripts for that.
