Recommending products to users
Use the Braze REST API alongside catalogs or Connected Content to surface personalized product recommendations in your messages. This approach lets you plug your own recommendation engine into the Braze messaging ecosystem, so non-technical users can own the content and messaging surrounding each recommendation.
With this approach, you can:
- Store product recommendations on user profiles from your backend using the REST API.
- Retrieve product metadata at send time using catalogs or Connected Content.
- Display personalized recommendations across any messaging channel, including email, push, in-app messages, and more.
Prerequisites
To complete this guide, you need:
| Requirement | Description |
|---|---|
| Braze REST API key | A key with the users.track permission and, if managing catalogs via API, the relevant catalogs permissions. To create one, go to Settings > API Keys. |
| Braze catalog | A catalog containing your product metadata (such as name, category, price, and image URL). To create one, see Create a catalog. |
| Liquid knowledge | Intermediate familiarity with Liquid for templating personalized variables and using Connected Content. |
Step 1: Store recommendations on user profiles
To begin, store the product recommendations generated by your recommendation engine on Braze user profiles as custom attributes. This lets you reference each user’s recommended products at message send time.
- Determine which recommendation data to store, such as product IDs or preferred categories.
- Use the
/users/trackendpoint to write the recommendation as a custom attribute on the user profile.
Example request
1
2
3
POST YOUR_REST_ENDPOINT/users/track
Content-Type: application/json
Authorization: Bearer YOUR_REST_API_KEY
Replace YOUR_REST_ENDPOINT with the REST endpoint URL for your workspace.
1
2
3
4
5
6
7
8
{
"attributes": [
{
"external_id": "user123",
"recommended_product_id": "1001"
}
]
}
Use meaningful attribute names (such as recommended_product_id) so they’re easy to reference in Liquid templates later. Keep recommendations accurate by updating them regularly as your recommendation engine produces new results.
Step 2: Retrieve product metadata
After storing a recommendation identifier on each user profile, you need to retrieve the full product metadata (name, price, image, and so on) to include in your message. You have two options:
- Option A: Braze catalogs — store product information directly in Braze for fast, built-in lookups.
- Option B: Connected Content — fetch product information from an external API at send time.
Option A: Braze catalogs
If you’ve created a catalog with your product inventory, you can look up items directly in your message using Liquid. For a full walkthrough, see Using catalogs.
Recommend a specific catalog item
To reference a specific product by ID, use the catalog_items Liquid tag. For example, to recommend product 1001 from a catalog named retail_products:
1
2
3
4
5
6
{% catalog_items retail_products 1001 %}
We have a new item we think you'll like:
Category: {{ items[0].category }}
Name: {{ items[0].name }}
Price: ${{ items[0].price }}
Recommend multiple catalog items
You can also reference multiple items in a single tag. For example, to feature three products:
1
2
3
4
5
6
7
8
{% catalog_items retail_products 1001 1003 1005 %}
New items added in:
- {{ items[0].category }}
- {{ items[1].category }}
- {{ items[2].category }}
Visit our store to learn more!
Template items using a user’s recommendation
Combine the custom attribute from Step 1 with a catalog lookup to personalize the recommendation for each user:
1
2
3
4
{% catalog_items retail_products {{custom_attribute.${recommended_product_id}}} %}
Hi {{${first_name}}}, check out our pick for you:
{{ items[0].name }} — ${{ items[0].price }}
Option B: Connected Content
If your product metadata lives in an external service rather than a Braze catalog, use Connected Content to fetch it at send time.
For example, if your internal API returns product details by ID:
1
2
3
4
{% connected_content https://api.yourcompany.com/products/{{custom_attribute.${recommended_product_id}}} :save product %}
Hi {{${first_name}}}, we think you'll love:
{{ product.name }} — ${{ product.price }}
For more details on making API calls from your messages, see Making an API call.
Avoid using Connected Content to fetch a large list of products and then iterating through that list in Liquid at send time. Large response payloads increase send latency and can cause message timeouts or delivery failures at scale. Instead, store only the specific product IDs a user needs on their profile (see Step 1), and fetch metadata for those individual items or use catalogs, which are optimized for fast lookups.
Step 3: Verify your integration
After completing the setup, verify your integration:
- Use the
/users/trackendpoint to write a test recommendation to your own user profile. - Send a test message that references the recommended product using either Catalogs or Connected Content.
- Confirm the product details render correctly in the delivered message.
- In the Braze dashboard, go to the campaign or Canvas results page and confirm the send is recorded.
Considerations
- Keep recommendation data accurate by updating custom attributes regularly as your recommendation engine produces new results.
- Use Braze personalization features to further tailor messages, such as incorporating user-specific data alongside product details.
- Consider using API-triggered delivery to trigger messages from your backend using templates defined in the Braze dashboard.
Edit this page on GitHub