Skip to main content
Altcraft Docs LogoAltcraft Docs Logo
User guide iconUser guide
Developer guide iconDeveloper guide
Admin guide iconAdmin guide
English
  • Русский
  • English
Login
    User documentation
    Getting Started
    FAQ
    Altcraft glossary
      Profiles and databasesarrow
    • Subscription resources
      Managing databases
      Subscriber profile
      Profiles import and data update
      Scheduled customer data import
      Automatic data collection
      Bulk customers profiles update
      Double opt-in subscription
      Suppression lists
      Profile relations
      Profile history export
      Profile export
      Creating a static segment based on import results
      How to open a CSV file
      Matching
      Types of fields in the database
      Global control groups
      Subscription Manager
      Communication channelsarrow
      • Email channelarrow
      • Email: ISP interactions best practices
        Email: sending domain configuration
        Email: setting up and using postmasters
        Быстрый старт
        Push channelarrow
        • Mobile Pusharrow
        • Settings & implementation
            Integrate your app with Altcraftarrow
          • Providers: push message structure
            Processing and adding a subscription
            Event registration
          Web pusharrow
        • Preliminary Settings
            Web browser push configurationarrow
          • Firebase Cloud messaging
            Apple Safari
            Mozilla Services
          Connecting Web Push to a Website
          Transferring Data to the Platform
          Web Push SDK Methods
            Import of subscriptions from third-party push servicesarrow
          • Migrating push subscriptions from third-party services
            How to transfer push subscriptions configured for Safari?
            Migration from OneSignal
      SMS channel
        Creating mailing from scratcharrow
      • Email
        SMS
        Web Push
        Mobile Push
        WhatsApp
        Viber*™
        Руководство: SMS-рассылка через VK Notify
        MAX Bot
        MAX Group
        Notify
        Telegram Bot
        Telegram Group
      Communication Channels Workflow
      Руководство: SMS-рассылка через УТШ
      Руководство: push-рассылка через сервис от "Согласие"
      Segmentationarrow
    • Static Segments
      Dynamic Segments
      Updatable Segments
        Segmentation Conditionsarrow
      • Segmentation by Profile data
        Segmentation by Interactions with Entities
        Segmentation by Activity of the channel
        Segmentation by external data
        Segmentation by external SQL tables
        Segmentation by Profile structure
      Best Send Time (BST)
      Logical operators "AND" and "OR"
      Recommendations for working with segments
      Message templatesarrow
      • Working with message templatesarrow
      • Working in the editor
        Email-template
        SMS template
        Push template
        MAX template
        Telegram template
        WhatsApp template
        Viber™ template
        Notify template
        Visual editor for email-templatearrow
      • Visual editor interface
        Adding blocks
        Elements and their settings
        Custom blocks
        Style manager
        Layer manager
      Template fragments
      Image gallery
      Content personalization
      Creating tables based on array elements
      Block editor for email template
        Altcraft Variables and Functionsarrow
      • Logical expressions in messages
        Loops in messages
        Market variables in templates
        Using the JSONPath functionality
        Dynamic content in messagesarrow
      • Dynamic HTML content
        Dynamic JSON content
        Content from SQL database in templates
        Dynamic API content
      Importing and exporting a message template
      Importing a template from a third-party service
      Exporting a template from Pixcraft
      Mailingsarrow
    • Mailings calendar
      Broadcast mailings
      Regular mailing
      Trigger mailing
      Multivariate testing
      Mailing testing
      Mailing schedule
      Placement mailing
      Campaignsarrow
    • Working with Campaigns
      Local control groups (LCG)
      Audience expansion
      Audience building
      Automation scenariosarrow
    • Managing scenarios
      Nodes of the scenario
      Classic marketing scenarios
      Step-by-step welcome scenario guide
      Scenario for automatic notification of the manager
      Abandoned cart scenario
      Marketarrow
    • Market settings
        Productsarrow
      • How to create a product manually
        How to import a product from a file
        Scheduled product import
        Product and SKU Segments
        Preparing the YML file
      Orders
      Market variables in message template
      Guide: how to send an order confirmation email
      Loyalty programsarrow
    • Loyalty programs
      Loyalty integration with external systems
      Быстрый старт
      Basic loyalty program use cases
      Order Segments
      Promotion codes
      Reports and analyticsarrow
    • Channel report
      Traffic report
        Summary reportarrow
      • Summary report metrics
      Cohorts report
      Lifetime report
      Funnels report
      Goals report
      Audience growth report
      Click map report
      Loyalty programs report
      Bounces report
      Undeliveries report
      Report on global control groups
      Integrationsarrow
      • Action hooksarrow
      • Altcraft Action Hooks
        Action hooks event types
        Action Hook Message Structure
        JSON batch request (HTTP POST action hook)
        Message to RabbitMQ broker
        Message to RabbitMQ exchanger
        Message to Kafka broker
        Test event
        Integration of third-party services using Albatoarrow
      • Connecting Altcraft to Albato
        Launching the welcome scenario using Albato
        Transmitting event data
        Setting app a trigger mailing
        Event registration
        Google Sheets and Altcraft integration
        AmoCRM and Altcraft integration
      Facebook Ads Manager™
      Google Ads Audiences
      MAX
      Yandex.Audience™
      VK Ads™
      Static segment synchronization
      Yandex AppMetrica™
      Tilda™
      Lpgenerator™
      WhatsApp
      Viber*™ integration
      Integration scope
      Data Transmitted During Synchronization
      Notify
      Weblayersarrow
      • Formsarrow
      • Create a form
        Form constructor
        Appearance
        Actions after form activation
        Data analytics
        Binding data channel and forms
        Conditional logic in forms and surveys
        NPS testing
        Pixelsarrow
      • Goal customer actions and scoring
        Pop-upsarrow
      • Creating and publishing a pop-up
        Setting up a popup in the code editor
        Managing pop-ups manually via script
        Popup analytics
        Guide: pop-up for push subscriptions
        Case: Creating a pop-up with the "Wheel of Fortune" widget
        Basic cases of placing a popup via the Tag Manager
        Tag Managerarrow
      • Configuring and installing Tag Manager
        Trigger types
        Variables types
        Linking a pixel and the Tag manager
      Settingsarrow
    • Account settings
      Custom links
      Virtual senders
      Sending policies
      Audit journal
      Tags FAQ
        Users, groups and accessarrow
      • Two-Factor Authentication (2FA)
        Connectionsarrow
      • Connection to Facebook Ads Manager
        Connection to Google Ads
        Connecting to Yandex.Audience™
        Connection to 360dialog
        Connection to Edna
        Connection to Devino Telecom
        Connection to SMSTraffic
        Connection to VK Ads™
        Connection to MTS OmniChannel
        Custom Authentication Connection
        OAuth2 connection
        Basic Authentication connection
        Token Authentication connection
        Connection to Rapporto
        MAX connection
        Connection to Notify
      Attribute settings
      API requests: where to startarrow
    • Import or update a profile
      Trigger mailing launch
      Engage profile in scenario
      Changelogarrow
    • v2026.1.76
      v2025.4.75
      v2025.4.74
      v2025.3.73
      v2025.2.72
      v2025.1.71
      v2024.4.70
      v2024.3.69
      v2024.2.68.2
      v2024.1.68
    Documentation archive
    library
  • Market
  • Guide: how to send an order confirmation email

