Custom Attributes
Set custom attributes to a user's profile
Use the createProfileCustomAttributes
mutation to add or update a set of custom attributes associated with the user's profile. These attributes can then trigger/affect different program rules.
Add and update the custom attributes
Using the append
argument as true
the custom attributes sent in the mutation will be added to the existing ones. While using the append
argument asfalse
will overwrite your custom attributes.
Use the myProfile
query to verify that your attributes were added or updated correctly.
See these examples.
Updating Custom Attributes
Available Arguments
Argument
Required?
Type
Description
attributes
True
Object that includes all the custom attributes to add in the query.
append
False
Boolean
True if it is required to add new custom attributes to the existing ones. By default, this argument is sent as False., therefore the custom attributes values will be overwritten.
ProfileCustomAttribute
Available Fields
Field
Type
Description
name
String!
attribute name
dataType
AttrDataType!
attribute data type: STRING, INT, FLOAT, BOOLEAN
value
GenericScalar!
Attribute value which can be String, Boolean, Int, Float, List or Object.
category
String
category name
timestamp
Float
timestamp in float format
Available Fields
Field name
Type
Description
success
Boolean
True if the custom attribute list has updated successfully. Otherwise, it returns False
errors
Error Type
It retrives an error in case the custom attribute cannot be added. Sent the error field as follows:
errors { field messages }
Examples
Create custom attributes
The following example will create custom attributes based on the values sent in the object.
Overwrite your custom attributes by sending different values, therefore, all the attributes created before are replaced with the new ones. See the example below:
Update the existing custom attributes
Use the append
argument to update your existing attributes:
Based on the previous example, the new attribute will be added to the current one:
Last updated