Contact us
Skip to main content

How to create pipelines

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:

These operations are performed using the following tasks:

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.

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

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.

    {
    "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.

    {
    "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 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.

    {
    "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.

    For more details about the parameters, see the reference.

    To learn how to pass custom fields when placing orders, refer to the Order 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.

    {
    "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:

{
"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 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

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

Was this page helpful?