NAV
cURL JavaScript iOS Android React Native

Introduction

Welcome to REES46 API Reference. This reference will help you to create new, more effective S2S or M2S integration.

Our API is RESTful and you can use any language to work with it.

We provide examples as:

Authentication

To authorize, send all requests with shop_id parameter. You can send it both in POST and GET requests.

This parameter identifies your shop.

Some operations require secret API key. You'll provide it in shop_secret parameter.

Initialize

Setup

# No setup is needed
// Put this code in the <head> section of web page.
(function(r){
    window.r46=window.r46||function(){(r46.q=r46.q||[]).push(arguments)};
    var s=document.getElementsByTagName(r)[0],rs=document.createElement(r);
    rs.async=1;rs.src='//cdn.rees46.com/v3.js';s.parentNode.insertBefore(rs,s);
})('script');
// Cocoapods: just put this line in your Podfile
pod REES46

// Swift package manager (XCode >= 11)
// 1. Click File menu
// 2. Swift Packages
// 3. Add Package Dependency...
// 4. Specify the git URL for SDK repo: https://github.com/rees46/ios-sdk.git
// 1. Add to dependencies:
implementation 'com.personalizatio:rees46-sdk:1.2.8'

// 2. Append to repositories:
repositories {
    maven {
        url  "https://dl.bintray.com/pnixx/maven"
    }
}

// 3. Append to your project build.gradle
buildscript {
    dependencies {
        ...
        classpath 'com.google.gms:google-services:4.3.2'
    }
}

// 4. Append to your app module build.gradle after line apply
//    plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

// 5. Create your app in the Firebase console
//    and copy file google-services.json to your app root path.
//    Sync gradle now.
// Add required packages:
yarn add @rees46/rn-sdk
yarn add @react-native-async-storage/async-storage
yarn add react-native-device-info

// For push notifications also add:
yarn add react-native-push-notification
yarn add @react-native-firebase/app
yarn add @react-native-firebase/messaging
// On application launch initialize the SDK:
import REES46 from '@rees46/rn-sdk';
...
const sdk = new REES46("YOUR_SHOP_ID", "Stream");

// Initialization is async, so you have a method to test, if SDK is initialized or not:
sdk.isInit(); // returns true/false
// To collect push tokens, you have to make some adjustments to the app:

// ** For iOS:

// Open your /ios/{projectName}/AppDelegate.m file, and add the following: At the top of the file, import the Firebase SDK:
#import <Firebase.h>

// Open a terminal window and navigate to the location of the Xcode project for your app

cd ios/
pod install
// ** For Android

// In your android/build.gradle

buildscript {
    dependencies {
        ...
        //Add this \/
        classpath 'com.google.gms:google-services:4.3.4'
    }
}

// In your android/app/build.gradle add
apply plugin: 'com.google.gms.google-services'

Before using API you have to setup SDK.

Start session

curl https://api.rees46.com/init?did=DEVICE_ID&shop_id=SHOP_ID&v=3&seance=SEANCE_ID&referrer=REF_URL
// Put this line right after setup code
r46('init', 'SHOP_ID', success, failure);
import REES46
var sdk = createPersonalizationSDK(shopId: "SHOP_ID", stream: "ios")
// 1. Add code to your application
public class SampleApplication extends Application {
    public void onCreate() {
        super.onCreate();

        //Initialize
        REES46.initialize(getApplicationContext(), SHOP_ID);

        //Notification callback
        REES46.setOnMessageListener(new MessagingService.OnMessageListener() {
            @Override
            public void onMessage(Map<String, String> data) {

                //----->
                //Show your custom notification
                //----->

            }
        });
    }
}

// 2. For On-Premise integration need use initialize with custom api domain:
REES46.initialize(getApplicationContext(), SHOP_ID, API_DOMAIN);

// 3. Check AndroidManifest.xml and add android:name=".SampleApplication" to application item.
<application
        ...
        android:name=".SampleApplication"

GET https://api.rees46.com/init

Before using SDK or API you have to initialize SDK. Initialization takes current user identifier and requests API for project settings and this user preferences.

Depending on platform there are different requirements when to run init:

If you don't have device identifier (first launch on new device), you have to request API's init method to generate new one. Store this identifier (it's named did) in local storage of mobile application or in database: you'll need it for the future requests to API.

Query Parameters

Parameter Required Description
shop_id true Your API key
did false Is mandatory if you have it. Request without did will generate new one in our DB. Use it as device ID for future requests.
v true Version. Just use 3 as value.
seance true User's temporary identifier for the current session. Must be regenerated every time user starts new session. Unique string. This parameter is handled automatically in all SDKs.
referrer false Referrer page URL for web integration.
tz false Timezone offset (integer, positive or negative number as difference with GMT).
stream false Data stream code. Alphanumeric string (letters, numbers only). Max length: 16. Default: null (means "web"). Can be "ios", "android" or any other string. Used to distinguish between mobile apps, web and other events sources.

Events tracking

You have to track all user's behavior to get real time statistics and user's segmentation.

The platform provides different kinds of events:

Events can be tracked in default mode (user did something) and assisted mode (user did something with help of some platform's instruments: search, push, email, recommendations, etc).

To track assisted events, you need to user recommendedBy (or recommended_by, depending on SDK) params.

Required params

All events require at least these parameters:

Parameter Type Required Description
shop_id String true Your API key
did String true Device ID
seance String true User's current session
event String true Type of an event
stream String false Data stream code. Alphanumeric string (letters, numbers only). Max length: 16. Default: null (means "web"). Can be "ios", "android" or any other string. Used to distinguish between mobile apps, web and other events sources

SDKs already handle these parameters out of the box.

Source tracking

# No code implementation
// It's done automatically. You don't have to do anything.
// Track launch from drip campaign (chain).
// Message ID and source will be provided in mobile push payload
sdk.trackSource(source: .chain, code: "MESSAGE_ID")
// Pending implementation
// See click on push notification

For mobile apps you have to track all app launches, happened by drip campaigns, mailings and push notifications. It will allow to track campaigns efficiency properly.

User viewed a product

#Full request without widget recommendation identifiers
curl 'http://api.rees46.com/push' \
    -X 'POST' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    --data-raw 'event=view&shop_id=SHOP_ID&did=DEVICE_ID&seance=SEANCE_ID&segment=SEGMENT[A or B]&item_id[0]=PRODUCT_ID&is_available[0]=PRODUCT_AVAIBILITY[0 or 1]'

#Full request without widget recommendation identifiers
curl 'http://api.rees46.com/push' \
    -X 'POST' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    --data-raw 'event=view&shop_id=SHOP_ID&did=DEVICE_ID&seance=SEANCE_ID&segment=SEGMENT[A or B]&item_id[0]=PRODUCT_ID&is_available[0]=PRODUCT_AVAIBILITY[0 or 1]&recommended_by=dynamic&recommended_code=UNIQUE_RECOMMENDER_CODE'

#Short request with minimum required parameters
curl 'http://api.rees46.com/push' \
    -X 'POST' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    --data-raw 'event=view&shop_id=SHOP_ID&did=DEVICE_ID&item_id[0]=PRODUCT_ID'

// Simple track
r46("track", "view", {
    id: 37,
    stock: true
});

// Also notify the product is in stock (if it was not in stock)
r46("track", "view", {
    id: 37,
    stock: true
});

// Or not in stock now (to prevent recommending it on the next requests)
r46("track", "view", {
    id: 37,
    stock: false
});

// Track if product was viewed after click on product recommendations
r46("track", "view", {
    id: 37,
    recommended_by: "dynamic",
    recommended_code: "jkIWdXSRfwVyK"
});

// Track if product was viewed after click on suggest results
r46("track", "view", {
    id: 37,
    recommended_by: "instant_search"
});

// ... or on full results
r46("track", "view", {
    id: 37,
    recommended_by: "full_search"
});

// Plain tracking
sdk.track(event: .productView(id: "PRODUCT_ID")) { trackResponse in
    print("Product viewed callback")
    switch trackResponse {
    case let .success(response):
        print("Successful")
    case let .failure(error):
        switch error {
        case .custom(let customError):
            print("Error: ", customError)
        default:
            print("Error: ", error.localizedDescription)
        }
        fatalError("Task failed successfully")
    }
}


// Tracking after product recommendation click
let recData = RecomendedBy(type: .dynamic, code: "beb620922934b6ba2d6a3fb82b8b3271")
sdk.track(event: .productView(id: "PRODUCT_ID"), recommendedBy: recData) { trackResponse in
    // ...
}

// View product (simple)
sdk.track("view", 37);

// View product (extended, try to avoid)
sdk.track("view", {
    id: 37,
    stock: true
});

// View product after click on recommender block
sdk.track("view", {
  id: PRODUCT_ID,
  recommended_by: 'dynamic',
  recommended_code: 'UNIQUE_RECOMMENDER_CODE'
});

// View product after search results (instant search)
sdk.track("view", {
  id: PRODUCT_ID,
  recommended_by: 'full_search',
  recommended_code: QUERY_STRING
});

// View product after search results (full search)
sdk.track("view", {
  id: PRODUCT_ID,
  recommended_by: 'instant_search',
  recommended_code: QUERY_STRING
});

Send this event when user opens product's details page.

JS SDK syntax

Syntax
r46("track", "view", {params});

JS SDK Parameters

Parameter Type Requirement Description
id number/string required The ID of the product being viewed
stock boolean optional Product availability. If defined, it overwrites the value received from the product feed (XML) and HTTP-import of the product catalog.
recommended_by string required in some cases If a product from a recommendation widget was opened in a popup or a website uses a "single page" architecture, this parameter must contain the value "dynamic".
recommended_code string required in some cases If a product from the recommendations widget was opened in the pop-up or the site uses a "single page" architecture, this parameter must contain a unique code of the recommendations widget, available in the account in the "data-recommender-code" attribute for each widget.

User viewed a category

#Full request
curl 'http://api.rees46.com/push' \
    -X 'POST' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    --data-raw 'event=category&shop_id=SHOP_ID&did=DEVICE_ID&seance=SEANCE_ID&segment=SEGMENT[A or B]&category_id=CATEGORY_ID'

#Short request with minimum required parameters
curl 'http://api.rees46.com/push' \
    -X 'POST' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    --data-raw 'event=category&shop_id=SHOP_ID&did=DEVICE_ID&category_id=CATEGORY_ID'
r46("track", "category", 100500);
sdk.track(event: .categoryView(id: "CATEGORY_ID")) { trackResponse in
    // ... see product viewed event for details about a callback
}
sdk.track("category", 100500);

Send this event when user opens category page.

JS SDK syntax

Syntax
r46("track", "category", category_id);

JS SDK Parameters

Parameter Type Requirement Description
category_id number/string required The ID of the category being viewed

User searched something

#Full request
curl 'http://api.rees46.com/push' \
    -X 'POST' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    --data-raw 'event=search&shop_id=SHOP_ID&did=DEVICE_ID&seance=SEANCE_ID&segment=SEGMENT[A or B]&search_query=URL_ENCODED_SEARCH_QUERY'

#Short request with minimum required parameters
curl 'http://api.rees46.com/push' \
    -X 'POST' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    --data-raw 'event=search&shop_id=SHOP_ID&did=DEVICE_ID&search_query=URL_ENCODED_SEARCH_QUERY'
r46('track', 'search', search_query);
sdk.track("search", "This is a search example");

JS SDK syntax

Syntax
r46("track", "search", search_query);

JS SDK Parameters

Parameter Type Requirement Description
search_query string required The search query text

User added product to cart

#Full request for a single product without widget recommendation identifiers
curl 'http://api.rees46.com/push' \
    -X 'POST' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    --data-raw 'event=cart&shop_id=SHOP_ID&did=DEVICE_ID&seance=SEANCE_ID&segment=SEGMENT[A or B]&item_id[0]=PRODUCT_ID&is_available[0]=PRODUCT_AVAILABILITY[0 or 1]&amount[0]=PRODUCT_QUANTITY'

#Full request for a single product with widget recommendation identifiers
curl 'http://api.rees46.com/push' \
    -X 'POST' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    --data-raw 'event=cart&shop_id=SHOP_ID&did=DEVICE_ID&seance=SEANCE_ID&segment=SEGMENT[A or B]&item_id[0]=PRODUCT_ID&is_available[0]=PRODUCT_AVAILABILITY[0 or 1]&amount[0]=PRODUCT_QUANTITY&recommended_by=dynamic&recommended_code=UNIQUE_RECOMMENDER_CODE'

#Short request for a single product with minimum required parameters
curl 'http://api.rees46.com/push' \
    -X 'POST' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    --data-raw 'event=cart&shop_id=SHOP_ID&did=DEVICE_ID&item_id[0]=PRODUCT_ID&is_available[0]=PRODUCT_AVAILABILITY[0 or 1]&amount[0]=PRODUCT_QUANTITY'

#Full request to send the full current cart
curl 'http://api.rees46.com/push' \
    -X 'POST' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    --data-raw 'event=cart&shop_id=SHOP_ID&did=DEVICE_ID&seance=SEANCE_ID&segment=SEGMEN[A or B]&item_id[0]=1ST_PRODUCT_ID&amount[0]=1ST_PRODUCT_QUANTITY&item_id[1]=2ND_PRODUCT_ID&amount[1]=2ND_PRODUCT_QUANTITY&...&item_id[LAST_INDEX]=LAST_PRODUCT_ID&amount[LAST_INDEX]=LAST_PRODUCT_QUANTITY&full_cart=true'
//Short request for a single product
r46('track', 'cart', id);

//Full request for a single product with widget recommendation identifiers
r46('track', 'cart', {
    id: PRODUCT_ID,
    amount: PRODUCT_QUANTITY,
    stock: true,
    recommended_by: 'dynamic',
    recommended_code: 'UNIQUE_RECOMMENDER_CODE'
});

//Full request to send the full current cart
r46('track', 'cart', [
    {
        id: FIRST_PRODUCT_ID,
        amount: FIRST_PRODUCT_QUANTITY
    },
    ...
    {
        id: LAST_PRODUCT_ID,
        amount: LAST_PRODUCT_QUANTITY
    }
]);
// Track product added to cart
sdk.track(event: .productAddedToCart(id: "PRODUCT_ID")) { trackResponse in
    // ... see product viewed event for details about a callback
}

// Sync full cart (automatically adds and removes products)
sdk.track(event: .synchronizeCart(ids: ["PRODUCT_ID_1", "PRODUCT_ID_2"])) { trackResponse in
    // ... see product viewed event for details about a callback
}
// Not described yet
// Add to cart (simple)
sdk.track("cart", id);

// Add to cart (from recommender block)
sdk.track("cart", {
  id: PRODUCT_ID,
  amount: PRODUCT_QUANTITY,
  recommended_by: 'dynamic',
  recommended_code: 'UNIQUE_RECOMMENDER_CODE'
});

JS SDK syntax (short request for a single product)

Syntax
r46("track", "cart", id);

JS SDK Parameters

Parameter Type Requirement Description
id number/string required The ID of the product added to the cart

JS SDK syntax (full request for a single product)

Syntax
r46("track", "cart", {params});

JS SDK Parameters

Parameter Type Requirement Description
id number/string required The ID of the product added to the cart
amount number optional Product quantity
stock boolean optional Product availability. If defined, it overwrites the value received from the product feed (XML) and HTTP-import of the product catalog.
recommended_by string required in some cases If a product from a recommendation widget was opened in a popup or a website uses a "single page" architecture, this parameter must contain the value "dynamic".
recommended_code string required in some cases If a product from the recommendations widget was opened in the pop-up or the site uses a "single page" architecture, this parameter must contain a unique code of the recommendations widget, available in the account in the "data-recommender-code" attribute for each widget.

JS SDK syntax (request to send the full current cart)

Syntax
r46("track", "cart", [{params}, ..., {params}]);

JS SDK Parameters

Parameter Type Requirement Description
id number/string required The ID of the product added to the cart
amount number optional Product quantity

User removed product from cart

#Full request
curl 'http://api.rees46.com/push' \
    -X 'POST' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    --data-raw 'event=remove_from_cart&shop_id=SHOP_ID&did=DEVICE_ID&seance=SEANCE_ID&segment=SEGMENT[A or B]&item_id[0]=PRODUCT_ID'

#Short request for a single product with minimum required parameters
curl 'http://api.rees46.com/push' \
    -X 'POST' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    --data-raw 'event=remove_from_cart&shop_id=SHOP_ID&did=gN7WW9zXpM&item_id[0]=PRODUCT_ID'
//Full request for a single product
r46('track', 'remove_from_cart', id);
sdk.track(event: .productRemovedFromCart(id: "PRODUCT_ID")) { trackResponse in
    // ... see product viewed event for details about a callback
}
// Not described yet
sdk.track("remove_from_cart", id);

JS SDK syntax (full request for a single product)

Syntax
r46("track", "remove_from_cart", id);

JS SDK Parameters

Parameter Type Requirement Description
id number/string required The ID of the product removed from the cart

User purchased products

#Full request
curl 'http://api.rees46.com/push' \
    -X 'POST' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    --data-raw 'event=purchase&shop_id=SHOP_ID&did=DEVICE_ID&seance=SEANCE_ID&segment=SEGMENT[A or B]&order_id=ORDER_NUMBER&order_price=TOTAL_ORDER_PRICE&item_id[0]=1ST_PRODUCT_ID&amount[0]=1ST_PRODUCT_QUANTITY&price[0]=1ST_PRODUCT_PRICE&is_available[0]=1ST_PRODUCT_AVAILABILITY[0 or 1]&item_id[1]=2ND_PRODUCT_ID&amount[1]=2ND_PRODUCT_QUANTITY&price[1]=2ND_PRODUCT_PRICE&is_available[1]=2ND_PRODUCTAVAILABILITY[0 or 1]&...&item_id[LAST_INDEX]=LAST_PRODUCT_ID&amount[LAST_INDEX]=LAST_PRODUCT_QUANTITY&price[LAST_INDEX]=LAST_PRODUCT_PRICE&is_available[LAST_INDEX]=LAST_PRODUCTAVAILABILITY[0 or 1]'

#Short request with minimum required parameters
curl 'http://api.rees46.com/push' \
    -X 'POST' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    --data-raw 'event=purchase&shop_id=SHOP_ID&did=DEVICE_ID&item_id[0]=1ST_PRODUCT_ID&amount[0]=1ST_PRODUCT_QUANTITY&item_id[1]=2ND_PRODUCT_ID&amount[1]=2ND_PRODUCT_QUANTITY&...&item_id[LAST_INDEX]=LAST_PRODUCT_ID&amount[LAST_INDEX]=LAST_PRODUCT_QUANTITY'
//Full request
r46('track', 'purchase', {
    products: [
        {id: 37, price: 318, amount: 3, stock: true},
        {id: 187, price: 5000, amount: 1, stock: false}
    ],
    order: 'N318',
    order_price: 29999
});
// Track product added to cart
sdk.track(event: .productAddedToCart(id: "PRODUCT_ID")) { trackResponse in
    // ... see product viewed event for details about a callback
}
// Not described yet
sdk.track("purchase", {
  products: [
      {id: 37, price: 318, amount: 3},
      {id: 187, price: 5000, amount: 1}
  ],
  order: 'N318',
  order_price: 29999
});

JS SDK syntax

Syntax
r46("track", "purchase", {params});

JS SDK Parameters

Parameter Type Requirement Description
products array required An array of objects with product information in the order. Description of parameters in the table below.
order number/string optional Order number in the store. If not defined, the internal order numbering system will be used. In this case synchronization of order status is impossible.
promocode string optional Promo code used in transaction.
order_price number optional The final cost of the order including all discounts, bonuses, and additional services. If not defined, the cost of the order is calculated from the data in the product database without discounts and additional services.
order_cash number optional How much a customer paid with real money.
order_bonuses number optional How much a customer paid with bonuses.
order_delivery number optional Delivery fee.
order_discount number optional Order discount.
delivery_type string optional Method of delivery. Available values: "self_pickup", "delivery", "pickup_point"
payment_type string optional Payment type. Can by any string value. Ex: cash, card, wire.

Description of parameters in the objects of the "products" array:

Parameter Type Requirement Description
id number/string required The ID of the product in the order
amount number required Product quantity
price number optional Product cost per unit
stock boolean optional Product availability. It may be useful when a single product is sold to exclude it from the recommendations at once.

User added product to favorites

# Full request
curl 'http://api.rees46.com/push' \
    -X 'POST' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    --data-raw 'event=wish&shop_id=SHOP_ID&did=DEVICE_ID&seance=SEANCE_ID&segment=SEGMENT[A or B]&item_id[0]=PRODUCT_ID'

# Short request with minimum required parameters
curl 'http://api.rees46.com/push' \
    -X 'POST' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    --data-raw 'event=wish&shop_id=SHOP_ID&did=DEVICE_ID&item_id[0]=PRODUCT_ID'
r46('track', 'wish', product_id);
// Not described yet
sdk.track(event: .orderCreated(orderId: "123", totalValue: 33.3, products: [(id: "PRODUCT_ID_1", amount: 3), (id: "PRODUCT_ID_2", amount: 1)])) { trackResponse in
    // ... see product viewed event for details about a callback
}
sdk.track("wish", id);

User removed product from favorites

#Full request
curl 'http://api.rees46.com/push' \
    -X 'POST' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    --data-raw 'event=remove_wish&shop_id=SHOP_ID&did=DEVICE_ID&seance=SEANCE_ID&segment=SEGMENT[A or B]&item_id[0]=PRODUCT_ID'

#Short request with minimum required parameters
curl 'http://api.rees46.com/push' \
    -X 'POST' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    --data-raw 'event=remove_wish&shop_id=SHOP_ID&did=DEVICE_ID&item_id[0]=PRODUCT_ID'
r46('track', 'remove_wish', product_id);
sdk.track(event: .productRemovedToFavorities(id: "PRODUCT_ID")) { trackResponse in
    // ... see product viewed event for details about a callback
}
// Not described yet
sdk.track("remove_wish", id);

Track custom event

# Basic tracking
curl 'http://api.rees46.com/push/custom' \
    -X 'POST' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    --data-raw 'event=my_event&shop_id=SHOP_ID&did=DEVICE_ID&seance=SEANCE_ID'

# With custom parameters
curl 'http://api.rees46.com/push/custom' \
    -X 'POST' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    --data-raw 'event=my_event&shop_id=SHOP_ID&did=DEVICE_ID&seance=SEANCE_ID&category=EVENT_CATEGORY&label=EVENT_LABEL&value=EVENT_VALUE'

// Simple tracking
r46("track", "my_event");

// Tracking with custom parameters
r46("track", "my_event", {
    category: "event category",
    label: "event label",
    value: 100
});
// Simple custom event tracking
sdk.trackEvent(event: "something_happened")

// With parameters
sdk.trackEvent(event: "something_happened", category: "important", label: "banner_click", value: 42)
// Simple tracking of custom event
REES46.track("my_event");

// Tracking with additional parameters
REES46.track("my_event", "event category", "event label", 100);
// Simple tracking
sdk.trackEvent('my_event');

// Tracking with custom parameters
sdk.trackEvent('my_event', {
  category: "event category",
  label: "event label",
  value: 100
});

Custom event can be tracked in simple mode (just event name) and advanced mode (with 3 optional parameters).

Optional parameters:

Parameter Type Requirement Description
category String optional Event category
label String optional Event label
value Integer optional Event value

User clicked on mobile push

curl 'http://api.rees46.com/web_push_subscriptions/clicked' \
    -X 'POST' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    --data-raw 'shop_id=SHOP_ID&code=CODE&type=mobile_push_transactional'

// No implementation.
sdk.notificationClicked(code: "i7ykuagkjgfs", type: "mobile_push_transactional")
// Add notification identification data to the intent
intent.putExtra(REES46.NOTIFICATION_TYPE, data.get("type"));
intent.putExtra(REES46.NOTIFICATION_ID, data.get("id"));

// Add click tracking in the method of activity creation
@Override
    protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       //For tracking notification opened
       if( getIntent().getExtras() != null ) {
         REES46.notificationClicked(getIntent().getExtras());
       }
...
}
// Code and type are received in push notification structure
const params = {
  code: 'CODE',
  type: 'TYPE'
};

// Track when user clicked the notification
sdk.notificationClicked(params);

// Track when the notification is received and diplayed
sdk.notificationReceived(params);

When user clicks on mobile push notification in mobile app, you have to send event to API with code and type parameters.

This method uses separate endpoint:

Endpoint: POST https://api.rees46.com/web_push_subscriptions/clicked

Required params

All events require at least these parameters:

Parameter Type Required Description
shop_id String true Your API key
code String true Message identifier. Value can be taken from push's JSON payload. For Android it's located in id property. In iOS SDK it's src.id
type String true Message type. Value can be taken from push's JSON payload. For Android it's located in type property. In iOS SDK it's src.type

Product recommendations

Service provides access to product recommendations endpoint.

Request product recommendations

# without additional params
curl http://api.rees46.com/recommend/RECOMMENDER_CODE?shop_id=SHOP_ID&did=DEVICE_ID&seance=SEANCE_ID&segment=SEGMENT_A_or_B

# with product_id
curl http://api.rees46.com/recommend/RECOMMENDER_CODE?shop_id=SHOP_ID&did=DEVICE_ID&seance=SEANCE_ID&segment=SEGMENT_A_or_B&item_id=PRODUCT_ID

# with category_id
curl http://api.rees46.com/recommend/RECOMMENDER_CODE?shop_id=SHOP_ID&did=DEVICE_ID&seance=SEANCE_ID&segment=SEGMENT_A_or_B&category=CATEGORY_ID

# with category list
curl http://api.rees46.com/recommend/RECOMMENDER_CODE?shop_id=SHOP_ID&did=DEVICE_ID&seance=SEANCE_ID&segment=SEGMENT_A_or_B&categories=CATEGORY_ID_1,CAREGORY_ID_2,CATEGORY_ID_3

# with search query
curl http://api.rees46.com/recommend/RECOMMENDER_CODE?shop_id=SHOP_ID&did=DEVICE_ID&seance=SEANCE_ID&segment=SEGMENT_A_or_B&search_query=To%20be%20or%20not%20to%20be

# with excluded categories
curl http://api.rees46.com/recommend/RECOMMENDER_CODE?shop_id=SHOP_ID&did=DEVICE_ID&seance=SEANCE_ID&&exclude=CATEGORY_ID_1,CAREGORY_ID_2,CATEGORY_ID_3

# with a limited number of products
curl http://api.rees46.com/recommend/RECOMMENDER_CODE?shop_id=SHOP_ID&did=DEVICE_ID&seance=SEANCE_ID&segment=SEGMENT_A_or_B&limit=NUMBER_OF_PRODUCTS

# with brand list
curl http://api.rees46.com/recommend/RECOMMENDER_CODE?shop_id=SHOP_ID&did=DEVICE_ID&seance=SEANCE_ID&segment=SEGMENT_A_or_B&brands=BRAND_NAME_1,BRAND_NAME_2,BRAND_NAME_3

r46("recommend", "1fd1b3495137bc3c9299816026acf36f", {item: 100500, exclude: [3, 14, 159, 26535], category: 146, search_query: "To be or not to be", limit: 15, brands: ["Alas", "poor", "Yorick"], categories: [1, 146, 100500]}, function(response) {
  // the functionality of rendering a block of product recommendations
}, function(error) {
  // when something went wrong
});
// Basic request
sdk.recommend(blockId: "BLOCK_ID") { recommendResult in
  print("Callback")
}

// Request with additional data (for example with product ID)
sdk.recommend(blockId: "block_id", currentProductId: "PRODUCT_ID") { recommendResult in
  print("Callback")
}

// coming soon

const recommender_code = 'recommender_code';

const params = {
  item: 100500,
  exclude: [3, 14, 159, 26535],
  search_query: "To be or not to be"
 // other params
};

sdk.recommend(recommender_code, params)
  .then((res) => {
    console.log(res);
  })
  .catch((error) => {
    console.log(error);
  });

HTTP Request

GET https://api.rees46.com/recommend/{%recommender_code%}

Query Parameters

Parameter Required Description
did true Device ID. You get it from init method in SDK.
shop_id true Your API key
seance true Temporary user session ID
recommender_code true ID of product recommendations block. You get it from blocks management UI.
resize_image false Image size (px) to resize. Supported: 120, 140, 160, 180, 200, 220.
extended false Supports: 1 or empty. If 1, it will return all information about recommended products. If omit, it returns only products IDs.

JS SDK syntax

Syntax
r46("recommend", code, params, success, error);
Name Type Requirement Description
code string required Unique code of the recommendation block. See this value in the "data-recommender-code" attribute of the block created in account
params object required Object with request parameters
success function required in some cases A callback function, to which the API response will be passed. Response type: object.
error function optionally A callback function that will be called when an error occurs (any HTTP status code other than 200)

Request parameters

Name Type Requirement Description
item number/string required in some cases Product ID. This parameter is mandatory for the requests of blocks that use the algorithms "Similar" and "Also bought".
exclude array optionally Product IDs array, which should be excluded from the recommended products list.
category number/string required in some cases Category ID. This parameter is mandatory for all blocks set on category pages.
search_query string required in some cases The text of the search query. This parameter is mandatory for the requests of blocks that use the "Search" algorithm.
limit number optionally A maximum number of products in the API response.
locations array optionally Array with location IDs. If used, the API response will return products available in the listed locations. Locations must be specified in the XML product feed.
brands array optionally Array with brand names. If used, only the products of the listed brands will be returned in the API response. Brands must be specified in the XML product feed.
exclude_brands array optionally Array with brand names. If used, the API response will exclude the products of the listed brands. Brands must be specified in the XML product feed.
categories array optionally Array with category IDs. If used, the API response will only return products that are included in the listed categories.
discount boolean optionally If used with "true" value, then only those products, the value of which is less than the "oldprice" value, will be returned in the API response. The old price must be specified in the XML product feed.
extended number optionally Supports: 1 or empty. If 1, it will return all information about recommended products. If omit, it returns only products IDs.
prevent_shuffle boolean optionally If true, it disables shuffling of products in the response.
page number optionally The parameter for creating pagination, by default 1. Returns the number of products based on the limit per page.

API response

Name Type Description
html string HTML-code of the block with products. The template is customized in the REES46 personal account.
title string The block title. Corresponds to the value of the "Action" element in the block rules.
products array Array with product IDs.
id number Unique block identifier. Corresponds to the block ID in the list of blocks in the REES46 personal account.

Search

Service provides 2 types of search: instant (typeahead) and full search.

r46("suggest", {search_query: "To be or not to be"}, function(response) {
  // the functionality of rendering a block of instant search
}, function(error) {
  // when something went wrong
});
// Instant search
sdk.suggest(query: "ipho") { searchResult in
  print("Suggest callback")
}
const type = 'instant_search';
let search_query = 'your_search_text';
sdk.search({
  type: type,
  search_query: search_query,
  // other params
})
  .then((res) => {
    console.log(res);
  })
  .catch((error) => {
    console.log(error);
  });

HTTP Request

GET https://api.rees46.com/search

Query Parameters

Parameter Required Description
did true Device ID. You get it from init method in SDK.
shop_id true Your API key
seance true Temporary user session ID
type true In this case: "instant_search"
search_query true Search query
r46("search", {search_query: "To be or not to be", page: 2, limit: 15, brands: ["Alas", "poor", "Yorick"], categories: [1, 146, 100500], filters: {'key':['value'], 'key':['value']}, sort_by: "price", order: "asc"}, function(response) {
  // the functionality of rendering a block of full search
}, function(error) {
  // when something went wrong
});
// Basic full search
sdk.search(query: "iphone") { searchResult in
  print("Full search callback")
}

// Full search with additional parameters
sdk.search(query: "laptop", limit: nil, offset: nil, categoryLimit: nil, categories: nil, extended: nil, sortBy: nil, sortDir: nil, locations: nil, brands: nil, filters: nil, priceMin: nil, priceMax: nil, colors: nil, exclude: nil) { searchResult in
  print("Full search callback")
}
const type = 'full_search';
let search_query = 'your_search_text';
sdk.search({
  type,
  search_query,
  // other params
})
  .then((res) => {
    console.log(res);
  })
  .catch((error) => {
    console.log(error);
  });

HTTP Request

GET https://api.rees46.com/search

Query Parameters

Parameter Required Description
did true Device ID. You get it from init method in SDK.
shop_id true Your API key
seance true Temporary user session ID
type true In this case: "full_search"
search_query true Search query
limit false Limit of results
offset false Offset of results
category_limit false How many categories for sidebar filter to return
categories false Comma separated list of categories to filter
extended false It's better to use true for full search results
sort_by false Sort by parameter: popular, price, discount
sort_dir false Sort direction: asc or desc (default)
locations false Comma separated list of locations IDs
brands false Comma separated list of brands to filter
filters false Optional escaped JSON string with filter parameters. For example: {"bluetooth":["yes"],"offers":["15% cashback"],"weight":["1.6"]}
price_min false Min price
price_max false Max price
colors false Comma separated list of colors
exclude false Comma separated list of products IDs to exclude from search results
email false It's only for S2S integration, when service doesn't have user's session. Mobile SDK doesn't use it.
no_clarification false Disable clarified search (true, false, default: false). Don't use it. God mode only.

API response

Name Type Description
brands array Array with information about brands. Each object has the following properties:
* name – brand name (string)
* picture – brand picture (string)
categories array Array with information about categories. Each object has the following properties:
* alias – category alias (string)
* id – category id (string)
* name – category name (string)
* parent – parent category id (string)
* url – category url (string)
filters array Array with information about filters. Each object has the following properties:
* filter – fitler object. Has the following properties:
* count – total count of products whith this parameters (number)
* values – array of values (object). Has the following properties:
* value – value label. (string)
* count – cont of products whith this parameter (number)
html string HTML-code of the block with products. The template is customized in the REES46 personal account.
price_range object Min and max price of products. Has the following properties:
* min – min price (number)
* max – max price (number)
products array Array with information about products. Each object has the following properties:
* brand – product brand (string)
* currency – product currency (string, corresponds to the currency of the personal account in REES46, or a custom value specified in the shop settings in the personal account)
* id – product ID (string)
* is_new – product property (boolean, default - null)
* name – product name (string)
* old_price – product old price (string, default - 0)
* picture – product's picture URL in the REES46 storage (string)
* price – product price (number)
* price_formatted – product price with currency (string)
* url – product URL (string)
Additional properties. If a parameter "extended" is passed in the request
* barcode – product barcode (string)
* categories – product categories (array). Has the following properties:
* id – category id (string)
* name – category name (string)
* parent – parent category id (string)
* params – array with information about params. Each object has the following properties:
* key – param name (string)
* values – array of values (array)
products_total number Total count of products
search_query string Search query
book_authors array Reserved
collections array Reserved
keywords array Reserved
queries array Reserved
virtual_categories array Reserved

Search queries with zero results

This method returns a list of queries which return zero results and number of usages of this queries during previous 2 weeks.

For server-to-server integration only.

HTTP Request

GET https://api.rees46.com/search/no_result_queries

curl https://api.rees46.com/search/no_result_queries?shop_id=...&shop_secret=...
// No implementation. See CURL
// No implementation. See CURL
// No implementation. See CURL

Response example

[
  {
    "query": "iphone 4s",
    "quantity": 3844
  },
  {
    "contact_type": "covfefe",
    "quantity": 384491
  },
  ...
]

Parameters

Parameter Type Required Description
shop_id String true Your API key
shop_secret String true Secret API key

Response properties

Parameter Type Description
query String Search query value
quantity Integer Number of query usages during 2 weeks

Subscriptions

Service provides methods to manage user's subscriptions to email/SMS channels

Manage subscriptions

HTTP Request

POST https://api.rees46.com/subscriptions/manage

Change user's subscription to different channels and campaigns types


# Full example
curl -d "shop_id=SHOPID&shop_secret=SECRET&email=my@email.com&phone=+10000000000&email_bulk=true&email_chain=true&email_transactional=true&sms_bulk=true&sms_chain=true&sms_transactional=true" \
https://api.rees46.com/subscriptions/manage

# Change only specific subscriptions
curl -d "shop_id=SHOPID&shop_secret=SECRET&email=my@email.com&phone=+10000000000&email_bulk=true&email_chain=true&sms_chain=true&sms_transactional=true" \
https://api.rees46.com/subscriptions/manage

# Change without phone
curl -d "shop_id=SHOPID&shop_secret=SECRET&email=my@email.com&email_bulk=true&email_chain=true&sms_chain=true&sms_transactional=true" \
https://api.rees46.com/subscriptions/manage

# Change without email
curl -d "shop_id=SHOPID&shop_secret=SECRET&phone=+10000000000&email_bulk=true&email_chain=true&sms_chain=true&sms_transactional=true" \
https://api.rees46.com/subscriptions/manage

# Doesn't work, because there is no identifier
curl -d "shop_id=SHOPID&shop_secret=SECRET&email_bulk=true&email_chain=true&sms_chain=true&sms_transactional=true" \
https://api.rees46.com/subscriptions/manage

// Subscribe user to all kids of email campaigns and SMS
r46('subscription', 'manage', {
    email: 'my@example.com',
    phone: '+100000000000',
    email_bulk: true,
    email_chain: true,
    email_transactional: true,
    sms_bulk: true,
    sms_chain: true,
    sms_transactional: true
});

// Change only specific subscriptions
r46('subscription', 'manage', {
    email: 'my@example.com',
    phone: '+100000000000',
    email_chain: true,
    sms_bulk: true,
    sms_transactional: true
});

// Change without phone
r46('subscription', 'manage', {
    email: 'my@example.com',
    email_chain: true,
    sms_bulk: true,
    sms_transactional: true
});

// Change without email
r46('subscription', 'manage', {
    phone: '+100000000000',
    email_chain: true,
    sms_bulk: true,
    sms_transactional: true
});

// Change by `did` only
r46('subscription', 'manage', {
    email_chain: true,
    sms_bulk: true,
});
// No implementation. See CURL
// No implementation. See CURL

The method changes user's subscription to different channels (email, sms) and campaigns types (bulk, chain, transactional).

Parameter Type Required Description
shop_id String true Your API key
shop_secret String true* Secret API key. Required only for REST integration.
email String true* User's email
phone String true* User's email
did String true* Users device ID. It's handled automatically on JS SDK and don't needed in REST API
email_bulk Boolean false Subscribe user to email bulk campaigns
email_chain Boolean false Subscribe user to email drip/trigger campaigns
email_transactional Boolean false Subscribe user to email transactional campaigns
sms_bulk Boolean false Subscribe user to SMS bulk campaigns
sms_chain Boolean false Subscribe user to SMS drip/trigger campaigns
sms_transactional Boolean false Subscribe user to SMS transactional campaigns

System operations: unsubscribe, complaint, hard bounce and blacklist

This method is used to mark email with specific status.

POST https://api.rees46.com/subscriptions/callback

Email is bounced

Use this method only for hard bounces. Don't use it for soft bounce, because it purges email from database forever.

curl -d "shop_id=SHOPID&shop_secret=SECRET&email=my@email.com&event=hard_bounced" \
https://api.rees46.com/subscriptions/callback

# Response:
{"status":  "success"}
// No implementation. See CURL
// No implementation. See CURL
// No implementation. See CURL
Parameter Type Required Description
shop_id String true Your API key
shop_secret String true Secret API key. Required only for REST integration.
email String true User's email
event String true Event to process: hard_bounced

Email is complained

Use this method on FBL request (user marked email as spam):

curl -d "shop_id=SHOPID&shop_secret=SECRET&email=my@email.com&event=complained" \
https://api.rees46.com/subscriptions/callback

# Response:
{"status":  "success"}
// No implementation. See CURL
// No implementation. See CURL
// No implementation. See CURL
Parameter Type Required Description
shop_id String true Your API key
shop_secret String true Secret API key. Required only for REST integration.
email String true User's email
event String true Event to process: complained

Email is blacklisted

Use this method to add email to black list:

curl -d "shop_id=SHOPID&shop_secret=SECRET&email=my@email.com&event=blacklisted" \
https://api.rees46.com/subscriptions/callback

# Response:
{"status":  "success"}
// No implementation. See CURL
// No implementation. See CURL
// No implementation. See CURL
Parameter Type Required Description
shop_id String true Your API key
shop_secret String true Secret API key. Required only for REST integration.
email String true User's email
event String true Event to process: blacklisted

Email is unsubscribed

Use this method to unsubscribe email:

curl -d "shop_id=SHOPID&shop_secret=SECRET&email=my@email.com&event=unsubscribed" \
https://api.rees46.com/subscriptions/callback

# Response:
{"status":  "success"}
// No implementation. See CURL
// No implementation. See CURL
// No implementation. See CURL
Parameter Type Required Description
shop_id String true Your API key
shop_secret String true Secret API key. Required only for REST integration.
email String true User's email
event String true Event to process: unsubscribed

Check subscription status

curl https://api.rees46.com/subscriptions/check
// No implementation. See CURL
// No implementation. See CURL
// No implementation. See CURL

Response example

{
    "email_bulk": false,
    "email_chain": false,
    "email_transactional": false,
    "email_invalid": false,
    "email_blacklisted": false,
    "email_bounced": false,
    "email_suppressed": false,
    "web_push": false,
    "mobile_push": false,
    "sms_bulk": false,
    "sms_chain": false,
    "sms_transactional": false
}

Checks email's subscription status.

Parameter Type Required Description
shop_id String true Your API key
shop_secret String true Secret API key. Can be sent as header X-Shop-Secret.
email String true* User's email
phone String true* User's phone.

Response flags:

Property Type Description
email_bulk Boolean Email is subscribed to bulk emails
email_chain Boolean Email is subscribed to drip campaigns (triggers)
email_transactional Boolean Email is subscribed to transactional emails
email_invalid Boolean Email is invalid or disposal email
email_blacklisted Boolean Email is blacklisted (spam trap, etc)
email_bounced Boolean Email is hard bounced
email_suppressed Boolean Email is suppressed due to complaint
web_push Boolean User has web push token
mobile_push Boolean User has mobile push token
sms_bulk Boolean User has phone and subscribed to bulk SMS campaigns
sms_chain Boolean User has phone and subscribed to drip SMS campaigns (triggers)
sms_transactional Boolean User has phone and subscribed to transactional SMS campaigns

Changed subscriptions list

This method returns users with changed subscriptions statuses during defined dates range (default 24 hours).

Returns an array of users with email or/and phone, who changed subscriptions status during last 24 hours.

GET https://api.rees46.com/subscriptions/changes

curl https://api.rees46.com/subscriptions/changes?shop_id=...&shop_secret=...
// No implementation. See CURL
// No implementation. See CURL
// No implementation. See CURL

Response example

[
  {
    "contact_type": "email",
    "contact": "email1@example.com",
    "campaign_type": "chain",
    "event": "subscribe",
    "channel": "popup",
    "datetime": "2020-09-24 14:42:36",
    "ip": "192.168.0.1"
  },
  {
    "contact_type": "email",
    "contact": "email2@example.com",
    "campaign_type": "bulk",
    "event": "unsubscribe",
    "channel": "unsubscribe_page",
    "datetime": "2020-09-23 14:43:36",
    "ip": "192.168.2.27"
  },
  {
    "contact_type": "email",
    "contact": "email3@example.com",
    "campaign_type": "bulk",
    "event": "hard_bounced",
    "channel": "email_processing",
    "datetime": "2020-09-23 14:43:36",
    "ip": "192.168.2.27"
  },
  {
    "contact_type": "sms",
    "contact": "+19990009999",
    "campaign_type": "transactional",
    "event": "subscribe",
    "channel": "crm",
    "datetime": "2020-09-25 14:43:36",
    "ip": "192.168.2.27"
  },
  ...
]

Parameters

Parameter Type Required Description
shop_id String true Your API key.
shop_secret String true Secret API key. Can be sent as header X-Shop-Secret.
event String false Filter by event.
channel String false Filter by channel.
from String false Date from in YYYY-MM-DD format. Default value: 1 day ago.
to String false Date to in YYYY-MM-DD format. Default value: current date.

Response properties

Parameter Type Description
contact_type String Type of contact: sms, email, mpush, wpush
contact String Contact value
campaign_type String Type of campaigns: bulk, chain, transactional
event String Type of event: subscribe, unsubscribe, hard_bounced, complained, blacklisted
channel String Channel of event: api, js_sdk, unsubscribe_page, email_processing, etc
datetime String Date and time in YYYY-MM-DD H:i:s format
ip String IP from where request was received. Can be empty for some kinds of channel parameter.

Event descriptions:

Event Description
subscribe User is subscribed for messages (email, sms)
unsubscribe User is unsubscribed
hard_bounced User's contact is hard bounced (not existing email, phone)
complained User is complained (FBL). As result: unsubscribed and suppressed
blacklisted User is blacklisted

Channel descriptions

Event Description
email_feedback_processing Mailing feedback processing (FBL, bounce worker, automatic unsubscribe)
api Log from subscriptions/manage method
api_callback Log from subscriptions/callback method
js_sdk Event from JS SDK. Reserved
mobile_sdk Event from Mobile SDK. Reserved
push_attributes Event from event/push_attributes method. Deprecated
auto_collector Event from auto_collector service
popup Subscription from pop-up
import Subscription from audience import
crm Subscription management in CRM UI
bulk_sending Automatic bounce worker while sending bulk mailing
transactional_sending Automatic bounce worker while sending transactional mailing
unsubscribe_page User clicked on "unsubscribe" link in email sent by REES46
resubscribe_page User clicked on "re-subscribe" link on REES46's "unsubscribe" page

Triggers

Trigger subscription methods that require explicit user action.

Price drop

# No code implementation
// Subscribing
r46('subscribe_trigger', 'product_price_decrease', {email: 'John.Doe@store.com', item: '3323', price: 160});

// Unsubscribing from specific products
r46('unsubscribe_trigger', 'product_price_decrease', {email: 'John.Doe@store.com', item_ids: [3323, 100500, 'ABCDEF']});

// Unsubscribing from all products
r46('unsubscribe_trigger', 'product_price_decrease', {email: 'John.Doe@store.com', item_ids: []});
// No code implementation
// No code implementation

This feature gives the customers an option to choose if they want to receive a notification when the price of the item they want has dropped.

JS SDK syntax

Syntax
r46('subscribe_trigger', 'product_price_decrease', params);

JS SDK Parameters

Parameter Type Requirement Description
email string required Subscriber Email
item number/string required The ID of the product to which the user will be subscribed
price number/string required The current product price

JS SDK syntax

Syntax
r46('unsubscribe_trigger', 'product_price_decrease', params);

JS SDK Parameters

Parameter Type Requirement Description
email string required Subscriber Email
item_ids array required The IDs of the products from which the user will unsubscribe, or an empty array for full unsubscription

Back in Stock

# No code implementation
// Subscribing
r46('subscribe_trigger', 'product_available', {email: 'John.Doe@store.com', item: '3323'});

// Unsubscribing from specific products
r46('unsubscribe_trigger', 'product_available', {email: 'John.Doe@store.com', item_ids: [3323, 100500, 'ABCDEF']});

// Unsubscribing from all products
r46('unsubscribe_trigger', 'product_available', {email: 'John.Doe@store.com', item_ids: []});
// No code implementation
// No code implementation

This feature helps you recover sales lost due to out-of-stock items by giving your customers an option to choose if they want to receive a notification when the item they want is back in stock.

JS SDK syntax

Syntax
r46('subscribe_trigger', 'product_available', params);

JS SDK Parameters

Parameter Type Requirement Description
email string required Subscriber Email
item number/string required The ID of the product to which the user will be subscribed

JS SDK syntax

Syntax
r46('unsubscribe_trigger', 'product_available', params);

JS SDK Parameters

Parameter Type Requirement Description
email string required Subscriber Email
item_ids array required The IDs of the products from which the user will unsubscribe, or an empty array for full unsubscription

Mobile push tokens

Create new token

curl -d "did=DEVICE_ID&shop_id=SHOPID&token=TOKEN&platform=PLATFORM" https://api.rees46.com/mobile_push_tokens
sdk.setPushTokenNotification(token: "TOKEN_STRING") { (tokenResponse) in
  print("Token set response")
}
TBD
// When you request permissions to send notifications and receive push token,
// send it to API using this method:
sdk.setPushTokenNotification('NEW_TOKEN');

The above command returns JSON structured like this:

{}

This endpoint creates new token for the user, identified by did parameter.

HTTP Request

POST https://api.rees46.com/mobile_push_tokens

Query Parameters

Parameter Required Description
did true Device ID. You get it from init method in SDK.
platform true Identifies platform: ios or android
token true Unique mobile push token from iOS or Android.
shop_id true Your API key

Sending mobile push notifications

// Simple init
sdk.initPush();

//onClick listener
sdk.initPush(onClickCallback);

// onReceivetive listener
sdk.initPush(false, onReceiveCallback);

// you can use different callback for notification, when app is in background.
sdk.initPush(false, onReceiveCallback, onBackgroundReceiveCallback);

// If onBackgroundReceiveCallback not specified, used onReceiveCallback listener.

// onClickCallback params
{
  "bigPictureUrl": "MESSAGE_IMAGE",
  "channelId": "personaclick-push",
  "data": {
    "id": "MESSAGE_ID",
    "type": "MESSAGE_TYPE"
  },
  "foreground": true,
  "id": "MESSAGE_ID",
  "largeIconUrl": "MESSAGE_ICON",
  "message": "MESSAGE_BODY",
  "title": "MESSAGE_TITLE",
  "userInteraction": true
}
// onReceiveCallBack, onBackgroundReceiveCallback params
{
  "data": {
    "action_urls": "[]",
    "actions": "[]",
    "body": "MESSAGE_BODY",
    "icon": "MESSAGE_ICON",
    "id": "MESSAGE_ID",
    "image": "MESSAGE_IMAGE",
    "title": "MESSAGE_TITLE",
    "type": "MESSAGE_TYPE"
  },
  "from": "MESSAGE_FROM",
  "messageId": "FMC_MESSAGE_ID",
  "sentTime": TIMESTAMP,
  "ttl": TTL_VALUE
}

Default payload structure

For iOS

{
  "aps": {
    "alert": {
      "title": "...",
      "subtitle": "...",
      "body": "...",
      "badge": 1
    },
    "mutable-content": 1
  },
  "image_url": "...",
  "event": {
    "type": "...",
    "uri": "..."
  },
  "src": {
    "type": "...",
    "id": "..."
  }
}

For Android

{
  "title": "...",
  "body": "...",
  "icon": "...",
  "type": "...",
  "id": "...",
  "url": "...",
  "actions": "[{\"action\": "\b0\", \"title\": \"...\"}, ...]",
  "action_urls": "[...]",
  "image": "...",
  "event": "{\"type\": \"...\", \"uri\": \"...\"}"
}
Parameter Required Description
aps.alert.title true The title of the notification. Apple Watch displays this string in the short look notification interface. Specify a string that is quickly understood by the user.
aps.alert.subtitle true Additional information that explains the purpose of the notification.
aps.alert.body true The content of the alert message.
aps.alert.badge true The number to display in a badge on your app’s icon. Specify 0 to remove the current badge, if any.
aps.mutable-content true Always 1 for iOS.
image_url false Link to image/icon.
event false Optional object with additional data.
event.type true Type of the notification: web, category, product, custom.
event.uri true Resource identificator depending on the type of event. See examples below.
src true Information about a campaign (source of the message).
src.type true Type of a campaign: bulk, chain, transactional.
src.id true Type of a campaign. String.

Basic message

For iOS

{
  "aps": {
    "alert": {
      "title": "Welcome aboard!",
      "subtitle": "Greeting message.",
      "body": "Hey, it's nice to know you're with us now. Check new updates in our application.",
      "badge": 1
    },
    "mutable-content": 1
  },
  "image_url": "...",
  "src": {
    "type": "bulk",
    "id": "33631"
  }
}

For Android

{
  "title": "Welcome aboard!",
  "body": "Hey, it's nice to know you're with us now. Check new updates in our application.",
  "type": "bulk",
  "id": "33631"
}

This kind of message can be used to attract attention and open home screen of the application.

For iOS

{
  "aps": {
    "alert": {
      "title": "Only today",
      "subtitle": "Special Offer",
      "body": "This special offer for Dyson products only for you!",
      "badge": 1
    },
    "mutable-content": 1
  },
  "image_url": "...",
  "event": {
    "type": "web",
    "uri": "https://example.com/landing/promo"
  },
  "src": {
    "type": "bulk",
    "id": "XFMjM4VAF4"
  }
}

For Android

{
  "title": "Only today",
  "body": "This special offer for Dyson products only for you!",
  "type": "bulk",
  "id": "XFMjM4VAF4",
  "actions": "[{\"action\": "\b0\", \"title\": \"...\"}, ...]",
  "event": "{\"type\": \"web\", \"uri\": \"https://example.com/landing/promo\"}"
}

Usually used for promo campaigns when final action is to open some URL in web view.

Open category

For iOS

{
  "aps": {
    "alert": {
      "title": "Black Friday!",
      "subtitle": "Discount",
      "body": "Check our big sale from this category",
      "badge": 1
    },
    "mutable-content": 1
  },
  "image_url": "...",
  "event": {
    "type": "category",
    "uri": "BFRIDAY_CATEGORY_ID"
  },
  "src": {
    "type": "chain",
    "id": "72CONd54uF"
  }
}

For Android

{
  "title": "Black Friday!",
  "body": "Check our big sale from this category",
  "type": "chain",
  "id": "72CONd54uF",
  "event": "{\"type\": \"category\", \"uri\": \"BFRIDAY_CATEGORY_ID\"}"
}

Suitable to open specific category by it's ID. For example for bulk messages about discounts.

Open product

For iOS

{
  "aps": {
    "alert": {
      "title": "...",
      "subtitle": "...",
      "body": "...",
      "badge": 1
    },
    "mutable-content": 1
  },
  "image_url": "...",
  "event": {
    "type": "product",
    "uri": "PRODUCT123"
  },
  "src": {
    "type": "chain",
    "id": "ugLxQ7KrnL"
  }
}

For Android

{
  "title": "...",
  "body": "...",
  "type": "chain",
  "id": "ugLxQ7KrnL",
  "event": "{\"type\": \"product\", \"uri\": \"PRODUCT123\"}"
}

Suitable to open specific product by it's ID. For example for triggered messages.

Open custom page

For iOS

{
  "aps": {
    "alert": {
      "title": "...",
      "subtitle": "...",
      "body": "...",
      "badge": 1
    },
    "mutable-content": 1
  },
  "image_url": "...",
  "event": {
    "type": "custom",
    "uri": "order/status/36",
    "payload": {}
  },
  "src": {
    "type": "transactional",
    "id": "order_delivered"
  }
}

For Android

{
  "title": "...",
  "body": "...",
  "type": "transactional",
  "id": "order_delivered",
  "event": "{\"type\": \"custom\", \"uri\": \"order/status/36\", \"payload\": {}}"
}

Can be used to open any resource by custom data. For example for transactional messages to show order status.

User's profile

Endpoints is used to work with user's profile.

Save profile settings

curl -d "shop_id=SHOPID&shop_secret=SHOP_SECRET&email=EMAIL&fieldname=FIELDVALUE" https://api.rees46.com/profile/set
r46('profile', 'set', {
    "first_name": "Jane",
    "last_name": "Smith",
    "kids": [
        {"gender": "m", "birthday": "2017-06-04"},
        {"gender": "f", "birthday": "2014-02-10"},
        {"gender": "m", "birthday": "2014-03-17"}
    ]
});
  sdk.setProfileData(userEmail: 'email@example.com',
    userPhone: '10000000000',
    userLoyaltyId: 'L010101',
    birthday: ...,
    age: ...,
    firstName: ...,
    lastName: ...,
    location: ...,
    gender: ...) { (profileDataResp) in
      print("Profile data callback")
    }
  // TBD
const params = {
  id: 100500,
  email: "john.doe@examplemail.com",
  phone: "4400114527199",
  first_name: "John",
  last_name: "Doe",
  birthday: "1990-03-11",
  age: 31,
  gender: "m",
  location: "NY",
  bought_something: true,
  loyalty_id: "000001234567",
  loyalty_card_location: "NY",
  loyalty_status: "5% discount",
  loyalty_bonuses: 1123,
  loyalty_bonuses_to_next_level: 1877,
  fb_id: "000000000354677",
  vk_id: "vk031845",
  telegram_id: "0125762968357835",
  kids: [
    {gender: "m", birthday: "2001-04-12"},
    {gender: "f", birthday: "2015-07-28"}
  ],
  auto: [
    {brand: "Nissan", model: "Qashqai", vds: "TM7N243E4G0BJG978"}
  ]
};

sdk.setProfile(params);

This method overrides profile's settings.

Query Parameters

Parameter Type Required Description
shop_id String true Your API key
shop_secret String true Your API secret key
did* String true Device ID
email* String true User's email
phone* String true User's phone number

Default properties

You can update any standard profile property. All standard properties are listed here:

Parameter Type Description
loyalty_id String User's loyalty program ID
id String User ID in your platform
fb_id String User's Facebook ID
vk_id String User's VK ID
telegram_id String User's Telegram ID
loyalty_card_location String Location ID where user's loyalty card was issued
loyalty_status String User's loyalty program status
loyalty_bonuses Integer User's bonuses amount
loyalty_bonuses_to_next_level Integer User's bonuses amount left for the next level
gender String User's gender: m or f
location String User's location code
first_name String User's first name
last_name String User's last name
age Integer User's age in years
birthday Date User's birthday in SQL format: YYYY-MM-DD
bought_something Bool User bought something ever
kids Array List of kids (see below)
auto Array List of auto vehicles (see below)

Kid object properties:

Parameter Type Description
gender String Kid's gender: m or f
birthday Date Kid's birthday in SQL format: YYYY-MM-DD

Auto object properties:

Parameter Type Description
brand String Vehicle brand
model String Vehicle model
vds String Vehicle VDS/VIN number

Custom properties

Additionally you can update any custom property, you've created in CRM.

Read profile info

# Using email as user identifier
curl https://api.rees46.com/profile?email=...&shop_id=...&shop_secret=...

# Using phone as user identifier
curl https://api.rees46.com/profile?phone=...&shop_id=...&shop_secret=...
r46('profile', 'get', function(profile) {
    // Here you can use all properties of profile's object
    console.log(profile.gender);
    console.log(profile.fashion.sizes.shoe);
});

REST method returns this JSON structure

{
  "first_name": "...",
  "last_name": "...",
  "email": "...",
  "phone": "...",
  "fb_id": "...",
  "vk_id": "...",
  "telegram_id": "...",
  "loyalty_id": "...",
  "loyalty_card_location": "...",
  "loyalty_status": "...",
  "loyalty_bonuses": "...",
  "loyalty_bonuses_to_next_level": "...",
  "gender": "...",
  "location": "...",
  "age": "...",
  "birthday": "...",
  "bought_something": "...",
  "tags": [
    "...",
    "..."
  ],
  "custom_properties": {
    "prop_key_1": "prop_value",
    "prop_key_2": "prop_value"
  },
  "additional_phones": [],
  "additional_emails": [],
  "additional_loyalty_ids": [],
  "orders": [
    {
      "id": "...",
      "value": "...",
      "status": "...",
      "items": [
        {
          "id": "...",
          "price": "...",
          "name": "...",
          "quantity": "..."
        },
        {
          "id": "...",
          "price": "...",
          "name": "...",
          "quantity": "..."
        }
      ]
    }
  ]
}

JS SDK method returns simplified anonymous structure to prevent data stealing

{
  "fashion_sizes": ["..."],

  "gender": "m or f",

  "cosmetic_hair": ["..."],
  "allergy": "bool",
  "cosmetic_skin": ["..."],
  "cosmetic_perfume": ["..."],

  "compatibility": null,
  "vds": null,

  "jewelry": null,

  "realty": ["..."],

  "children": ["..."],
  "child_gender": "m or f",

  "pets": ["..."],

  "income_level": "cheap"
}

You can read profile info from CRM using API or SDK.

In case of using REST API (when using email or phone number as user ID), you must provide secret key to the method.

Force change email

curl -d "shop_id=SHOPID&shop_secret=SHOP_SECRET&new_email=NEW_EMAIL&old_email=OLD_EMAIL" https://api.rees46.com/profile/force_change_email
// Not supported
// Not supported
// Not supported
// Not supported

Force change email of user with old_email to new_email. If a user with new_email exists, removes email from that user.

If user with old_email is not found, returns 404.

It's S2S method.

Query Parameters

Parameter Type Required Description
shop_id String true Your API key
shop_secret String true Your API secret key
new_email String true New user's email
old_email String true Current user's email
i_understand_what_i_am_doing String true Must present with any true value (true, "true", 1, yes, believe me I know what I am doing, etc).

Audience

This section allows to manage users, their subscriptions and segments.

Import users

curl -i -X POST -H "Content-Type: application/json" --data-binary "@data.json" https://api.rees46.com/import/audience

# data.json
{
  "shop_id": "1234567890",
  "shop_secret": "0987654321",
  "segment_id": "123",
  "audience": [
    {
      "email": "test@example.com",
      "loyalty_id": "123454321",
      "phone": "19991005000",
      "id": "998877",
      "fb_id": "",
      "vk_id": "",
      "telegram_id": "",
      "loyalty_card_location": "",
      "loyalty_status": "VIP",
      "loyalty_bonuses": 3000,
      "loyalty_bonuses_to_next_level": 70000,
      "gender": "",
      "location": "",
      "first_name": "Jane",
      "last_name": "Smith",
      "age": "",
      "birthday": "",
      "bought_something": true,
      "email_bulk": true,
      "email_chain": true,
      "email_transactional": true,
      "sms_bulk": true,
      "sms_chain": true,
      "sms_transactional": true,
      "auto": [
        {
          "brand": "Mini",
          "model": "Countryman",
          "vds": "1234567"
        },
        {
          "brand": "Toyota",
          "model": "Corolla",
          "vds": "987655431"
        }
      ],
      "kids": [
        {
          "birthday": "2014-06-03",
          "gender": "f"
          },
        {
          "birthday": "2017-04-01",
          "gender": "m"
        }
      ],

    },
    {...},
    {...},
  ]
}
// No implementation is needed in JS SDK
// No implementation is needed in iOS SDK
// No implementation is needed in Android SDK

Upload audience to database. You can upload users to the default segment or put it in the specific segment. At the same time you can subscribe or unsubscribe users from any kind of email campaigns.

Query Parameters

Parameter Type Required Description
shop_id String true Your API key
shop_secret String true Your API secret key
segment_id Integer false Segment ID
audience Array true Array of user data objects (see below)

Audience element properties

You can update any standard profile property. All standard properties are listed here:

Parameter Type Description
email* String User's email
phone* String User's phone number
loyalty_id String User's loyalty program ID
id String User ID in your platform
fb_id String User's Facebook ID
vk_id String User's VK ID
telegram_id String User's Telegram ID
loyalty_card_location String Location ID where user's loyalty card was issued
loyalty_status String User's loyalty program status
loyalty_bonuses Integer User's bonuses amount
loyalty_bonuses_to_next_level Integer User's bonuses amount left for the next level
gender String User's gender: m or f
location String User's location code
first_name String User's first name
last_name String User's last name
age Integer User's age in years
birthday Date User's birthday in SQL format: YYYY-MM-DD
bought_something Bool User bought something ever
kids Array List of kids (see below)
auto Array List of auto vehicles (see below)
email_bulk Boolean Subscribe user to email bulk campaigns
email_chain Boolean Subscribe user to email drip/trigger campaigns
email_transactional Boolean Subscribe user to email transactional campaigns
sms_bulk Boolean Subscribe user to SMS bulk campaigns
sms_chain Boolean Subscribe user to SMS drip/trigger campaigns
sms_transactional Boolean Subscribe user to SMS transactional campaigns

Kid object properties:

Parameter Type Description
gender String Kid's gender: m or f
birthday Date Kid's birthday in SQL format: YYYY-MM-DD

Auto object properties:

Parameter Type Description
brand String Vehicle brand
model String Vehicle model
vds String Vehicle VDS/VIN number

Custom properties

Additionally you can update any custom property, you've created in CRM.

Import suppressed emails

curl -i -X POST -H "Content-Type: application/json" --data-binary "@data.json" https://api.rees46.com/import/suppressed

# data.json
{
  "shop_id": "1234567890",
  "shop_secret": "0987654321",
  "audience": [
    { "email": "test@example.com" },
    { "email": "test2@example.com" },
  ]
}
// No implementation is needed in JS SDK
// No implementation is needed in iOS SDK
// No implementation is needed in Android SDK

Upload suppressed emails to database. All emails from this list will be unsubscribed from emails and marked as suppressed.

Query Parameters

Parameter Type Required Description
shop_id String true Your API key
shop_secret String true Your API secret key
audience Array true Array of user data objects (see below)

Audience element properties

Parameter Type Description
email String User's email

CRM

This section collects CRM-related methods.

Bulk search by attribute

curl -i -X POST -H "Content-Type: application/json" --data-binary "@data.json" https://api.rees46.com/crm/search/bulk

# data.json
{
  "shop_id": "1234567890",
  "shop_secret": "0987654321",
  "by": "loyalty_id",
  "ids": ["L01", "L02"]
}
// No implementation is needed in JS SDK
// No implementation is needed in iOS SDK
// No implementation is needed in Android SDK

Response structure

[
  {
    "email": "email@example.com",
    "external_id": "1",
    "phone": "11111111111",
    "first_name": null,
    "last_name": null,
    "gender": null,
    "age": null,
    "birthday": null,
    "location": null,
    "email_bulk": true,
    "email_chain": true,
    "email_transactional": true,
    "web_push": true,
    "mobile_push": null,
    "sms_bulk": null,
    "sms_chain": null,
    "sms_transactional": null,
    "loyalty_id": "L01",
    "loyalty_location": null,
    "loyalty_status": null,
    "loyalty_bonuses": 300,
    "loyalty_bonuses_to_next_level": null,
    "created_date": null,
    "device": null
  },
  {
    "email": "email2@example.com",
    "external_id": "1",
    "phone": null,
    "first_name": "Thomas",
    "last_name": "Anderson",
    "gender": "m",
    "age": null,
    "birthday": "1971-09-11",
    "location": null,
    "email_bulk": true,
    "email_chain": true,
    "email_transactional": true,
    "web_push": true,
    "mobile_push": null,
    "sms_bulk": null,
    "sms_chain": null,
    "sms_transactional": null,
    "loyalty_id": "L02",
    "loyalty_location": null,
    "loyalty_status": null,
    "loyalty_bonuses": 0,
    "loyalty_bonuses_to_next_level": null,
    "created_date": null,
    "device": null

  }
]

Methods tries to find a collection of users by list of identifiers. Identifiers can be: email, phone, loyalty_id.

Query Parameters

Parameter Type Required Description
shop_id String true Your API key
shop_secret String true Your API secret key
by String true Type of identifier. See below.
ids Array true Array of identifiers

Supported identifiers

Identifier Description Restrictions
loyalty_id Loyalty ID No restrictions
birthday Birthday Format: YYYY-MM-DD. Processing only 5 valid dates. Other dates are skipped

Segments

The endpoint is used to put or remove user to/from static segment.

Add user to a segment

# Using all possible identifiers
curl -d "shop_id=SHOPID&shop_secret=SHOP_SECRET&email=EMAIL&phone=PHONE&segment_id=SEGMENT_ID" https://api.rees46.com/segments/add

# With phone only
curl -d "shop_id=SHOPID&shop_secret=SHOP_SECRET&phone=PHONE&segment_id=SEGMENT_ID" https://api.rees46.com/segments/add

# With email only
curl -d "shop_id=SHOPID&shop_secret=SHOP_SECRET&email=EMAIL&segment_id=SEGMENT_ID" https://api.rees46.com/segments/add

// Using all possible identifiers
r46('segment', 'add', {
    "email": "jane@example.com",
    "phone": "+10000000000",
    "segment_id": "SEGMENT_ID"
});

// With phone only
r46('segment', 'add', {
    "phone": "+10000000000",
    "segment_id": "SEGMENT_ID"
});

// With email only
r46('segment', 'add', {
    "email": "jane@example.com",
    "segment_id": "SEGMENT_ID"
});

// Without any contacts: `did` is used automatically
r46('segment', 'add', {
    "segment_id": "SEGMENT_ID"
});
// Not implemented yet
// Not implemented yet

This method adds user to a specific static segment.

POST https://api.rees46.com/segments/add

Query Parameters

Parameter Type Required Description
shop_id String true Your API key
shop_secret String true Your API secret key
did* String User's device ID. Only for JS/iOS/Android SDK
email* String User's email
phone* String User's phone number
segment_id String Segment ID

Remove user from a segment

# Using all possible identifiers
curl -d "shop_id=SHOPID&shop_secret=SHOP_SECRET&email=EMAIL&phone=PHONE&segment_id=SEGMENT_ID" https://api.rees46.com/segments/remove

# With phone only
curl -d "shop_id=SHOPID&shop_secret=SHOP_SECRET&phone=PHONE&segment_id=SEGMENT_ID" https://api.rees46.com/segments/remove

# With email only
curl -d "shop_id=SHOPID&shop_secret=SHOP_SECRET&email=EMAIL&segment_id=SEGMENT_ID" https://api.rees46.com/segments/remove

// Using all possible identifiers
r46('segment', 'remove', {
    "email": "jane@example.com",
    "phone": "+10000000000",
    "segment_id": "SEGMENT_ID"
});

// With phone only
r46('segment', 'remove', {
    "phone": "+10000000000",
    "segment_id": "SEGMENT_ID"
});

// With email only
r46('segment', 'remove', {
    "email": "jane@example.com",
    "segment_id": "SEGMENT_ID"
});

// Without any contacts: `did` is used automatically
r46('segment', 'remove', {
    "segment_id": "SEGMENT_ID"
});
// Not implemented yet
// Not implemented yet

This method removes user from a specific static segment.

POST https://api.rees46.com/segments/remove

Query Parameters

Parameter Type Required Description
shop_id String true Your API key
shop_secret String true Your API secret key
did* String User's device ID. Only for JS/iOS/Android SDK
email* String User's email
phone* String User's phone number
segment_id String Segment ID

Get user segments

# Using all possible identifiers
curl "shop_id=SHOPID&shop_secret=SHOP_SECRET&email=EMAIL&phone=PHONE" https://api.rees46.com/segments/get

# With phone only
curl "shop_id=SHOPID&shop_secret=SHOP_SECRET&phone=PHONE" https://api.rees46.com/segments/get

# With email only
curl "shop_id=SHOPID&shop_secret=SHOP_SECRET&email=EMAIL" https://api.rees46.com/segments/get

// Using all possible identifiers
r46('segment', 'get', function(segments) {
    // segments (type: array of objects)
    // each object has the following properties:
    // "id" as Segment ID
    // "type" as Segment Type ("dynamic", "static")
});
// Not implemented yet
// Not implemented yet

Response structure

[
  {
    "id": 313,
    "type": "static"
  },
  {
    "id": 314,
    "type": "dynamic"
  }
]

The method returns an array of segments of the current user.

GET https://api.rees46.com/segments/get

Query Parameters

Parameter Type Required Description
shop_id String true Your API key
shop_secret String true Your API secret key
did* String User's device ID. Only for JS/iOS/Android SDK
email* String User's email
phone* String User's phone number

Orders

This section describes how to import orders, change its' statuses, structure and other.

Import orders

curl -i -X POST -H "Content-Type: application/json" --data-binary "@data.json" https://api.rees46.com/sync/orders

# data.json
{
  "shop_id": "DvLWN2ZTMZ",
  "shop_secret": "EIxTuot8sj",
  "orders": [
    {
      "id": "yKsvZbWpCL",
      "status": "Delivered",
      "channel": "website",
      "date": 1602338740,
      "offline": false,
      "email": "user@example.com",
      "phone": "+15554443322",
      "loyalty_id": "000-33-444-111",
      "location_id": "7701123",
      "promocode": "vxawxSi9Uy",
      "delivery_type": "courier",
      "delivery_address": "Rouse st, 13",
      "delivery_date": "2021-12-21",
      "delivery_time": "15:00",
      "value": {
        "total": 200.13,
        "cash": 190,
        "bonuses": 15,
        "delivery": 20,
        "discount": 24.87
      },
      "items": [
        {
          "id": "ITEM-ID-1",
          "price": 205,
          "quantity": 1
        },
        ...
      ]
    },
    ...
  ]
}

If a request contains orders with IDs which are already saved in our database, statuses and structure of this orders will be updated.

Query Parameters

Parameter Type Required Description
shop_id String true Your API key
shop_secret String true Your API secret key
orders Array true List of orders. See description below.

Description of orders objects:

Parameter Type Required Description
id String true Order ID
status String true Order's status
channel String true Channel where order was updated
date Integer true Date and time when order status changed
offline Boolean false Flags orders as offline. Default false.
email String false User's email
phone String false User's phone
loyalty_id String false User's loyalty ID
location_id String false User's location (city) ID
promocode String false Promo code used in the order
delivery_type String false Delivery type
delivery_address String false Destination address for CRM
delivery_date Date false Planned delivery date. Format: "YYYY-MM-DD"
delivery_time Time false Planned delivery time. Format: "HH:MM"
payment_type String false Payment type. Can by any string value. Ex: cash, card, wire.
value Object true Describes order's value parts. See below.
items* Array true Describes order's products. See below.

Description of value object:

Parameter Type Required Description
total Numeric true Order's total value
cash Numeric false Describes how much of order's value was paid by real money.
bonuses Numeric false Describes how much of order's value was paid by bonuses.
delivery Numeric false Describes price of order's delivery
discount Numeric false Describes discount value of the order.

Description of items objects:

Parameter Type Required Description
id String true ID of purchased product
price Numeric true Price of 1 unit of purchased product
quantity Integer true Quantity of mentioned products in the order.

Get users last order products

curl https://api.rees46.com/orders/last_for_user?shop_id=SHOP_ID&did=DID&seance=SEANCE_ID

If a request fetches user's last purchase and returns list of purchased products. If there was not purchases, empty array is returned.

Query Parameters

Parameter Type Required Description
shop_id String true Your API key
did String true Users device ID
seance String true Users session ID

Promo codes

Service provides endpoints for promo codes management.

List of promo codes lists

curl https://api.rees46.com/promo_codes?shop_id=SHOPID&shop_secret=SHOP_SECRET

The above command returns JSON structured like this:

[
  {
    "id": 3184,
    "name": "Abandoned cart trigger discount codes",
    "available": 3744
  }
]

This method returns list of existing promo codes lists with count of available promo codes in each list.

HTTP Request

GET https://api.rees46.com/promo_codes

Query Parameters

Parameter Required Description
shop_id true Your API key
shop_secret true Your API secret key

Errors

When promo secret key is wrong, method returns 403 error.

Upload promo codes

Headers

Content-type: application/json

Body example

{
    "shop_id": "...",
    "shop_secret": "...",
    "id": "...",
    "codes": [ "code1", "code2", "code3" ]
}

Request example

curl --header "Content-Type: application/json" \
  --request POST \
  --data-binary "@data.json" \
  https://api.rees46.com/promo_codes

Method uploads list of unique promo codes to the selected list. All non-unique promo codes will be excluded.

HTTP Request

POST https://api.rees46.com/promo_codes

Content-Type: application/json

Query Parameters

Parameter Required Description
shop_id true Your API key
shop_secret true Your API secret key
id true Promo codes list ID
codes true List of promo codes

Errors

When promo codes list is empty, method returns 404 error.

Fetch promo code

curl https://api.rees46.com/promo_codes/fetch?did=DEVICE_ID&shop_id=SHOPID&id=PROMOCODE_LIST_ID
r46("get_promo_code", {id: PROMOCODE_LIST_ID}, success_callback, error_callback);

The above command returns JSON structured like this:

{"code":  "UNIQUE_CODE"}

Method provides service for unique promo codes fetching.

Note: unique promo codes are limited. Store fetched promo code during user's session.

HTTP Request

GET https://api.rees46.com/promo_codes/fetch

Query Parameters

Parameter Required Description
did true Device ID. You get it from init method in SDK.
shop_id true Your API key
id true Promo codes list ID
seance false Temporary user session ID

Errors

When promo codes list is empty, method returns 404 error.

Bonuses

Service provides endpoints for bonuses management.

Import bonuses status

Headers

Method: POST
Content-type: application/json

Body example

{
  "shop_id":"...",
  "shop_secret":"...",
  "bonuses": [
    {
      "email": "...",
      "phone": "...",
      "loyalty_id": "...",
      "current_status": "...",
      "total_balance": ...,
      "total_used": ...,
      "total_burned": ...,
      "total_cancelled": ...,
      "total_inactive": ...,
      "total_rewarded": ...,
      "event": "...",
      "order_id": "...",
      "bonus_status": "...",
      "amount_changed": "...",
      "activated_at": "...",
      "expiration": "...",
      "activity": "...",
      "balance": ...
    }, ...
  ]
}

Request example

curl --header "Content-Type: application/json" \
  --request POST \
  --data-binary "@data.json" \
  https://api.rees46.com/import/bonuses

Method uploads current bonuses status.

HTTP Request

POST https://api.rees46.com/import/bonuses

Content-Type: application/json

Query Parameters

Parameter Required Description
shop_id true Your API key
shop_secret true Your API secret key
email* true Promo codes list ID
phone* true List of promo codes
loyalty_id* true List of promo codes

Properties

Parameter Type Description
current_status String Current status
total_balance Float Total balance
total_used Float Total used
total_burned Float Total burned out
total_cancelled Float Total cancelled
total_inactive Float Total inactive
total_rewarded Float Total rewarded
purchase_date Date Date in format YYYY-MM-DD HH:MM:SS
event String Status change event
order_id String Order ID
bonus_status String Status of bonuses
amount_changed String Amount of bonus changes
activated_at Date Date in format YYYY-MM-DD HH:MM:SS
expiration Date Date in format YYYY-MM-DD HH:MM:SS
activity String The action that changed the balance
balance Float Current bonuses balance

Errors

Net Promoter Score

Endpoints is used to work with NPS service.

Glossary:

NPS categories

This endpoints returns a list of active categories. Categories list can be customized on NPS settings page in backoffice.

Note: if you provide any of user identifiers (see query params table), questions and "thank you" messages can be personalized.

curl https://api.rees46.com/nps/categories?shop_id=SHOPID
r46('nps', 'categories', success, failure);
// Not described yet
// Not described yet

The above command returns JSON structured like this:

[
  {
    "id": 1,
    "code": "website",
    "name": "Online checkout quality",
    "promoter_question": "Which features do you value/use the most?",
    "passive_question": "How can we improve your experience?",
    "detractor_question": "What was missing or disappointing in your experience with us?",
    "promoter_success": "Thanks for your feedback, Mr. John Smith. It’s great to hear that you’re a fan of our product. Your feedback helps us discover new opportunities to improve and make sure you have the best possible experience.",
    "passive_success": "Thanks for your feedback. Our goal is to create the best possible product, and your thoughts, ideas, and suggestions play a major role in helping us identify opportunities to improve.",
    "detractor_success": "Thanks for your feedback. We highly value all ideas and suggestions from our customers, whether they’re positive or critical. In the future, our team might reach out to you to learn more about how we can further improve our services so that it exceeds your expectations."
  },
  {
    "id": 3,
    "code": "delivery",
    "name": "Delivery quality survey",
    "promoter_question": "Which features do you value/use the most?",
    "passive_question": "How can we improve your experience?",
    "detractor_question": "What was missing or disappointing in your experience with us?",
    "promoter_success": "Thanks for your feedback, Mr. John Smith. It’s great to hear that you’re a fan of our product. Your feedback helps us discover new opportunities to improve and make sure you have the best possible experience.",
    "passive_success": "Thanks for your feedback. Our goal is to create the best possible product, and your thoughts, ideas, and suggestions play a major role in helping us identify opportunities to improve.",
    "detractor_success": "Thanks for your feedback. We highly value all ideas and suggestions from our customers, whether they’re positive or critical. In the future, our team might reach out to you to learn more about how we can further improve our services so that it exceeds your expectations."
  }
]

HTTP Request

GET https://api.rees46.com/nps/categories

Query Parameters

Parameter Type Required Description
shop_id String true Your API key. JS SDK handles it automatically.

NPS channels

Get list of available channels, from which NPS review can be created. Channels list can be customized on NPS settings page in backoffice.

curl https://api.rees46.com/nps/channels?shop_id=SHOPID
r46('nps', 'channels', success, failure);
// Not described yet
// Not described yet

The above command returns JSON structured like this:

[
  {
    "id": 1,
    "code": "website",
    "name": "Online checkout quality"
  },
  {
    "id": 2,
    "code": "ios_app",
    "name": "iOS mobile app"
  },
  {
    "id": 3,
    "code": "ios_app",
    "name": "iOS mobile app"
  },
  {
    "id": 4,
    "code": "pos",
    "name": "POS terminal"
  }
]

HTTP Request

GET https://api.rees46.com/nps/channels

Query Parameters

Parameter Type Required Description
shop_id String true Your API key. JS SDK handles it automatically.

NPS reviews

Get list of published NPS reviews. Limited to 1000 reviews per request.

curl https://api.rees46.com/nps/reviews?shop_id=SHOPID&shop_secret=SECRET
// Not needed. See cURL.
// Not needed. See cURL.
// Not needed. See cURL.

The above command returns JSON structured like this:

[
  {
    "id": 1,
    "channel": "email",
    "category": "delivery",
    "rate": 7,
    "comment": "Lorem ipsum",
    "client_id": 1515915625535836508
  },
  {
    "id": 2,
    "channel": "popup",
    "category": "checkout",
    "rate": 9,
    "comment": null,
    "client_id": 1515915625535836508
  }
]

HTTP Request

GET https://api.rees46.com/nps/reviews

Query Parameters

Parameter Type Required Description
shop_id String true Your API key.
shop_secret String true Your API secret key.
date_from String false Filter by date: start date.
date_to String false Filter by date: end date.
channel String false Channel code.
category String false Category code.

Save review

// Not allowed
// Full form
r46("nps", "review", {
    channel: "channel_code",
    category: "category_code",
    rate: 7,
    comment: "Some comment"
}, success, failure);

// Without comment
r46("nps", "review", {
    channel: "channel_code",
    category: "category_code",
    rate: 10
}, success, failure);
// Basic usage
sdk.review(rate: 3, channel: "ios_app", category: "checkout") { _ in
  print("Review is posted")
}

// Rate order
sdk.review(rate: 6, channel: "ios_app", category: "checkout", order_id: "ORDER-3341") { _ in
  print("Review is posted")
}

// With comment
sdk.review(rate: 9, channel: "ios_app", category: "checkout", comment: "Nice application, thank you!") { _ in
  print("Review is posted")
}

// With comment and order_id
sdk.review(rate: 10, channel: "ios_app", category: "checkout", order_id: "ORDER-3341", comment: "Nice application, thank you!") { _ in
  print("Review is posted")
}
// Not described yet

Create an NPS review for the specific survey and user. To identify user you can use one of the listed identifiers:

If there is existing review from the same user, channel, category and date, it will be updated instead of creating new one.

HTTP Request

POST https://api.rees46.com/nps/create

Query Parameters

Response on success:

    {
        "status": "success"
    }

Response on failure:

    {
        "status": "error",
        "payload": {
          "message": "error message"
        }
    }

One of the listed user identifiers is required: did, email, phone, order_id.

Parameter Type Required Description
shop_id String true Your API key
shop_secret String true Your secret API key
did String false Device ID of the user. SDK handles it automatically.
seance true Temporary user session ID. Required when sending NPS with did identifier.
email String false User's email
phone String false User's phone
loyalty_id String false User's loyalty ID
order_id String false Order ID, related to the current survey
channel String true NPS channel code
category String true NPS process category code
rate Integer true Score of the rated process: 1..10
comment String false Optional answer to the follow-up question

SMS messaging

Section describes how to send SMS messages

Transactional SMS

curl -i -X POST -H "Content-Type: application/json" --data-binary "@data.json" https://api.rees46.com/sms/transactional

# data.json
{
  "shop_id": "DvLWN2ZTMZ",
  "shop_secret": "EIxTuot8sj",
  "code": "...",
  "phone": "...",
  "variables": {
    "url": "https://mydomain.com/page/1",
    "variable_1": "value_1",
    "variable_2": "value_2",
    ...
  }
}
// REST API only. See cURL.
// REST API only. See cURL.
// REST API only. See cURL.

Requirements

Endpoint: GET https://api.rees46.com/sms/transactional

Content type: application/json

Data format: JSON body.

Query Parameters

Parameter Type Required Description
shop_id String true Your API key
shop_secret String true Your API secret key
code String true Campaign unique identifier
phone String true User's phone number
variables Object true Object of key-pair variables for template parser. See example.

Multi-messaging

Method of multi-channel notifications, when the platform automatically chooses the cheapest and more efficient way to deliver transactional message to a recipient.

Supported channels:

Initial tasks

Before sending campaign you have to setup it:

  1. Prepare transactional email template
  2. Prepare transactional web/mobile push template
  3. Prepare transactional SMS template
  4. Create multi-channel campaign and select created templates for every channel you want to use in the campaign.
  5. Done.

In templates you can use variables and operators to customize final content. Template engine - Liquid.

Sending message

curl -i -X POST -H "Content-Type: application/json" --data-binary "@data.json" https://api.rees46.com/multi/transactional

# data.json
{
  "shop_id": "DvLWN2ZTMZ",
  "shop_secret": "EIxTuot8sj",
  "email": "...",
  "phone": "...",
  "code": "...",
  "variables": {
    "first_name": "John",
    "last_name": "Connor",
    "promocode": "IDDQD",
    "variable_1": "value_1",
    "variable_2": "value_2",
    ...
  }
}
// REST API only. See cURL.
// REST API only. See cURL.
// REST API only. See cURL.

When sending a message, you must to send:

Requirements

Endpoint: GET https://api.rees46.com/multi/transactional

Content type: application/json

Data format: JSON body.

Query Parameters

Parameter Type Required Description
shop_id String true Your API key
shop_secret String true Your API secret key
email* String true User's email
phone* String true User's phone number
code String true Multi-channel campaign unique code
send_everywhere Boolean false Send to all channels, except SMS. Default false
variables Object true Object of key-pair variables for template parser. See example
  • One of identifiers must present in request: email or phone. It's used to identify user.

URL shortener

This service provides functionality to make shortened URLs and generate QR codes for an URL.

Create short URL

Headers

Content-type: application/json

Body example

{
    "shop_id": "...",
    "shop_secret": "...",
    "links": [
        {
            "url": "https://example.com/page/1/?utm_source=source...",
        },
        {
            "url": "https://example.com/page/2/?utm_source=source...",
            "lifetime": 60
        },
        {
            "url": "https://example.com/page/3/?utm_source=source...",
            "code": "a",
            "lifetime": 10
        }
    ]
}

Request example

curl --header "Content-Type: application/json" \
  --request POST \
  --data '{"shop_id":"...","shop_secret":"...","links":[{"url":"https://example.com/page/1"},{"url":"https://example.com/page/1","code":"a"}]}' \
  https://api.rees46.com/url/create

Response example:

[
  {
    "source": "https://example.com/page/1",
    "url": "https://r46.dev/x27FyAlR"
  },
  {
    "source": "https://example.com/page/2",
    "url": "https://r46.dev/a"
  }
]

The endpoint allows to create 1 to N shortened URLs. Use batch request to shorten hundreds of URLs at once.

HTTP Request

Method Endpoint Content-type
POST https://api.rees46.com/url/create application/json

Query Parameters

This is JSON request. All data must be send as JSON body. Do not forget to set Content-type: application/json.

Parameter Type Required Description
shop_id String true Your API key
shop_secret String true Your secret API key
links Array true List of URLs to shorten. At least 1 element must present.
url String true Source URL to shorted. Must be present in each element if list array.
lifetime Integer false Number of days shortened link to be alive. Link will be deleted after this number of days. Min value: 1. Max value: 90. Default value: 30. Try not to use large numbers, because number of unique shortened URLs is limited.
code String false Use code property to manually create links with specified URL. Keep in mind: every time you set code manually, it overrides previous link with the same code.
domain String false Custom domain name for URL shortener. Must be whitelisted with support team before usage.

Products and catalog

Service is used to manage products and categories.

Get product info

curl https://api.rees46.com/products/get?shop_id=...&item_id=...
// No implementation. See CURL
// No implementation. See CURL
// No implementation. See CURL

REST method returns this JSON structure

{
  "name": "...",
  "description": "...",
  "price": "...",
  "currency": "...",
  "url": "...",
  "picture": "..."
}

Returns basic product info.

GET https://api.rees46.com/products/get

Query Parameters

Parameter Type Required Description
shop_id String true Your API key
item_id String true Product ID

Get subscriptions for products in stock

curl https://api.rees46.com/products/subscribers/stock?shop_id=...&shop_secret=...
// No implementation. See CURL
// No implementation. See CURL
// No implementation. See CURL

REST method returns this JSON structure

[
  {
    "id": "ID1",
    "barcode": "BC101",
    "quantity": 337,
    "date": "2020-01-12",
    "contacts": [
      "email@email.com",
      "email@email.com"
    ]
  },
  {
    "id": "ID2",
    "barcode": "BC102",
    "quantity": 13,
    "date": "2020-08-11",
    "contacts": [
      "email@email.com",
      "email@email.com"
    ]
  }
]

Returns list of products and a number of subscribers for each product in stock.

GET https://api.rees46.com/products/subscribers/stock

Query Parameters

Parameter Type Required Description
shop_id String true Your API key
shop_secret String true Shop secret key

Response details

Parameter Type Description
id String Product ID
barcode String Product barcode
subscribers Integer Number of subscribers for the product
date String Date of the last subscription

Get subscriptions for products price drop

curl https://api.rees46.com/products/subscribers/price?shop_id=...&shop_secret=...
// No implementation. See CURL
// No implementation. See CURL
// No implementation. See CURL

REST method returns this JSON structure

[
  {
    "id": "ID1",
    "barcode": "BC101",
    "quantity": 337,
    "date": "2020-01-12",
    "contacts": [
      "email@email.com",
      "email@email.com"
    ]
  },
  {
    "id": "ID2",
    "barcode": "BC102",
    "quantity": 13,
    "date": "2020-08-11",
    "contacts": [
      "email@email.com",
      "email@email.com"
    ]
  }
]

Returns list of products and a number of subscribers for each product's price drop.

GET https://api.rees46.com/products/subscribers/price

Query Parameters

Parameter Type Required Description
shop_id String true Your API key
shop_secret String true Shop secret key

Response details

Parameter Type Description
id String Product ID
barcode String Product barcode
subscribers Integer Number of subscribers for the product
date String Date of the last subscription

Get status of subscription for "Back in Stock" trigger

// No implementation. See JavaScript
r46("check_trigger", "product_price_decrease", params, success, error);
// No implementation. See JavaScript
// No implementation. See JavaScript

API method returns this boolean status

Returns boolean status of subscription.

Query Parameters

Parameter Type Required Description
params Object true Object with request parameters.
success Function true Callback-function, where the API response will be passed to. Response type: object.
error Function false Callback-function to be called when an error occurs (any HTTP status code other than 200).

Request parameters

Parameter Type Required Description
item string/number true Product ID
email string false Email for subscription checking
phone string false Phone for subscription checking
loyalty_id string false Loyalty ID for subscription checking

Get status of subscription for product price drop

// No implementation. See JavaScript
r46("check_trigger", "product_available", params, success, error);
// No implementation. See JavaScript
// No implementation. See JavaScript

API method returns this boolean status

Returns boolean status of subscription.

Query Parameters

Parameter Type Required Description
params Object true Object with request parameters.
success Function true Callback-function, where the API response will be passed to. Response type: object.
error Function false Callback-function to be called when an error occurs (any HTTP status code other than 200).

Request parameters

Parameter Type Required Description
item string/number true Product ID
email string false Email for subscription checking
phone string false Phone for subscription checking
loyalty_id string false Loyalty ID for subscription checking

Categories

Service provides access to categories endpoint.

Request categories

curl https://api.rees46.com/products/categories

HTTP Request

GET https://api.rees46.com/products/categories

Query Parameters

Parameter Required Description
shop_id true Your API key
shop_secret true Your Secret key
depth false (0 - root categories, 1 - root and first level of childs, etc.),
exclude false An array of categories to exclude from the response
only_discount false boolean. Only categories with discount products.

Response example

[
  {
    :id=>19,
    :external_id=>"482",
    :name=>"Jewelry",
    :url=>"https://demo.rees46.com/categories/jewelry",
    :parent_id=>nil,
    :parent_external_id=>nil,
    :children=> [
      {
        :id=>31,
        :external_id=>"483",
        :name=>"Rings",
        :url=>"https://demo.rees46.com/categories/rings",
        :parent_id=>19,
        :parent_external_id=>"482",
        :children=>[]
      }
    ]
  },
  {
    :id=>4,
    :external_id=>"479",
    :name=>"Baby & Kids",
    :url=>"https://demo.rees46.com/categories/baby",
    :parent_id=>nil,
    :parent_external_id=>nil,
    :children=>[
      {
        :id=>9,
        :external_id=>"480",
        :name=>"Clothing Sets",
        :url=>"https://demo.rees46.com/categories/baby-kids-clothing-sets",
        :parent_id=>4,
        :parent_external_id=>"479",
        :children=>[]
      }
    ]
   }
]

Chats

Section describes how to save external chats' logs.

Save chat log

curl -i -X POST -H "Content-Type: application/json" --data-binary "@data.json" https://api.rees46.com/chat_reports

# data.json for email
{
  "shop_id": "DvLWN2ZTMZ",
  "shop_secret": "EIxTuot8sj",
  "platform": "...",
  "code": "...",
  "email": "...",
  "data": {...}
}

# data.json for phone
{
  "shop_id": "DvLWN2ZTMZ",
  "shop_secret": "EIxTuot8sj",
  "code": "...",
  "platform": "...",
  "phone": "...",
  "data": {...}
}
// REST API only. See cURL.
// REST API only. See cURL.
// REST API only. See cURL.

Requirements

Endpoint: POST https://api.rees46.com/chat_reports

Content type: form-data

Query Parameters

Parameter Type Required Description
shop_id String true Your API key
shop_secret String true Your API secret key
code String true Conversation unique code
platform String true Platform code. Supported: livetex
phone* String true User's phone number
email* String true User's email
data Object true Conversation raw data as stringified JSON object

Communications

Section describes how to save, read or edit external communication's logs.

Save communication log

curl -i -X POST -H "Content-Type: application/json" --data-binary "@data.json" https://api.rees46.com/crm/client_calls

# data.json for phone
{
  "shop_id": "DvLWN2ZTMZ",
  "shop_secret": "EIxTuot8sj",
  "phone": "...",
  "channel": "...",
  "event": "...",
  "location_id": "...",
  "call_type": "...",
  "call_theme": "...",
  "comment": "...",
  "author_type": "...",
  "status": "..."
}

# data.json for email
{
  "shop_id": "DvLWN2ZTMZ",
  "shop_secret": "EIxTuot8sj",
  "email": "...",
  "channel": "...",
  "event": "...",
  "location_id": "...",
  "call_type": "...",
  "call_theme": "...",
  "comment": "...",
  "author_type": "...",
  "status": "..."
}

# data.json for did
{
  "shop_id": "DvLWN2ZTMZ",
  "shop_secret": "EIxTuot8sj",
  "did": "...",
  "channel": "...",
  "event": "...",
  "location_id": "...",
  "call_type": "...",
  "call_theme": "...",
  "comment": "...",
  "author_type": "...",
  "status": "..."
}
// REST API only. See cURL.
// REST API only. See cURL.
// REST API only. See cURL.
// REST API only. See cURL.

Requirements

Endpoint: POST https://api.rees46.com/crm/client_calls

Content type: application/json

Query Parameters

Parameter Type Required Description
shop_id String true Your API key
shop_secret String true Your API secret key
phone* String true User's phone number
email* String true User's email
did* String true User's did
channel String true Сommunication's channel
event String true Сommunication's event
location_id String true Client's location id
call_type String true Сommunication's type
call_theme String true Сommunication's theme
subject_appeal String true Сommunication's subtheme
comment String true Сommunication's comment
author_type String true Сommunication's author
status String true Сommunication's status in external system

Read communication log

The query returns the last 20 communications as an array with items sorted by time

# Using phone as user identifier
curl https://api.rees46.com/crm/client_calls?&shop_id=...&shop_secret=...phone=...

# Using email as user identifier
curl https://api.rees46.com/crm/client_calls?&shop_id=...&shop_secret=...email=...

# Using did as user identifier
curl https://api.rees46.com/crm/client_calls?&shop_id=...&shop_secret=...did=...
// REST API only. See cURL.
// REST API only. See cURL.
// REST API only. See cURL.
// REST API only. See cURL.

Requirements

Endpoint: GET https://api.rees46.com/crm/client_calls

Query Parameters

Parameter Type Required Description
shop_id String true Your API key
shop_secret String true Your API secret key
phone* String true User's phone number
email* String true User's email
did* String true User's did

Edit communication log

The query returns the last 20 communications as an array with items sorted by time

# Using phone as user identifier
curl https://api.rees46.com/crm/client_calls/ID?&shop_id=...&shop_secret=...phone=...

# Using email as user identifier
curl https://api.rees46.com/crm/client_calls/ID?&shop_id=...&shop_secret=...email=...

# Using did as user identifier
curl https://api.rees46.com/crm/client_calls/ID?&shop_id=...&shop_secret=...did=...
// REST API only. See cURL.
// REST API only. See cURL.
// REST API only. See cURL.
// REST API only. See cURL.

Requirements

Endpoint: PATCH https://api.rees46.com/crm/client_calls

Query Parameters

Parameter Type Required Description
shop_id String true Your API key
shop_secret String true Your API secret key
phone* String true User's phone number
email* String true User's email
did* String true User's did
ID String true Communication's id
channel String true Сommunication's channel
event String true Сommunication's event
location_id String true Client's location id
call_type String true Сommunication's type
call_theme String true Сommunication's theme
subject_appeal String true Сommunication's subtheme
comment String true Сommunication's comment
author_type String true Сommunication's author
status String true Сommunication's status in external system

Errors

The REES46 API uses the following error codes:

Error Code Meaning
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Your API key is wrong.
403 Forbidden -- The method is for internal use only or you don't have secret key to access it.
404 Not Found -- The specified object could not be found.
405 Method Not Allowed -- You tried to access with an invalid method.
406 Not Acceptable -- You requested a format that isn't json.
429 Too Many Requests -- You're sending too many requests.
500 Internal Server Error -- We had a problem with our server. Try again later.
503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.