Guide: how to send an order confirmation email

Description​

This guide will show you the algorithm for working in the Altcraft Platform market.

Let's imagine that we have an online store for smartphones. A buyer visits a website, adds the product to the cart and places the order. Our task is to send them an order confirmation email with the order number and price.

The guide comprises the following steps:

  1. Creating a sales channel and touchpoins
  2. Importing product and SKU data using a yml file
  3. Setting up an API request to add order data to the market
  4. Creating a template and substituting order data using variables
  5. Setting up a trigger mailing

Step 1. Set up a sales channel​

You need a sales channel to start working in the market. This channel defines a profile database and touchpoints.

A profile database contains the contact details of customers who place orders in a certain channel. You need to import their data into a new or existing database. To do this, use import from a file or via API.

A touchpoint is a platform or a tool using which you sell products and services to your customers (a website, a store, a parcel terminal, a social network, a call center and so on). A touchpoint connects a sales channel a an order.

To create a channel, go to Market —> Settings in the main menu. Create a new channel on the Sales channels tab. Specify:

  • a channel name
  • an additional identifier
  • a profile database
  • a channel type: online or retail

Next, save the channel and go back to its settings. Create touchpoints.

Please note that each touchpoint can only be linked to one channel. The touchpoint ID will be used in the API request to import the order.

Step 2. Upload product data to the platform​

Products in the market are represented by two entities: products and SKU.

info

A product is goods or services for sale. SKU is a product modifier, it is used for variations of one product (such characteristics as colour, size, weight, model, configuration and so on can vary).

SKU is connected to a certain product and cannot exist without it. For example, Apple iPhone 12 is a product, but Apple iPhone 12 128GB and Apple iPhone 12 256GB are its SKUs.

