JavaScript API ClientΒΆ

  • GitHub (contains installation info and more examples)

The library allows you to request recommendations and send interactions between users and items (views, bookmarks, purchases ...).

It is intended for usage in browsers and other client side integrations (such as in React Native / NativeScript mobile apps). For Node.js SDK please see the Node.js library.

  • Example:
var client = new recombee.ApiClient('--my-database-id--', '--my-PUBLIC-token--');

var itemId = 'product-270';
var userId = 'user-1539'
// Send detail view
client.send(new recombee.AddDetailView(userId, itemId));
// Request recommended items
client.send(new recombee.RecommendItemsToItem(itemId, userId, 3,
  {
      returnProperties: true,
      includedProperties: ['title', 'description', 'link', 'image_link', 'price'],
      filter: "'title' != null AND 'availability' == \"in stock\"",
      scenario: 'related_items'
  }),
  (err, resp) => {
    if(err) {
      console.log("Could not load recomms: ", err);
      return;
    }
    console.log("Recommendations: ", resp.recomms);

  }
);