Adobe Campaign Content Recommendations in Email

Denis Bozonnet
Sep 18 · 12 min read

We have published before how Adobe I/O can polish some of the rough edges of Adobe Experience Cloud solutions. This article explains in more detail a specific example using Adobe I/O Runtime.

Use case

These days, personalisation is key to retaining consumers’ attention, and the best attention requires top-notch content for keeping consumers entertained.

The use case covered by this article is to leverage content recommendations in email via Adobe Target and Adobe I/O Runtime in Adobe Campaign. The types of recommendations include scenarios such as most viewed, most popular, best rated, or best seller.

For instance:

  • In the food industry, it could be recommendations of popular recipes
  • In the insurance industry, it could be add-on products based on existing product ownership type or similar
  • In the retail industry, it could be best seller or best rated
  • In the travel industry, it could be most popular destinations

These scenarios use consumer preferences to narrow down the contents to display, and they do not require the customer identifier to be executed.

As a result, everyone with the same preferences will receive the same recommendations. This point is important for the realisation of this use case.

Most popular recipes

Prerequisites

Adobe Target Recommendations implementation on the website tracks visitor engagement and captures the contents that are viewed. A recommendations activity within Target can be set up to return contents based on algorithms such as “Popularity — most viewed,” “Popularity — best rated,” or “Popularity — best seller.

Adobe Target can return content information such as images and click-thought URLs for a given piece of content. Other information such as price or star rating could be either known by Adobe Target or available via a Product Information Management solution.

Adobe Target requires the ability to filter contents based on classifications / tags related to consumer preferences

Because preferences aren’t very volatile between the time of sending and opening an email, the content recommendations can be made just before sending the emails (as opposed when opening an email). It also brings advantages to:

  • Display a piece of content with enriched information such as price, discount, rating, or extended CTAs that are not possible to realise while opening an email (image-based recommendation only)
  • Being able to send emails to most valuable people during flash sales with the latest prices and discounts information

Finally, you need to have an understanding of Adobe Target API.

Architecture

The following diagram shows the products in play to realise the use case.

Content Recommendations in Email — Architecture Diagram

The main systems are the following:

  • Adobe Campaign: Multi-channel marketing solution
  • Adobe Target: Adobe experience optimization solution
  • Adobe I/O Runtime: Adobe serverless solution
  • PIM: Customer Product Information Management solution (depends on customer)

While the list of interfaces are:

  • 01 — Get Content Recommendations: Main interface responsible to get the recommendations from Adobe Target back to Adobe Campaign
  • 02 — batchmBox: Standard Adobe Target recommendation API
  • 03 — Get Product Information: Depending of the deployment of Adobe Target and your solution, it may be required to get product information from the PIM solution prior returning information to Adobe Campaign

Concepts

The use case requires an Adobe I/O Runtime endpoint that invokes Adobe Target API and returns a series of content recommendations to show in email or other channels.

The user case consists of three elements:

Adobe Target Activity Definition: Each Adobe Target activity is configured in Adobe Campaign in a new custom resource “Target Activity Definition,” the metadata of Target activity are used to define it in Adobe Campaign, information such such as Target instance, property, activity name, input parameters, and returned field names. Such information is provided by the implementer of the Target activity.

Adobe Target Activity Definition

Adobe I/O Runtime: An end-point that does the following:

  1. Call Adobe Target API
  2. Transform Target JSON to a ready-to-use file for Adobe Campaign to consume

Workflow: This workflow does the following:

  1. Get a list of profiles
  2. Get the Activity Definition
  3. Call the new endpoint that produces a CSV flat file of content recommendations to show
  4. Merge the first three recommendations returned by Adobe Target to the targeted profile to be used in the email within that Target data
  5. The workflow looks like below and more detail will be given further down.
Content Recommendations workflow template

Adobe Campaign configuration

As mentioned previously, Adobe Target activities are configured within Adobe Campaign within a new entity “Target Affinity Definition” allowing to describe Adobe Target API as metadata.

