What Are User Attributes?
A user attribute is a simple key-value record associated with a specific user (identified byfbId) on a specific bot (identified by apikey). Attributes are:
- Persistent — they survive across conversations and sessions.
- Bot-scoped — attributes set on one bot are not visible to other bots, even within the same workspace.
- Flexible — keys and values are strings, so you can store anything that can be expressed as text.
Setting a User Attribute
Use thePOST /api/v1/add-user-attribute endpoint to set or update an attribute on a user. Authentication is via the bot’s apikey (passed in the request body), which ensures that attributes are always scoped to the correct bot.
User attributes are scoped to the bot identified by the
apikey you provide. The same user (fbId) can have different attributes on different bots — setting an attribute on one bot has no effect on that user’s data in any other bot.Use Cases
Personalization
Once you know something about a user — their name, their role, their preferences — you can store it as an attribute and have your bot reference it in future turns. Instead of asking for the same information repeatedly, the bot can greet users by name, skip steps they’ve already completed, and tailor responses to their situation.Segmentation and Conditional Flows
Attributes enable conditional logic in your chat flows. For example, aplan attribute with value "free" could route users to a self-service flow, while "enterprise" routes them to a human agent handoff. Your flow logic checks the attribute value at runtime and branches accordingly.
Targeted Outbound Messaging
When sending proactive outbound messages, you can use attributes to filter and target specific user segments — for example, only send a renewal reminder to users whosesubscription_status is "expiring".
