Skip to main content
The Recommendations module provides methods to retrieve personalized product recommendations from Constructor.io. Recommendations are powered by recommendation pods that you configure in your Constructor.io dashboard.

Key Concepts

Recommendation Pods

A recommendation pod is a configured strategy that determines which products to recommend. Each pod has a unique identifier (podId) and can be customized with various strategies such as:
  • Best sellers: Most popular items
  • Similar items: Products similar to a specific item
  • Frequently bought together: Items commonly purchased together
  • Personalized: Recommendations based on user behavior
  • Trending: Currently popular items

Strategy-Specific Parameters

Some parameters are specific to certain recommendation strategies:
  • itemIds: Used by strategies that recommend items related to specific products (e.g., “similar items”, “frequently bought together”)
  • term: Used by strategies that refine results based on a search term

Available Methods

Get Recommendation Results

Retrieve product recommendations for a specific pod

Basic Example

const ConstructorIO = require('@constructor-io/constructorio-client-node');

const constructorio = new ConstructorIO({
  apiKey: 'YOUR_API_KEY',
  apiToken: 'YOUR_API_TOKEN'
});

// Get best seller recommendations
const results = await constructorio.recommendations.getRecommendations(
  'best-sellers-pod',
  {
    numResults: 10,
    section: 'Products'
  }
);

console.log(results.response.results);

Common Use Cases

Homepage Recommendations

Display personalized or trending products on your homepage:
const homepage = await constructorio.recommendations.getRecommendations(
  'homepage-recommendations',
  { numResults: 12 }
);

Product Detail Page

Show similar or complementary products:
const similar = await constructorio.recommendations.getRecommendations(
  'similar-items-pod',
  {
    itemIds: 'product-123',
    numResults: 6
  }
);

Filtered Recommendations

Get recommendations with specific filters applied:
const filtered = await constructorio.recommendations.getRecommendations(
  'best-sellers-pod',
  {
    numResults: 8,
    filters: {
      category: 'electronics',
      brand: ['Sony', 'Samsung']
    }
  }
);

Response Structure

All recommendation methods return a consistent response structure:
{
  request: {
    pod_id: 'best-sellers-pod',
    num_results: 10,
    // ... other request parameters
  },
  response: {
    results: [
      {
        value: 'product-id',
        data: {
          title: 'Product Name',
          price: 29.99,
          // ... other product data
        },
        matched_terms: [],
        is_slotted: false,
        labels: {},
        strategy: {
          id: 'best_sellers'
        }
      }
      // ... more results
    ],
    total_num_results: 10,
    pod: {
      id: 'best-sellers-pod',
      display_name: 'Best Sellers'
    }
  },
  result_id: 'abc123-result-id'
}

Next Steps

Build docs developers (and LLMs) love