Recombee Docs
Visit recombee.comStart Free
docs20User Documentation
adminuiAdmin UI
reql32ReQL
codeAPI Clients & Integrations
suitcaseMisc

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

JS
var client = new recombee.ApiClient('name-of-your-db', '...db-public-token...', {region: 'us-west'});

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);

  }
);
© Copyright 2024, Recombee s.r.o
docs.recombee.com