There are three ways to add product data to the platform:

  • manually
  • import it from a file
  • import it via API

Let's import product data from a file. To do this, you need a yml file.

tip

If you have any questions about import, read this detailed guide.

Below you can see examples of yml files:

Product​

A file with such content will add two products to the market: Apple iPhone 12 and Xiaomi 12X.

<?xml version="1.0" encoding="UTF-8"?>
<yml_catalog date="2017-02-05 17:22">
<shop>
<name>BestSeller</name>
<company>Tne Best inc.</company>
<url>http://best.seller.ru</url>
<categories>
<category id="10">Смартфоны</category>
<category id="101" parentId="10">Apple</category>
<category id="102" parentId="10">Xiaomi</category>
</categories>
<offers>
<offer id="iphone12" available="true">
<name>Apple iPhone 12</name>
<vendor>Apple</vendor>
<url>http://best.seller.ru/product_page.asp?pid=12348</url>
<price>83990</price>
<oldprice>89990</oldprice>
<currencyId>RUB</currencyId>
<categoryId>101</categoryId>
<picture>https://example.com/img/apple_phone.png</picture>
<delivery>true</delivery>
<manufacturer_warranty>true</manufacturer_warranty>
<barcode>0156789012</barcode>
</offer>
<offer id="xiaomi12" available="true">
<name>Xiaomi 12X</name>
<vendor>Xiaomi</vendor>
<url>http://best.seller.ru/product_page.asp?pid=12345</url>
<price>62990</price>
<oldprice>69990</oldprice>
<currencyId>RUB</currencyId>
<categoryId>102</categoryId>
<picture>https://example.com/img/xiaomi_phone.png</picture>
<delivery>true</delivery>
<manufacturer_warranty>true</manufacturer_warranty>
<barcode>0123456789379</barcode>
</offer>
</offers>
</shop>
</yml_catalog>

SKU​

A file will add two SKUsfor Apple iPhone 12: Apple iPhone 12 128GB and* Apple iPhone 12 256GB*.

<?xml version="1.0" encoding="UTF-8"?>
<yml_catalog date="2017-02-05 17:22">
<shop>
<name>BestSeller</name>
<company>Tne Best inc.</company>
<url>http://best.seller.ru</url>
<offers>
<offer id="apple12_128gb" group_id="iphone12" available="true">
<name>Apple iPhone 12 128GB</name>
<vendor>Apple</vendor>
<url>http://best.seller.ru/product_page.asp?pid=12358</url>
<price>71990</price>
<oldprice>72990</oldprice>
<currencyId>RUB</currencyId>
<categoryId>101</categoryId>
<picture>https://example.com/img/apple_phone_128.png</picture>
<delivery>true</delivery>
<manufacturer_warranty>true</manufacturer_warranty>
<barcode>0156789012</barcode>
</offer>
<offer id="apple12_256gb" group_id="iphone12" available="true">
<name>Apple iPhone 12 256GB</name>
<vendor>Apple</vendor>
<url>http://best.seller.ru/product_page.asp?pid=12359</url>
<price>83990</price>
<oldprice>89990</oldprice>
<currencyId>RUB</currencyId>
<categoryId>102</categoryId>
<picture>https://example.com/img/apple_phone_256.png</picture>
<delivery>true</delivery>
<manufacturer_warranty>true</manufacturer_warranty>
<barcode>0156789012</barcode>
</offer>
</offers>
</shop>
</yml_catalog>

tip

A list of all products and SKUs is stored in the offers element. One product or SKU is stored in a separate offer element.

The id attribute, which is unique for each product, is specified for the offer element.

The structure of the yml file is almost the same for products and SKUs. The only difference is the following: when importing SKU for the offer element you need to specify not only id, but also group_id — a product identifier.

Please note that SKUs are different variations of one product, so the value of the group_id attribute must be the same for all SKUs of this product.

To import a file with a list of products, go to Market —> Products. Click on the icon on the top toolbar, and then select what exactly you want to import — a product.

Click on the download area and select a file on your device:

Start the import process by clicking "Import" on the top toolbar.

Then import SKUs. To do this, follow all the steps described in this paragraph.

Step 3. Set up sending an API request when adding an order​

When a visitor of an online store places an order, an API request with the order data must be sent to the platform.

URL​

Method: POST

https://example.com/api/v1.1/market/orders/import

Request parameters​

