Receiving Recommendations to a Mobile App

You can personalize the user experience and increase sales by adding recommendations of your goods and services to an app.

The passed recommendations are based on the customer activity data and include the following options:

  • Out of stock. A selection based on similar items.
  • Cross-selling. Offer of related products. The selected items are based on those added to the cart.
  • Upselling. Offering based on more expensive and complementary goods and services to increase the order value.
  • Potential purchase. The selected items are based on the orders of users who have purchased this product.
  • Personal recommendations based on the customer's purchase and browsing history.
  • Other. An offer is created individually if the required algorithm is not available among our platform's pre-configured algorithms.

Note: Each type of recommendation uses different requests having their own algorithms and rules since they take data from different sources.

Preconditions

Before starting using recommendations you have to meet the following conditions:

  • Subscribe to one of the Extra features pricing plans.
  • Set up web tracking or tracking for mobile apps.
  • Create a data source with a required algorithm for each recommendation type to use its ID when calling an API.

Setting up recommendation transmission includes the following steps, as detailed below:

  1. Getting an authentication token
  2. Getting recommendations via v1/recoms/{dataSourceId} request

Getting authentication token

To get a user authentication token (authToken), send a request via your application from your server to our API.

Request addressRequest method
https://api/v1/auth/contact/tokenPOST

Authenticate the request using one of the methods described in the API instructions. For example, using API keys.

The request shall pass the known user fields listed in the table (at least one field is required).

FieldValueDescription
emailstringContact’s email
phonestringContact’s phone number
externalCustomerIdstringContact’s external ID
userPseudoIdstringFirebase ID for tracking the contact’s behavior
cookiestringcookie sc –
You can generate the cookie file using the tracking script installed on the site

Request example:

{
    "email": string,
    "phone": string,
    "externalCustomerId": string,
    "userPseudoId": string, 
    "cookie": string 
}

Response example:

{
"token": string
}

Further on, authToken authenticates requests to get recommendations. It shall be passed in the ES-TOKEN request header. The current token gets invalidated after every request, and the ES-TOKEN response header contains a new one used for the next request.

When you receive the 401 status, repeat the token request.

Getting recommendations

Send the following request to get personalized recommendations based on customer behavior:

Request addressRequest method
https://contact-api/v1/recoms/{dataSourceId}GET

Request parameters:

FieldValueDescription
dataSourceIdData source ID.
Required parameter*
productsstringArray of products. The required field for algorithms based on product data
categorystringArray of categories. The required field for algorithms based on category data
request headerES-TOKEN: authToken
response headerES-TOKEN: authToken

* To find out the data source ID, go to Account → Settings → Data sources.

The response contains every field filled with the data.

Response example:

{
    // Mandatory fields
    id: string
    name: string
    url: URL
    price: double
    descr: text
    brand: string
    category: string[]
    isInStock: int
    // Optional fields which depend on a customer's feed format
    // All such fields start from "tags_".
    // Examples: tags_gender, tags_clear_size, tags_universal_size
}

After you receive recommendations from our platform, you can display them in the customer’s mobile app.

You have to configure the parameters of recommendations in the app itself (design, placement, and others).