The definition of the activity is a direct one-to-one mapping with Adobe Target API JSON.

Adobe Target Input Parameters

Adobe Target API POST Configuration

We will use a sample of Adobe Target API to explain the input parameters related to the configuration of Target activity in Adobe Campaign. Such information will be provided by Adobe Target team.

Adobe Target API POST: https://[[client_tenant]].tt.omtrdc.net/rest/v2/batchmbox?client=[[client_tenant]]&sessionId=[[Randome_SessionId]]

The picture below provides the mapping between Adobe Target URL and the fields in Adobe Campaign.

Target API URL — Mapping

Now that we’ve got the URL mapping done, it’s time to define the URL Request body mapping.

Below is a sample of the JSON body of the Adobe Target request.

Adobe Target JSON Body Request

The picture below provides the mapping between Adobe Target JSON body and the fields in Adobe Campaign.

Target API Body — Generality Mapping

Activity parameters

These parameters are specific per activity and are used to filter out the content in Adobe Target or other means. Parameters represent for instance consumers preferences such as diet preference or consumer conditions such as skin type (dry / oily / neutral).

The picture below provides the mapping between Adobe Target JSON input parameters and the fields in Adobe Campaign. Sample is taken from the food industry.

Target API Body— Parameters Mapping

Adobe Target output parameters

We will use a sample of Adobe Target API to explain the input parameters related to the configuration of Target activity in Adobe Campaign.

Adobe Target — Response Body Sample

The picture below provides the mapping between Adobe Target JSON output and the fields in Adobe Campaign.

Target API Body — Output Parameters Mapping

The list of fields expected to be provided are the following:

  • content — mBox Response Array: Name of the array in the JSON representing the list of returned contents returned. This field should always be present in the JSON returned by Adobe Target
  • contentName_x — Content Display Name: First part of the field representing the content display name. This field should always be present in the JSON returned by Adobe Target
  • contentURL_x — Content Relative URL: First part of the field representing the relative URL associated to the content, it is important that the URL being relative to the website domain. If the URL is a full URL, it will be stripped out from its website part to be made relative, (required for tracked links in Adobe Campaign). This field should always be present in the JSON returned by Adobe Target
  • contentImage_x — Content Image URL: First part of the field representing the full image URL. This field should always be present in the JSON returned by Adobe Target

Depending of the use case, you would have the following fields available to you to be used in an email:

  • Content Short Description: First part of the field representing a short description (plain text only) of a content
  • Content Discount: First part of the field representing a discount of a content
  • Content Price: First part of the field representing a price (including currency) of a content
  • Content CTA Text: First part of the field representing the text for a 2nd CTA for a content, such as Download, Add to basket
  • Content CTA Relative URL: First part of the field representing the relative URL for a 2nd CTA for a content, such as Download, Add to basket
  • Content Time: First part of the field representing a star rating of a content
  • Content Difficulty: First part of the field representing a difficulty of a content, it could be a recipe difficulty to realise or an event difficulty (walk, trekking, etc…)
  • Content Rating: First part of the field representing a time / duration of a content, it could be a recipe preparation time or an event duration (walk, trekking, etc…)

Adobe I/O Runtime

This part describes the Adobe I/O Runtime endpoint that is deployed for this use case.

Generalities

As a reminder, the endpoint is responsible to:

  • Get all the input and output parameters set in the “Target Activity Definition
  • Call Adobe Target API to get the content recommendations
  • Create a CSV file of that is then returned to Adobe Campaign

Invoking the endpoint from a browser results to download a CSV file.

Endpoint Structure

The Adobe I/O Runtime endpoint has the following structure:

