---
title: "How to create pipelines | Customer&#x27;s Canvas Hub"
canonical: "https://customerscanvas.com/docs/hub/printer-guide/pipelines/creating-pipelines/"
---

# How to create pipelines

> Learn how to build and assign a rendering pipeline with extract, render, email, and finalize tasks.

This tutorial walks you through building a pipeline that renders the ordered product and sends an email with links to the resulting print files. By the end, you'll have a working pipeline assigned to a PIM product.

The pipeline consists of the following operations:

```mermaid
flowchart TB
    t1(Getting a design)
    t2(Rendering the design)
    t3(Sending email) 
    t4(Finalizing) 
    t1--design-->t2
    t2--print file-->t3
    t3-->t4
```

These operations are performed using the following tasks:

- [`extract-project-design`](https://customerscanvas.com/docs/hub/printer-guide/pipelines/tasks/extract-project-design.md)
- [`render-hires`](https://customerscanvas.com/docs/hub/printer-guide/pipelines/tasks/render-hires.md)
- [`send-email`](https://customerscanvas.com/docs/hub/printer-guide/pipelines/tasks/send-email.md)
- [`finalize`](https://customerscanvas.com/docs/hub/printer-guide/pipelines/tasks/finalize.md)

## Prerequisites

- A Customer's Canvas account with the PIM module enabled
- An online store connected to Customer's Canvas

If **Pipelines** is missing in the lower-left corner of BackOffice, [contact our support team](https://customerscanvas.com/company/contact).

## Create a pipeline file

1. Select **Pipelines** in the lower-left corner, and then select **Create new**.
2. In the **Create new pipeline** dialog box, select **New blank pipeline**.
3. In the editor, enter the pipeline name, for example, **Email notification**.
4. Switch to the code field and add a `tasks` array.

![Creating processing pipelines from scratch](./images/create-blank-pipeline.gif)

## Add tasks

As soon as an order is made in your online store, a project is created in BackOffice. Add the following tasks to the pipeline one by one.

1. Add the `extract-project-design` task to get the personalized design from the project. Copy the following code and paste it into the pipeline file.

    ```json
    {
        "description": "Extract design from project",
        "name": "extract",
        "type": "extract-project-design",
        "parameters": {},
        "outputArtifacts": [
            "design"
        ]
    }
    ```

    This task does not require `parameters` or `inputArtifacts`. The result is passed to the next task as `outputArtifacts`.

2. Add the `render-hires` task to render the print files. Copy the following code and paste it into the pipeline file.

    ```json
    {
        "description": "Render design",
        "name": "render-hires",
        "type": "render-hires",
        "inputArtifacts": [
            "design"
        ],
        "parameters": {
            "hiResOutputDpi": 300,
            "hiResOutputFileFormat": "pdf",
            "hiResOutputColorSpace": "cmyk",
            "hiResOutputToSeparateFiles": false,
            "hiResOutputChannelContainersToSeparateFiles": false,
            "hiResOutputChannelContainersRenderEmptyPage": true,
            "hiResOutputCompression": "Jpeg",
            "hiResOutputJpegCompressionQuality": 90
        },
        "outputArtifacts": [
            "result"
        ]
    }
    ```

    The task takes the `design` artifact as input and uses `parameters` to configure the rendering. The print file name is defined in `outputArtifacts`: `"result"` generates a single file, and `"result*"` generates a set of files.

    For details about the rendering parameters, refer to the [Rendering print files](https://customerscanvas.com/docs/hub/printer-guide/pipelines/tasks/render-hires.md) task.

3. Add the `send-email` task to send a notification with links to the print files. Specify the output artifact of the `render-hires` task in `inputArtifacts`, and define an email template, recipients, and SMTP settings in `parameters`. Copy the following code, paste it into the pipeline file, and replace the `host`, `port`, `account`, `username`, `password`, and `recipients` values with your own.

    ```json
    {
        "description": "Send link to print file by email",
        "name": "send-email",
        "type": "send-email",
        "inputArtifacts": ["result"],
        "parameters": {
            "host": "your-company-smtp-server.com",
            "port": 587,
            "account": "noreply@your-company.com",
            "username": "noreply@your-company.com",
            "password": "your-secret-password",
            "useSsl": true,
            "recipients": "first@example.com, another@example.com",
            "subject": "Your print file {{project.items.@.fields.customName?}} is ready",
            "body": "Greetings {{project.customerName}}. <br> You can download a print file for your personalized product here: <br> $$links$$ <br>",
            "useHtmlBody" : true,
            "bodyLinksItemTemplate" : "<span>&bull; <a href=\"$$url$$\">$$name$$</a></span><br>",
            "bodyLinksItemNamePlaceholder" : "$$name$$",
            "bodyLinksItemUrlPlaceholder" : "$$url$$",
            "bodyLinksPlaceholder" : "$$links$$"
        }
    }
    ```

    This example overrides the SMTP settings with constant values. The `subject` contains an interpolation placeholder `{{project.items.@.fields.customName?}}`, which takes its value from the order's field `customName`, if any. The `{{project.customerName}}` placeholder takes its value from the corresponding [project field](https://customerscanvas.com/docs/hub/printer-guide/pipelines/concepts/interpolation.md#interpolating-project-data).

    For more details about the parameters, see the [reference](https://customerscanvas.com/docs/hub/printer-guide/pipelines/tasks/send-email.md).

    To learn how to pass custom fields when placing orders, refer to the [Order](https://customerscanvas.com/docs/hub/admin-guide/workflows/ui-framework/widgets/order.md#props) widget.

4. Add the `finalize` task to assign the print files to `finalArtifacts` and remove temporary files from the pipeline. Copy the following code and paste it into the pipeline file.

    ```json
    {
        "description": "Finalize",
        "name": "finalize",
        "type": "finalize",
        "finalArtifacts": [
            "result"
        ]
    }
    ```

## Resulting pipeline file

After adding these tasks, save the pipeline file. The resulting pipeline file looks like this:

```json
{
    "tasks": [
        {
            "description": "Extract design from project",
            "name": "extract",
            "type": "extract-project-design",
            "parameters": {},
            "outputArtifacts": [
                "design"
            ]
        },
        {
            "description": "Render design",
            "name": "render-hires",
            "type": "render-hires",
            "inputArtifacts": [
                "design"
            ],
            "parameters": {
                "hiResOutputDpi": 300,
                "hiResOutputFileFormat": "pdf",
                "hiResOutputColorSpace": "cmyk",
                "hiResOutputToSeparateFiles": false,
                "hiResOutputChannelContainersToSeparateFiles": false,
                "hiResOutputChannelContainersRenderEmptyPage": true,
                "hiResOutputCompression": "Jpeg",
                "hiResOutputJpegCompressionQuality": 90
            },
            "outputArtifacts": [
                "result"
            ]
        },
        {
            "description": "Send link to print file by email",
            "name": "send-email",
            "type": "send-email",
            "inputArtifacts": [ "result" ],
            "parameters": {
                "host": "your-company-smtp-server.com",
                "port": 587,
                "account": "noreply@your-company.com",
                "username": "noreply@your-company.com",
                "password": "your-secret-password",
                "useSsl": true,
                "recipients": "first@example.com, another@example.com",
                "subject": "Your print file {{project.items.@.fields.customName?}} is ready",
                "body": "Greetings {{project.customerName}}. <br> You can download a print file for your personalized product here: <br> $$links$$ <br>",
                "useHtmlBody" : true,
                "bodyLinksItemTemplate" : "<span>&bull; <a href=\"$$url$$\">$$name$$</a></span><br>",
                "bodyLinksItemNamePlaceholder" : "$$name$$",
                "bodyLinksItemUrlPlaceholder" : "$$url$$",
                "bodyLinksPlaceholder" : "$$links$$"
            }
        },
        {
            "description": "Finalize",
            "name": "finalize",
            "type": "finalize",
            "finalArtifacts": [
                "result"
            ]
        }
    ]
}
```

## Assign the pipeline to a product

Assign this pipeline to a PIM product. If you don't have any products yet, refer to the [Creating products](https://customerscanvas.com/docs/hub/admin-guide/pim/creating-products.md) tutorial.

1. Select **Products** in the menu.
2. In the product row, select the ellipsis, and then select **Edit**.
3. On the **General** tab, expand the **Processing pipeline** drop-down list and select **Email notification**.

![The Pipelines in PIM](./images/pim.png)

To verify how the pipeline works, order this product in your online store and check your mail.
