Sending transactional mails

  • Updated

This topic is for administrators and developers with administration access rights in Spryker.

This topic describes how to configure sending of transactional mails when using Spryker as e-commerce platform with Optimizely Campaign. The sending is done via HTTP-API directly from Spryker.

You can use transactional mails to respond to customers' actions in your shop, such as order confirmations, or to send system emails, which include:

  • Login confirmation
  • Password changes and confirmation
  • Order confirmations

Configuring transactional mails in Optimizely Campaign

Sending of transactional mails requires a template in Optimizely Campaign, which uses field functions to insert sent variables into relevant locations. This creates the finished transactional mail with layout, and sends it to the recipient. The sending and receiving of the content of the variables takes place using the transaction recipient list as a buffer.

  1. The Spryker integration sends the variables.
  2. The variables are written into the transaction recipient list: each variable into the relevant recipient list field.
  3. Using field functions, Optimizely Campaign copies the template with the individual variables from the transaction recipient list and places it into the desired location in the transactional mail.

Image: Sending and receiving content of variables

Recipient list fields in Optimizely Campaign's transaction recipient list

By default, the transaction recipient list contains the following fields.

Field name Data type Description
email String Email (required)
salutation String Title
firstname String First name
lastname String Last name
spryker_id String Spryker ID
customer_shop_locale String Language setting in customer shop
customer_shop_url String Customer shop url
customer_login_url String Customer login url
customer_reset_link String Customer reset link
language String Language
order_number String Order number
order_comment String Order comment
order_orderdate String Order date
order_subtotal String Order Subtotal
order_discount String Discount on order
order_tax String Tax on order
order_grand_total String Total sum of order
order_total_delivery_costs String Delivery costs
order_total_payment_costs String Payment costs
subscriber_key String Individual key of user in Spryker Commerce

Creating a template in Optimizely Campaign

Create a template and add the desired transactional mail texts (the unchangeable, static texts that are to be sent to recipients). Insert field functions in places where you want to show content of the Spryker variables.

About field functions

Field functions are placeholders that refer to a specific recipient list field in your transaction recipient list. The variables and content of the variables sent from Spryker are written into the relevant recipient list fields in your transaction recipient list. Your field functions load relevant content from the referenced recipient list field in the next step.

Example

Set up a transactional mail text that welcomes each customer using the last name and the order date. For this you would need the variables salutation, lastname and order_orderdate.

The content of the variables is first written to a relevant recipient list field of the transaction recipient list (from Spryker via the HTTP API). To access these recipient list fields, insert the individual field functions into the Optimizely Campaign template and place the name of the recipient list field in curly brackets. To import the variable contents, the static text and field functions in the Optimizely Campaign template could look like this:

Hello, {salutation} {lastname}!
Thank you for your online order from {oder_orderdate}.

The example will appear in the sent transactional mail as follows:

Hello, Mr. Miller! Thank you for your online order from August 3.

To create the template, do the following:

  1. Open the Optimizely Campaign menu and select Campaigns > Transactional Mails.
  2. Click Create….

    Image: Create transactional email

  3. Drag the Recipients node from the left action area to the workspace area on the right.
  4. In the Recipient lists drop-down list, select your transaction recipient list.

    Image: Selecting transaction recipient list

    Customer support sets up a separate transaction recipient list. Be sure you use this transaction recipient list, instead of a regular recipient list. To see if a recipient list is a transactional recipient list, check the column Transaction API.

  5. From the left action pane, drag an Emailmessage node into the workspace.
  6. In the Name box, assign a concise name to your transactional mail (for example, Order confirmation).

    Image: Edit confirmation name

  7. In the context menu for the message node, click Edit Content….
  8. In the Template drop-down list, select the desired template and confirm your selection by clicking Next.
  9. Configure the template for the transactional mail according to your requirements. Enter a subject and insert the static texts that you want recipients to receive, into the content paragraphs. Insert the relevant field function for the recipient list field of the transaction recipient list into places where variables from Spryker should appear (see the previous example in this topic).
  10. Click Close.
  11. Connect the Recipient node with the message node.
  12. Click Save and Close.
  13. To activate your transactional mail and start the sending process, select the mailing in the Transactional mails overview and click Start.

Configuring transactional mails in Spryker

To set up transactional mails in Spryker, follow the steps on the Spryker documentation website.