User Profile (Android SDK - Kotlin)

Update User Profile

Method Objective

The method updates the user's profile or creates a new profile bound to the user's current device if it was not created earlier.

If you don't have user data, never send bogus data. It'll cause problems in profile handling in the future. For example, don't send a non-existent email, like anonymous@example.com, or an automatically generated email address that doesn't have anything to do with the user's actual email.

Syntax and parameters

sdk.profile(params, callback)

NameTypeRequirementDescription
paramsHashMaprequiredObject with request parameters
callbackfunctionoptionallyThe callback function to which the API response will be passed

Main request parameters

Name

Type

Description

email  

string

User Email.

first_namestringUser First Name.
genderstringUser Gender (m – male, f – female).
idstringStore side user ID.
last_namestringUser Surname.
phonestringUser Phone.

Additional request parameters

Name

Type

Description

agestring

User age (in years).

autoJSON stringList of vehicles. See description below.
birthdaystring

User birthday in the format YYYYY-MM-DD.

bought_somethingstringThe user has or hasn't ever bought something in the store. "1" - if the user has made purchases, "0" - if not.
fb_idstringFacebook User ID.
kidsJSON stringUser's children. See description below.
locationstring

The user's current location from the list of locations in the product feed.

loyalty_bonusesstringThe current number of store bonuses at the user.
loyalty_bonuses_to_next_levelstringThe number of store bonuses necessary for the user to reach the next loyalty level.
loyalty_card_locationstringThe location (from the list of locations in the product feed) where the user last used the loyalty card.
loyalty_idstringThe Loyalty Program user ID (loyalty card).
loyalty_statusstringThe user's current status in the loyalty program.
telegram_idstringTelegram User ID.
vk_idstringVKontakte User ID.

The "auto" object properties

Name

Type

Description

brandstring

Vehicle Brand.

modelstringVehicle Model.
vdsstring

Vehicle's VDS/VIN.

The "kids" object properties

Name

Type

Description

genderstringChild's age (m – male, f – female).
birthdaystringChild's birthday in the format YYYY-MM-DD.

Custom Properties

NameTypeDescription
A custom property can have any name except the reserved onesstring

The custom property must be created before it can be used. Located there: Account > Settings > Profile Property

If property creation isn't available in the account, contact PersonaClick support.

integer
float
array of string
json
date (YYYY-MM-DD hh:mm:ss)

Examples of use

val params = HashMap<String, String>()
params["id"] = "100500"
params["email"] = "john.doe@examplemail.com"
params["phone"] = "4400114527199"
params["first_name"] = "John"
params["last_name"] = "Doe"
params["birthday"] = "1990-03-11"
params["age"] = "31"
params["gender"] = "m"
params["location"] = "NY"
params["bought_something"] = "1"
params["loyalty_id"] = "000001234567"
params["loyalty_card_location"] = "NY"
params["loyalty_status"] = "5% discount"
params["loyalty_bonuses"] = "1123"
params["loyalty_bonuses_to_next_level"] = "1877"
params["fb_id"] = "000000000354677"
params["vk_id"] = "vk031845"
params["telegram_id"] = "0125762968357835"
params["kids"] = "[{\"gender\":\"m\",\"birthday\":\"2001-04-12\"},{\"gender\": \"f\", \"birthday\": \"2015-07-28\"}]"
params["auto"] = "[{\"brand\":\"Nissan\",\"model\":\"Qashqai\",\"vds\":\"TM7N243E4G0BJG978\"}]"
params["custom_string_property"] = "string_value"
params["custom_integer_property"] = "100500"
params["custom_float_property"] = "7.62"
params["custom_array_of_string_property"] = "[\"val1\",\"val2\",\"val3\"]"
params["custom_json_obj_property"] = "{\"key1\":\"val1\",\"key2\":\"val2\"},{\"key3\":\"val3\"}"
params["custom_date_property"] = "2021-12-31 23:55:00"
sdk.profile(params)
val params = HashMap<String, String>()
params["id"] = "100500"
params["email"] = "john.doe@examplemail.com"
sdk.profile(params, object : OnApiCallbackListener() {
    fun onSuccess(response: JSONObject) {
        // API response processing functionality
    }
});



Get Device ID of Current Profile

Method Objective

The method allows getting the Device ID of the current profile.

Syntax

sdk.getDid()

Example of use

val deviceId = sdk.getDid()

Copyright 2018-2024 PersonaClick