https://adobeioruntime.net/api/v1/web/[[Customer_NameSpace]]/default/getContentRecommendations?client=[[client_tenant]]&mbox=[[AT_Activity_Name]]&at_property=[[AT_Property]]&dietPreference=vegan&sessionId=0.43537454354&mBoxResponseArrayField=[[AT_RESPONSE_ARRAY]]&param1=dietPreference:vegan&param2=&param3=&param4=&param5=&param6=&param7=&param8=&param9=&param10=&contentDisplayNameField=contentName&contentImageUrlField=contentImage&contentRelativeUrlField=contentURL&contentPriceField=contentPrice&contentCtaTextField=contentCTAText&contentCtaRelativeUrlField=contentCTAURL&contentDiscountField=contentDiscount&contentShortDescriptionField=contentShortDescription&contentTimeField=contentTime&contentDifficultyField=contentDifficulty&contentRatingField=contentRating

As you can see, the endpoint is taking all the information from the “Target Activity Definition” record as query string.

Input parameters for the Target activity are also passed as input parameters, up to 10, If any format are required, it should be done in Adobe Campaign

It returns 11 fields in the following order:

These three fields are expected to be always returned by Adobe Target:

  • Content Display Name: This is the name of the content as seen on the web / email
  • Content Relative URL: Relative click URL of the content. For tracked link in ACS, links should be relative, the sender domain is therefore removed from it
  • Content Image URL: Fully qualified URL of the content image

The following fields are optionally returned by Target and they may make sense depending on the use case.

  • Content Short Description: Short description as plain text for a piece of content, presentaiton layer is left to the calling system
  • Content Price: Price (including currency) of a piece of content
  • Content Discount: Discount applicable of a piece of content
  • CTA Text: Text of the extra action that could be done directly from the email: it could be download, add to basket
  • CTA URL: Relative URL of the action that could be done directly from the email: it could be download, add to basket
  • Time: Time allocated to a piece of content. For instance, a duration for a recipe or the duration of a journey or event
  • Difficulty: Difficulty associated to a piece of content, for instance difficult to prepare a recipe, difficulty of an event
  • Rating: Rating of a piece of content collected by rating systems such as Bazaarvoice,

Node.js Function

The Node.js function has seven steps.

  1. It requires two libraries: “request” and “queryString
  2. It gets the query string parameters from the request and sets them in local variables
  3. It builds Adobe Target body request
Adobe I/O Runtime — Request Body

4. It builds Adobe Target API request

Adobe I/O Runtime — Adobe Target Request

5. It invokes Adobe Target API and builds a file out of its output

Adobe I/O Runtime — Adobe Target API INvocation

6. The result is a CSV file with the following structure

7. Invoking the endpoint via a browser downloads a file

Adobe I/O Runtime — File Download

You are now ready to create your workflow Adobe Campaign workflow.

Adobe Campaign workflow

The workflow will use the new endpoint and the Target Activity Definition to enrich the targeted profiles with the content recommendations related to their preferences.

The following picture provides the steps of the workflow.

Workflow

Step 1: Get Profiles

This step will be specific to each use case from a filtering point of view, but it has a common purpose that the targeted profiles should have the same preferences that will be used by Adobe Target to recommend contents.

For instance, it should return profiles with the same diet preference or the same skin type or the same clothing style.

The Additional Data to provide are as per the picture below.

Step 1- Get Profiles — Additional Data

Step 2: Get Target Activity Definition

This step is retrieving the activity definition set up in “Adobe Campaign — Configuration” section.

  1. Filter criteria: The filter criteria proposed at minimum should be:
Step 2 — Target Activity Definition — Filter Criteria

2. Additional data: A series of additional data are set and are all mandatory, but some of them should be adapted to match the expected input parameters for the future request

Step 3: Build Query String

This step is taking the previous additional data to build the future query string to be passed to the endpoint.

The query string is set as additional data and since additional data are limited to 255 characters, it may be required to modify them by adding a new field.
All the fields defined in the Additional Data of step 2 are required to be present uniquely in the query string fields.

Step 3 — Build Query String

Step 4: Get Content Recommendations

