Sets (creates, updates, deletes) user properties. Up to 250 properties can be set in one request.
POST https://api.dashly.app/users/{id}/props
For {id}
you can use:
by_user_id=true
)Authentification parameters.
id_as_string parameter.
Parameter | Type | Description |
---|---|---|
by_user_id |
Optional[boolean] | Should be true in case you're using User ID instead of Dashly ID. Default: false |
operations |
Array[Dict] | Array of atomic operations conducted on user's properties. Properties formats |
double_subscribe |
Optional[boolean] | Resubscribes unsubscribed user in case $email property is updated. Default: false |
parse_custom_props_type |
Optional[boolean] | If set to true , system will automatically detect types of set properties. Default: true |
source |
Optional[Dict] | Sets source of received $email and $phone properties. |
app |
Optional[ID] | ID of requesting application. Default: calculated based on access token. |
You can find indepth info on operations and properties formats here.
Operations are conducted in the same order as in operations
array.
Serial operations on one property are acceptable.
In case a system property is set you have to use it's system name starting with $
.
You can look up system properties names here.
As long as this method allows multiple simultaneous operations some operations might be incorrect (for example an incorrect type is set for a system property).
In this case in order to save as much correct data as possible request will not return an exception in case there are some invalid operations but will conduct all valid ones.
In this case meta
will contain:
affected_props: List[string]
- list of updated propertiesnot_changed_props: List[string]
- list of unchanged propertiesignored_operations: List[Dict]
- list of dictionaries with ignored operations.
Dictionaries contain operation and reason
, describing the exception.Custom properties type will be automatically detected by default.
For example if value contains "12345"
string, property will get 12345
integer instead of a string.
In som cases this behaviour is unwanted (for example in case of long integers which are misinterpreted by browsers).
Use parse_custom_props_type=false
parameter to evade custom properties types autodetection.
System properties type is system-defined and value is always defined in accordance with this type. System property will not be updated in case of type mismatch and request will return an exception (meta.ignored_operations
field).
In case the user is unsubscribed from emails (has Unsubscribed
status in his user's card),
and then provides the same email address on your site, this email address subscription status would not change.
Use double_subscribe=true
parameter to re-subscribe this user.
source
parameter is standart and serves to identify the source of collected email or phone (pop-up, chat-bot, etc).
Source helps us collect statistics on contact data collected bu bots and automessages.
This is a dictionary which contains "type"
field - source type and "id"
field (which is optional), which points at exact message. Example: {"type": "popup_small", "id": 123}
data
field contains id of user who's properties were updated.
meta
field contains standart fields plus the following:
affected_props: List[string]
- list of updated propertiesnot_changed_props: List[string]
- list of unchanged propertiesignored_operations: List[Dict]
- list of dictionaries with ignored operations.
Dictionaries contain operation and reason
, describing the exception.{
"meta": {
"status": 200,
"affected_props": [],
"ignored_operations": []
},
"data": {
"id": 123123123,
"app": 12345
}
}
Set name “Maks” for user with dashlyId=8173131
(our ID):
curl -X POST \
--data-urlencode "operations=[{"op": "update_or_create", "key": "$name", "value": "Maks"}]" \
-H "Authorization: Token XXX" \
https://api.dashly.app/users/8173131/props
Set name “Maks” for user with UserId=user-7216
(your ID):
curl -X POST \
--data-urlencode "operations=[{"op": "update_or_create", "key": "$name", "value": "Maks"}]" \
--data-urlencode "by_user_id=true" \
-H "Authorization: Token XXX" \
https://api.dashly.app/users/user-7216/props
Set property my-prop
with Hello
value and increase projects
property by 3 for user with UserId=user-721
(your ID):
curl -X POST \
--data-urlencode 'operations=[{"op": "update_or_create", "key": "my-prop", "value": "Hello"},{"op": "add", "key": "projects", "value": "3"}]' \
--data-urlencode 'by_user_id=true' \
-H "Authorization: Token XXX" \
"https://api.dashly.app/users/user-7216/props"