8. Integrating Actions in Your App
Before you begin, make sure youāve completed these steps:
- Android integration points setup or
iOS integration points setup- Adding the SDK to the Application
- SDK Initialization
Example implementation
Create Operations to submit customersā action details. See details in the "Operations and Integrations" section at https://help.maestra.io/.
Mindbox SDK offers the following 2 methods to call Operations from a mobile app:
executeAsyncOperationā sending data to the system;executeSyncOperationā retrieving data from the system.
Use the `OperationBodyRequest` constructor to create request bodies for operations.
Integration specifications
Here you will learn how to call the SDK API to transmit data.
Individually set up for each project, relevant API methods are required to submit data to Maestra.
Your Maestra Forward Deployed Marketer sets up and documents such API methods.
Before proceeding to the steps below, make sure you have the document describing all the applicable API methods.
Below you will find examples of how you can integrate some requests from a mobile app.
Directly copying code from these examples will not work.
Call scripts: examples
App authorization (testing only)
MindboxSdk.executeAsyncOperation(
operationSystemName: "Mobile.CreateCustomer",
operationBody: {
"customer": {
"mobilePhone": "<Mobile phone>",
}
}
);Submit Product Views and Category Views
MindboxSdk.executeAsyncOperation(
operationSystemName: "CheckGuide.viewProduct",
operationBody: {
"product": {
"ids": {
"website": "<product ID in Website>"
}
}
}
);
Mindbox.instance.executeAsyncOperation(
operationSystemName: "CheckGuide.viewProduct",
operationBody: {
"viewProductCategory": {
"productCategory": {
"ids": {
"website": "<Product Category ID in Website>"
}
}
}
}
);
Submit "Add Item" and "Set up List of Items" actions
Mindbox offers 2 items list handling methods:
- Add / delete individual products;
- Add a list by a single request.
Popular product lists: Cart and Favorites.
Mindbox.instance.executeAsyncOperation(
operationSystemName: "CheckGuide.addProductToCart",
operationBody: {
"addProductToList": {
"product": {
"ids": {
"website": "<product ID in Website>"
}
"pricePerItem": "<Price per item>"
},
}
}
);
Mindbox.instance.executeAsyncOperation(
operationSystemName: "CheckGuide.addProductToCart",
operationBody: {
"productList": [
{
"product": {
"ids": {
"website": "<product ID in Website>"
}
},
"count": "<Number of products>",
"priceOfLine": "<Price of line>"
},
]
}
);
Checking a segmented customer: example
Run this request to check whether a customer is in a pre-set custom segment.
MindboxSdk.executeSyncOperation(
operationSystemName: "CheckGuide.checkSegment",
operationBody: {},
onSuccess: success => {
console.log(success);
},
onError: error => {
console.log(error);
},);Receiving personal recommendations: example
Run this request to return a personalized list of products based on a custom recommendation algorithm.
MindboxSdk.executeSyncOperation(
operationSystemName: "CheckGuide.getReco",
operationBody: {
"recommendation": {
"limit": "3"
}
},
onSuccess: success => {
console.log(success);
},
onError: error => {
console.log(error);
},);Updated 15 days ago