This step is loading a file via a HTTPS request to an Adobe I/O Runtime endpoint doing the following:

  1. Build Adobe Target request using the query string information
  2. Call Adobe Target API
  3. Produce a file with content information to display and return the content information declared in the “(Target) Content” fields
  4. If a piece of information is not provided by Adobe Target, an empty value is provided for this information:
Step 4 — Get Content Recommendations

It then returns the file back to Adobe Campaign and is then loaded in the next activity.

Step 5: Load File

This step is loading the file returned by Adobe I/O Runtime endpoint from Step 4.

The file structure is fixed and is composed of a series of recommendations with 11 fields each. Each recommendation is able to show the following information:

  • contentDisplayNameField: Display name of the first piece of content
  • contentRelativeUrlField: Relative click-through URL of the first piece of content
  • contentImageUrlField: Full image URL of the first piece of content
  • contentShortDescriptionField: Short description (plain text on a single line) of the first piece of content
  • contentPriceField: Price of the first piece of content
  • contentDiscountField: Discount applicable of the first piece of content
  • contentCtaTextField: Text of a second action of the first piece of content (Download, Add to Basket, View video…)
  • contentCtaRelativeUrlField: Relative click-through URL of a second action of the 1st piece of content (Download, Add to Basket, View video…)
  • contentTimeField: Time related to the first piece of content (preparation time, event expected duration, …), expected to be plain text
  • contentDifficultyField: Difficulty related to the first piece of content (event difficulty, preparation difficulty, ….), expected to be plain text
  • contentRatingField: Star rating of the first piece of content

It is up to you to decide how many recommendations you would need to return. In email, best practice would be to show three recommendations.

Step 6: Add Dummy Reconciliation Key

This step is adding the same dummy reconciliation key to be able to join the contents to the target profile.

Step 6 — Dummy Reconciliation

Step 7: Add Three Content Recommendations to Targeted Profiles

This step is taking the first three recommendations and is adding them to the targeted profiles.

Step 7 — Add Content Recommendations to targeted profiles

Step 8: Add Delivery

This step relates to add a single or recurring delivery in the workflow that uses the fields added in the target data in Step 7 to display the contents in the email.

There are some changes to make in the content blocks to use the new generic fields:

CTA HTML

Link 1<a href="https://www.customersite/<%= escapeUrl(context.targetData.contentRelativeUrl_1) %>">Click Here</a>
Link 2<a href=https://www.customersite /<%= escapeUrl(context.targetData.contentRelativeUrl_2) %>">Click Here</a>
Link 3<a href="https://www. customersite /<%= escapeUrl(context.targetData.contentRelativeUrl_3) %>">Click Here</a>

Img HTML

Image 1<img src="<%= context.targetData.contentImage_1 %>"alt="<%= context.targetData.contentDisplayName_1 %>"/>
Image 2<img src="<%= context.targetData.contentImage_2 %>"alt="<%= context.targetData.contentDisplayName_2 %>"/>
Image 3<img src="<%= context.targetData.contentImage_3 %>"alt="<%= context.targetData.contentDisplayName_3 %>"/>

Title HTML

Title 1<%= context.targetData.contentDisplayName_1 %>
Title 2<%= context.targetData.contentDisplayName_3 %>
Title 3<%= context.targetData.contentDisplayName_3 %>

A final remark

One more remark, as sort of a disclaimer: The intent of this article has been to show the integration capabilities opened up by the combination of Adobe I/O Runtime with Adobe Campaign and Adobe Target. A final solution will depend on the deployment of Adobe Target and Adobe Campaign within the customer applications landscape.

Conclusion

Adobe I/O Runtime can substantially increase the functionality of Adobe Campaign Standard workflows with enhanced personalisation.

Adobe Tech Blog

News, updates, and thoughts related to Adobe, developers, and technology.

Denis Bozonnet

Written by

Senior Consultant — Adobe

Adobe Tech Blog

News, updates, and thoughts related to Adobe, developers, and technology.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade