There is no need to “pull the head”. We will certainly take an active part in the marketing activities


There is no need to

Today, “traffic” means everything… As long as you can attract enough traffic, whether it’s product promotion or live delivery, it’s a piece of cake. However, for enterprise marketing personnel, the worst thing is the marketing activities that are painstakingly planned and held. In the end, no one cares, and all efforts have been wasted

After all, today’s marketing service providers master a variety of customer communication channels, and the focus at this time is: how to send the right information to the right customers at the right time and through the right channels!

With the help of digital technology, this problem is actually very easy to solve. This article will introduce how to combine brace (a set of customer participation platform based on AWS, facing immediate needs and emphasizing continuous contact) with Amazon personalize to try to solve the problem of participation in marketing activities, so as to provide customers with a pleasant experience.

Braze can help marketers easily organize customers as audiences and update them in real time according to their behavior and personal data characteristics, so as to create message delivery publicity and locate the target audience through e-mail, SMS, push notification and other channels. We can also use braze canvas to design a multi-step and multi-channel participation process. Campaign and canvas can be triggered manually according to the plan or even the actual operation of the customer. Of course, the actual effect of sending personalized messages to customers directly depends on the tendentious content revealed in customers’ personal data. We need to organize product and content recommendations according to the preferences of each customer when interacting with mobile applications on the web, so as to truly introduce personalized elements into each publicity message.

Amazon personalize is an AWS service that uses machine learning algorithms to create recommendation systems based on customer behavior data. This recommender is proprietary to AWS accounts and generates content only based on the data provided. With the braze connected content function, we can connect braze to the same set of Amazon personalize recommenders used to provide recommendation messages in web and mobile applications, so that the messages sent by braze can accurately reflect the current preferences and intentions of the audience.

Solution overview

In this article, we will introduce two architectures: one is to use braze and Amazon personalize for real-time recommendation, and the other is to sacrifice some real-time recommendation freshness in exchange for a more cost-effective batch processing method. Our specific choice of methods should be adapted to the objectives of the audience’s publicity strategy and the scale needs of message transmission. Fortunately, braze and Amazon personalize provide a wealth of functions and integration options to meet our practical needs for operational flexibility.

Real time integration

Start with the real-time integration architecture. The following figure shows the relevant components in the e-commerce application. You will use the machine learning (ML) support recommender provided by Amazon personalize, that is, the solution in this article. When building this solution, the main data involved is the interaction history between users and various commodity items. In the e-commerce application, specific events should also be included, such as the customer’s viewing of goods, adding goods to the shopping cart, and the actual purchase of goods. When there is a wealth of event, item and user metadata available, you can combine these metadata to further improve the correlation between the recommendation system and the recommended content.

The specific content of metadata can cover multiple levels, including the type of equipment used by customers, location, time of occurrence (shopping season), etc; Category, type and price range of commodities; And the user’s age, gender and subscription tendency. After creating the solution, you can create an automatic extension API endpoint called campaigns with just a few clicks to retrieve personalized recommendations.

How to deploy this application in AWS account will also be described later. This application also comes with a self-help seminar course, which allows us to learn how to use braze to send personalized promotional emails to customers.

There is no need to

Our example e-commerce application will retrieve personalized suggestions from the recommendations micro service, which suggests attaching the recommended product id provided by Amazon personalize to the products micro service to enrich product information. When the user interacts with the application and expresses his interest by viewing goods, adding goods to the shopping cart and even purchasing goods, the events related to these operations will be streamed to Amazon personalize through AWS amplify JavaScript client library, and then the latter will automatically make recommendations and adjustments according to the user’s real-time activities.

Through the built-in personalized settings in the application, we can connect Amazon personalize with blaze, and provide customers with personalized recommendation results through e-mail, SMS and push notification.

You can also create message templates through braze. Such templates use the liquid template language to replace the original placeholders in the template with values from customer profiles and other external resources. In the real-time architecture, the sample application we use takes the recommendations micro service as an external resource, uses the braze connected content function to retrieve personalized recommendations, and then includes the applicable recommendations in the message template. In the following connected content liquid tag (located at the beginning of the email), we can see how to call the recommendations service from braze to retrieve recommendation information for the current user.

{% connected_content http://<RecommendationsServiceHostName>/recommendations?userID={{${user_id}}}&fullyQualifyImageUrls=1&numResults=4 :save result %}

The tag contains the following elements:

  • Liquid tags are located between {% and%}, so we can add tags, expressions, or even text or HTML to the message template.
  • The label type will be declared immediately after the label begins. In this case, the tag type is connected_ content。 For a complete list of supported tags, see personalizing with liquid tags.
  • Next, we need to define a standard URL called by connected content and pointing to the corresponding HTTP resource for each user. Replace the < recommendationsservicehostname > section with the host name of elastic load balancer to implement the recommendationsservice in the sample application deployment.
  • Recommendations service will provide corresponding resources for different personalization functions. We can access user recommended resources through the / recommendations path.
  • Next is the query string parameter. The user is authenticated through the userid parameter, while the {${user_id}} expression is used to instruct braze to insert the user ID in each service call.
  • The last two query string parameters are fullyqualifieimageurls = 1 and numresults = 4, which are used to tell recommendations that the service must ensure that the product image URL is correctly available, so that it can be successfully displayed in the user’s e-mail client. In addition, in this example, only the first four recommended items should be returned.
  • The: save result expression tells braze to assign the JSON response from the recommendations service to a template variable named result. After the response is saved, we can use the liquid tag in the rest of the template to access the elements in the response.

The following code shows the response format from the recommendations service:

 "product": {
 "id": "2",
 "url": "",
 "sk": "",
 "name": "Striped Shirt",
 "category": "apparel",
 "style": "shirt",
 "description": "A classic look for the summer season.",
 "price": 9.99,
 "image": "",
 "featured": "true"
 "product": {
 "id": "1",
 "url": "",
 "sk": "",
 "name": "Black Leather Backpack",
 "category": "accessories",
 "style": "bag",
 "description": "Our handmade leather backpack will look great at the office or out on the town.",
 "price": 109.99,
 "image": "",
 "featured": "true"

For simplicity, the above codes only show the first two recommended products. We can use multiple item attributes in the brace message template to represent each suggestion. To access a specific element in an array or list, you can use the array subscript symbol in the liquid tag. For example, the following label will insert the product name of the first recommended product in the response. Corresponding to the previous sample response, the label after parsing corresponds to “striped shirt”:


After combining the personalized recommendation response information from the recommendations service with the liquid tag, we can design countless message construction methods according to our needs. The following code is shown to display the recommended products in the HTML email template.

 <a href="{{result[0].product.url}}" target="_blank">
 <img width="200" />
 <p>Only <strong>$ {{result[0].product.price}}</strong>!</p>
 <a class="button" href="{{result[0].product.url}}">Buy Now</a>

Batch integration

The batch integration architecture uses Amazon personalize batch recommendation job instead of the braze connected content function, which is specifically responsible for pushing attribute updates to braze. For batch recommendation, you need to create files in the Amazon Simple Storage Service (Amazon S3) bucket, including users who are recommended. Next, reference this file to submit the job to Amazon personalize, which generates recommendations for each user in the file and outputs the results to another Amazon S3 file selected. We can use the output results of the batch recommendation job to associate the personalized recommendation with the user profile in blaze as a user-defined attribute. In this way, the liquid tag we saw in the message template of the previous architecture will be adjusted in this architecture to be accessed through the user’s profile (rather than the connected content response) as the recommendation result of the user-defined attribute.

As mentioned earlier, you need to make a trade-off when using the batch method, that is, by sacrificing the freshness of real-time recommendation in exchange for a more cost-effective solution. Since mass recommendation does not require campaign in Amazon personalize as support, it eliminates the additional requests sent by users from connected content to campaign. This method can greatly reduce the total number of requests for blaze campaign, which is large and contains many subdivided audience types. In addition, if you do not need to use Amazon personalize campaigns for other purposes, or plan to create an Amazon personalize solution specifically for mail personalization, you can also not create any campaigns at all.

The following figure shows a feasible method for designing this batch processing architecture. We can still use some web application components in the real-time architecture here; But for brevity, we exclude all components that duplicate the real-time architecture.

There is no need to

We can use Amazon cloudwatch events to periodically trigger the AWS lambda function, which builds an input file for Amazon personalize batch recommendation jobs. After the batch recommendation job is completed, another lambda function will process the output file, further enrich the recommendation items with rich product information, and establish a user update event queue in Amazon kinesis data streams. Finally, the stream event is used through another new lambda function and the user profile is updated using the brace user API.

Using kinesis data flow will bring a series of important benefits, including decoupling batch jobs from transactional blaze user update process, and providing functions such as pause, restart and replay of user update events.

Real time integration drill

You can experience how to realize real-time integration through the retail demo store example e-commerce application. In this article, we will guide you step by step to complete the specific process of deploying this project in AWS account, and explain how to start the self-service braze learning course bound in the application.

The specific operation steps are as follows:

  • Deploy the retail demo store project to the AWS account using the AWS cloudformation template provided therein (25 to 30 minutes).
  • Build Amazon personalize solution and campaigns to provide personalized recommendations (2 hours).
  • Import users into blaze and build a blaze campaign with connected content to retrieve personalized recommendations from Amazon personalize (it takes 1 hour).
  • Clean up resources.


In this exercise, you need to meet the following prerequisites:

  • An AWS account
  • The AWS account must contain a user with various permissions required to deploy the project
  • A brace account

If you do not already have a brace account, please contact a brace customer representative. In addition, you need to complete at least the introduction course of blaze lab.

Step 1: Retail demo storeDeploy to AWSaccount

From the table below, we should select launch stack from the selected areas. The region list provided here does not necessarily mean that projects can be deployed in it, but only represents the corresponding regions in the example deployment.

region start-up
Eastern United States (Northern Virginia) Launch Stack
Western United States (Oregon) Launch Stack
Europe (Ireland) Launch Stack

Accept the default parameter values in the template, and then start the template. The resource deployment of the project takes about 25 to 30 minutes.

Step 2: building Amazon personalize campaigns

Before providing personalized product recommendations, you first need to train the ML model and configure the reasoning endpoint required for recommended content retrieval in Amazon personalize. The cloudformation template deployed in step 1 contains an Amazon sagemaker notebook instance, which provides detailed step-by-step instructions for Jupiter notebook. It takes about 2 hours to build the notebook.

  • Log in to the AWS account used to deploy the cloudformation template in step 1.
  • On the Amazon sagemaker console, select notebook instances.
  • If you haven’t seen the instance of retaildemostore notebook yet, make sure it is in the same area where the project is deployed.
  • To access the notebook instance, select Open Jupiter or open Jupiter lab.
  • After loading the Jupiter web interface for the notebook instance, select workshop / 1-personalization / 1.1-personalize.ipynb.

Notebooks will be organized in the form of directories, so you may need to select the workshop folder to view the subdirectories in notebooks.

  • After opening the 1.1-personalize notebook, read and run the units to complete the learning process step by step.

We can also select run from the jupyter toolbar to run the code in each unit in turn.

There is no need to

Step 3: by brazeSend personalized messages

Generate personalized recommendations by using Amazon personalize solutions and campaigns. Now, we can import each user into their own blaze account, build a messaging template that uses blaze connected content to retrieve Amazon personalize recommended content, and then build a blaze campaign to send the target email to users.

Similar to the personalization workshop in step 1, the blaze messaging workshop will step you through the process. This notebook will take approximately 1 hour to run and complete.

  • If necessary, repeat step 1 to open the jupyter or jupyterab browser window through the Amazon sagemaker notebook instance in the retail demo store deployment.
  • After loading the Jupiter web interface in the notebook instance, select workshop / 4-messaging / 4.2-braze.ipynb notebook.

As before, we may need to select the workshop folder to view the subdirectories under the notebook.

  • After opening the 4.2-brace notebook, complete the learning process step by step by reading and running each unit.

There is no need to

Step 4: resource cleanup

To avoid unnecessary expenses, please delete various resources in the retail demo store project by deleting the cloudformation template we used during deployment. For more details on the source code used in this article and the complete retail demo store project, see GitHub repo.


Today, marketers are trying to attract customers’ attention through various messages, which also means that we must be able to deliver the right messages to the right users with clear positioning at the right time and through the right channels. Blaze provides solutions to the first three problems, and you can also integrate blaze connected content with Amazon personalize to overcome the last challenge and truly sort out highly personalized product and content suggestions that reflect each customer’s current preferences.

There is no need to