ParameterTypeExampleRequiredDescription
tokenstring"abcdefghijklmnqrstuvwxyz"ДаAPI token. Make sure that roles that allow you to work with the market are available for the token.
dataarray of objects
[
{
...
}
]
ДаOrder data.
Learn more.
Data object
external_idstring"1234001"YesOrder ID
matchingstring"email"
Subscriber search mode.
By default — email.
For each type of matching, certain fields must be passed in the request body. You can learn more about these fieldshere.
endpointstring"website"YesTouchpoint ID
statusstring"new"
"delivered"
"paid"
"canceled"
"part_refunded"
YesOrder status ID
total_pricestring"71990"YesTotal cost of the order. It consists of the price of each line in the order and the cost of delivery.
currencystring"RUB"YesCurrency of the order price.
create_timestring"2022-04-29T12:48:23Z"NoOrder creation time
update_timestring"2022-04-29T12:48:23Z"NoOrder update time
linesarray
[
{
...
}
]
YesOrder lines data. At least one item.
Lines object
external_idstring"line_01"YesLine ID
productstring"iphone12"Must not be present in the request if sku is specifiedProduct ID
skustring"apple12_128gb"Must not be present in the request if product is specifiedSKU ID
base_price_per_itemstring"71990"YesBase price
min_price_per_itemstring"71990"YesMinimum price
final_price_per_itemstring"71990"YesFinal price
countint1YesQuantity of goods per item

Request example​

{
"token": "abcdefghijklmnqrstuvwxyz",
"data": [
{
"external_id": "1234001",
"matching": "email",
"email": "johndoe@example.com",
"endpoint": "website",
"status": "new",
"total_price": "71990",
"create_time": "2022-04-29T12:48:23Z",
"update_time": "2022-04-29T12:48:23Z",
"currency": "RUB",
"lines": [
{
"external_id": "line_01",
"product": "iphone12",
"base_price_per_item": "71990",
"min_price_per_item": "71990",
"final_price_per_item": "71990",
"count": 1
}
]
}
]
}

Response example​

{
"error": 0,
"error_text": "",
"result": [
{
"error": 0,
"external_id": "1234000"
}
]
}

Response parameters​

ParameterTypeDescription
errorintError code
error_textstringError text
resultarrayIDs of orders that were successfully imported

Step 4. Create an email template​

Go to the Templates section. Add a new template for the email channel.

Add the market variables to the email template to use the order information in your mailing. To do this, click </> in the editor. In the list, select "Market" and insert the "Orders" variable.

Theordersfunction pattern will be added to the editor. This function selects orders from the list of profile orders.

We only need to add information about the last order with the status "New" to our email. To do this, we will need to change the arguments of a function:

{orders("order.status == '1'" 1 "create_time" "desc")}

The function consists of four arguments:

ArgumentExampleDescription
Filter"order.status == '1'"The function will select only those orders that match the condition "order status is new".
Limit1The function will select only the first element in the list of orders.
Sorting field"create_time"Selected elements will be sorted by the "create_time" field (order creation time).
Sorting direction"desc"The elements will be sorted in descending order of the value in the "create_time" field.

An array of orders is the result of the orders function.In this case, it will be an array with one item. Use loop to iterate an array.

In the email template, substitute two variables:

  • {$el.external_id} — additional order ID.
  • {$el.total_price} — total order price.
{for $index $el = orders("order.status == '1'" 1 "create_time" "desc")}
Thanks! Your order no.{$el.external_id} is confirmed.
Order total: {$el.total_price}
{else}
if empty array
{end}
tip

Read more about market variables in this article. There you will find information about fields that can be used in the filter or inserted into the template.

Step 5. Set up a trigger mailing​

Open the Mailings section → Triggers. Create a new mailing. Don't forget to activate it.

Select the email channel and add the desired email template. On the Trigger tab specify:

  • Event type: when changing an order —> adding an order. The trigger will be activated as soon as a new order is added to the market.

  • Sales channel: here specify the profile database with customer data of your online store.

  • Order status: new. The trigger will be activated if an order with the status "new" will be added to the market.

Click Finish and save the mailing.

tip

To test how the trigger works, you can add an order manually.

Last updated on Nov 20, 2024
Previous
Market variables in message template
Next
Loyalty programs
  • Description
  • Step 1. Set up a sales channel
  • Step 2. Upload product data to the platform
    • Product
    • SKU
  • Step 3. Set up sending an API request when adding an order
    • URL
    • Request parameters
    • Request example
    • Response example
    • Response parameters
  • Step 4. Create an email template
  • Step 5. Set up a trigger mailing
© 2015 - 2026 Altcraft, LLC. All rights reserved.