Easily collect custom metadata about your chatbot users in a powerful built-in Customer Data Platform, right inside CSML Studio!
Using the Subscribers feature, you can easily and automatically gather metadata about your chatbot users. You can also save custom attributes to create user segments, to retarget them later with specific flows.
Usage
By default and when the feature is activated in your Studio dashboard, when a new user comes and chats with your chatbot, they will automatically be added to the Subscribers panel of CSML Studio, with any useful metadata known to the chatbot at the time of their visit (which depends on the channel and the associated permissions). Then, you can also add new attributes or even replace existing ones at any time!
Setting user attributes
Add custom attributes to your subscriber. This will replace any existing attribute with the new value. Any data structure is accepted, however some attributes are reserved and must be set with specific types.
do App("utils/subscribers", set={"first_name": "John", "favorite_color": "red", "last_purchase": {"id": "ABC", "amount": 4 } })
Deleting attributes
You can also remove existing attributes using the unset
keyword.
do App("utils/subscribers", unset=["my_custom_attr", "favorite_color"])
Tags
Tags are a special feature for the Subscribers database: for each user, you can manually set one or several tags to help you group users together and segment them more easily. Tags are saved as an array of unique lowercase strings (so myTag
and MYTAG
are saved as a single mytag
tag).
You can add and remove tags by using the addTags
and removeTags
properties:
do App("utils/subscribers", addTags=["green", "beta"], removeTags=["yellow", "alpha"])
Mix and match
You can obviously perform several operations in a single App call!
do App(
"utils/subscribers",
set={"first_name": "John", "favorite_color": "red", "last_purchase": {"id": "ABC", "amount": 4 } },
unset=["my_custom_attr", "favorite_color"],
addTags=["green", "beta"],
removeTags=["yellow", "alpha"],
)
Reserved Attributes
Some attributes are reserved and automatically set by the chatbot in advance. Some can not be manually set, and some require to be set with a specific type.
The following attributes must be set to strings. They are automatically set by the chatbot when available in the _metadata
: first_name
, last_name
, email
, phone_number
.
The following attributes are forbidden. They are automatically set by the chatbot and can not be overriden: _id
, id
, user_id
, channel_id
, bot_id
, channel_type
, status
, last_interaction_at
, interactions_count
, ttl
, expires_at
, created_at
, metadata
.
Tags can only be set using the addTags property. Setting tags
as a regular property will not succeed.
Finally, custom attributes (set by the developer) will be displayed with the custom:
prefix.