Skip to main content

Attributes

An attribute represents a characteristic of a given entity, and you can use it in your rules.

Each attribute is described by its:

  • Type, for instance, string or number.
  • Definition:
    • Built-in attributes: They are provided by Talon.One.
    • Custom attributes: They are created by you.
important

There is no difference in use. You can choose to use only custom attributes if you want.

Examples:

  • An online fashion retailer might add a Brand attribute belonging to cart items to apply discounts on a given brand.
  • A hotel-booking platform might add the CheckInTime and CheckOutTime attributes to customer sessions and trigger extra notifications depending on the season.
  • An ecommerce shop might add a Segment attribute to customer profiles to trigger targeted campaigns.
Attributes being used to transfer any data into Talon.One.

Built-in attributes

The core data model defines a small set of common attributes for many entities, such as names for customer profiles and prices for cart items.

To learn about viewing built-in attributes in the Campaign Manager, see Displaying attributes.

tip

Depending on your attribute usage, you can control the visibility of attributes in the Attribute Selector. See Managing attribute visibility.

Custom attributes

You can also create and define your own attributes to manipulate the data of your choice.

Let's imagine our online business service includes an in-house community forum. We want to offer special promotions to active forum users.

To do this, we can create a custom attribute called ForumPosts with associated entity customer profile. We can use this attribute to track the number of times the user has posted on the forum. We can also reward the users with the help of promotional campaigns.

note

After the attribute is created, it is ready for use but has no value. You can set the value of the attribute programatically or in the Campaign Manager.

Setting attributes

Once you have created attributes, or once you know which built-in ones to use, you can assign values to them programatically with the following endpoints:

For example, consider the ForumPosts attribute from above. To keep the count of forum posts synced between Talon.One and the forum, we can use the updateCustomerProfile endpoint every time the user makes a post to update the stats.

Using the updateCustomerProfile endpoint:

CURL -X PUT https://mycompany.europe-west1.talon.one/v2/customer_profiles/{sessionId} -d
'{
"attributes": {
"ForumPosts": someValue
}
}'

The attribute value must match the attributes type. The following types are supported:

  • string - Any valid JSON string.
  • number - Any valid JSON number, internally these are treated as big decimal numbers.
  • boolean - Either true or false.
  • time - An RFC3339 timestamp.
  • location - See Using geolocation.
  • list of strings - Comma separated list of strings. Contains up to 1000 items.
  • list of numbers - Comma separated list of numbers. Contains up to 1000 items.

You can also remove any attribute value by setting it to null.

important

Talon.One will return a 400 error whenever an unknown attribute is transferred in a session. An unknown attribute doesn't appear in the Campaign Manager.