BotDistrikt Documentation
  • 🟢Introduction
    • 👋Hello World
    • 🚀Quick Start
    • 🛠️Setup your Account
      • Register for BotDistrikt
      • Forgot Password
      • Chatbots Dashboard
      • Edit Profile
  • 📱Channels
    • Channels Overview
    • Website Chat
      • Website Chat Quick Start
      • Guest Users
    • Facebook Messenger
      • Import Existing Users
      • Facebook Chat Plugin
      • Facebook Checkbox Plugin
      • Facebook Private Replies
      • Facebook Ads Manager
    • Instagram
      • Import Existing Users
      • Instagram Story Mentions
    • Twitter
    • Skype
    • WhatsApp
      • Twilio WhatsApp Integration
    • Telegram
      • Telegram Commands
      • Telegram Groups
      • Telegram Channels
    • SMS
    • Google Assistant
    • WeChat
    • Other Channels
  • 🏆Features
    • Personality
    • Dashboard
    • Forms
    • Rules
      • Conditions
        • Message
        • User Attribute
    • Stories
      • Update Greeting and Fallback from Personality
    • Responses
      • Text
      • Cards
      • Images
      • Videos
      • Audios
      • Documents
      • Webhooks
      • Javascript Functions
    • Sources
      • Websites
      • Documents
      • Google Docs
      • Google Sheets
    • Users
      • Edit Users
      • Delete Users
      • Dear User
    • Inbox
      • Console
      • Messages
      • Reactions
      • Ratings
      • Clicks
      • Broadcast Records
      • Wrong Responses
    • Broadcasts
    • Settings
      • Tags
      • Audit Logs
      • Account
  • ⚙️How BotDistrikt Works
    • Interaction
    • Flow
    • Context
    • Engagement
    • Optimization
    • Artificial Intelligence
  • 🧠Artificial Intelligence
    • OpenAI
    • Vertex AI
    • Wit.ai
    • Dialogflow
      • Connecting to Dialogflow
      • Small Talk Module
        • Importing Responses
      • Multilanguage Support
  • 🧰Business Tools Integrations
    • Webhook
    • Zendesk
    • Chatbase
    • Google Docs
    • Google Sheets
    • Salesforce
  • API Reference
Powered by GitBook
On this page

Was this helpful?

  1. Features
  2. Rules
  3. Conditions

User Attribute

We have the capability to assign attributes to a user as they chat with a bot. This is useful to store information about the user. For example, if we want to store the user's email, or if we want to store the user's favourite flavor of ice cream.

Let's go to the "you just said hello" story change the first text response to

text: What is your favorite flavor of ice cream?

then let's add a memory response

ACTION
type: memory
property: asked-fav-icecream
function: set to
value: true

Now let's add a NEW rule with a NEW condition

CONDITION
type: memory
property: asked-fav-icecream
function: equals
value: true

Now the chat flows as follows:

CHAT
User: hello there
Bot: hey!
Bot: (secretly, without telling the user, sets *said-hey* to true in the session)
User: how are you?
Bot: (saw that the property said-hey equals true in the user's chat session)
Bot: What is your favorite flavor of ice cream?

and let's assign this to a new story called "entered fav ice cream"

Go to the "entered fav ice cream" story and add a new action response

type: user attribute
property: fav_ice_cream
function: set to
value: {{message.text}}

then add yet another text response

message: I love {{user.fav_ice_cream}} too! It's amazing.

We just used a merge tag called fav_ice_cream to refer to the new user attribute. Now the chat flows as follows:

User: hello there
Bot: hey!
Bot: (secretly, without telling the user, sets *said-hey* to true in the session)
User: how are you?
Bot: (saw that the property said-hey equals true in the user's chat session)
Bot: What is your favorite flavor of ice cream?
Bot: (secretly, without telling the user, sets *asked-fav-icecream* to true in the session)
User: chocolate
Bot: (saw that the property asked-fav-icecream equals true in the session)
Bot: (store's the user's last message to an attribute called fav_ice_cream)
Bot: I love chocolate too! It's amazing.

Now, refer to the user's favorite ice cream with the merge tag {{user.fav_ice_cream}} in any of our responses or cards REGARDLESS of the chat session.

The user will start chatting with the bot again tomorrow (theirfav_ice_cream will still be chocolate).

PreviousMessageNextStories

Last updated 11 months ago

Was this helpful?

🏆