Activechat Manual
  • What is Activechat?
  • New? Start here
    • The basics
    • Set up your first project
    • Install the chat widget
    • Upload the knowledge
    • Explore the CRM
    • AI-assisted live chat
      • How to set context for AI hints
    • Live chat mobile app
    • Build your first automation
  • Conversational AI
    • For Customer Service Teams
    • For Product Managers
    • For Innovation Teams
    • For Marketers
    • For e-commerce
    • For developers
  • Help Guides
    • Setting up your team
    • Managing conversations
      • Customer attributes
      • User tags and segments
      • Searching for specific users
      • Agent tags (live chat groups and queues)
      • Triggering live chat sessions from the bot
      • Notifications with the TRIGGER block
    • Managing knowledge
      • Uploading business data
      • Question answering and live chat hints
      • Fine-tuning the large language model
    • Natural language automation
    • Building automations visually
      • Customizing your welcome message
      • Adding new skills
      • Navigating skills
      • Copying skills and blocks
      • Handling errors
    • Improving your virtual agent
    • Using live chat AI hints
    • Customizing automatic website page messages
    • Tracking website actions
    • Facebook Ads automation
      • How to set up a Facebook ads bot
      • How to use buttons and quick replies in a Facebook ads chatbot
    • Lead generation
    • Zapier integrations
    • Customizing your project
      • How to customize the chat widget
      • How to customize the Facebook chat widget
      • How to change bot settings
    • Pricing guide
  • Fundamentals
    • Terminology
      • Intents and entities
      • Contexts
      • Skills and events
        • Built-in system skills
          • /start
          • /default
          • /_default_fallback
          • /_start_live_chat
          • /_page_visit
          • /_error
      • Conversation elements
        • Messages
        • Buttons
        • Quick replies
        • Galleries / carousels
    • Messaging channels
      • Website chat widget
        • Installation
        • Customization
        • Voice input
      • Chat widget landing page
      • Facebook Messenger
        • Connect your page
        • 24 hour rule
        • Message tags
        • Persistent menu
      • Telegram
      • Email
      • Twilio SMS automation
    • Intents and bot skills
    • Conversation insights
    • Grow tools
      • Landing pages
      • Messenger links and QR codes
    • Broadcasting
  • Visual builder reference
    • Sending messages
      • TEXT
      • LISTEN
      • IMAGE
      • MEDIA
      • GALLERY
      • FILE
      • EMAIL
      • SMS
      • LEAD
    • Triggering events
      • SEND
      • CATCH
      • TRIGGER
      • LIVE CHAT
    • Manipulating data
      • DATA
      • ADD TAG
      • REMOVE TAG
      • JSON
      • STATUS
      • VALIDATION
    • Conditional logic
      • SWITCH
    • Timers and delays
      • TIMER
      • WAITFOR
      • WAITUNTIL
    • E-commerce blocks
      • CATEGORY
      • PRODUCT
      • VARIATIONS
      • SIMILAR
      • UPSELLS
      • CROSSSELS
      • Shopping carts
        • ADD TO CART
        • UPDATE CART
        • SHOW CART
        • CLEAR CART
        • CREATE ORDER
    • Natural Language
      • NLP
    • System attributes
    • System events
  • Integrations
    • Google services
      • Connect your Google account
      • Google Sheets
        • Searching and updating Google Sheets data
        • Building galleries with Google Sheets data
      • Google Calendar
        • Searching for events
        • Creating and updating events
    • Shopify
    • WooCommerce
    • Dialogflow
      • Building an agent
      • Using entities
      • Slot filling
      • Context management
      • E-commerce NLP
Powered by GitBook
On this page

Was this helpful?

  1. Visual builder reference
  2. Conditional logic

SWITCH

PreviousConditional logicNextTimers and delays

Last updated 3 years ago

Was this helpful?

Smart chatbots take decisions and behave differently in different situations. Flexibility is a key factor in creating a bot that will be really useful and engaging.

To achieve this in Activechat you can use the SWITCH block. When executed, it will check specific for certain conditions and route the flow to different parts or skills of your bot conversation according to these conditions.

Using SWITCH block to check for multiple conditions

To set up conditional branching, open the SWITCH block editor by clicking the block on the canvas and choosing the name of the user attribute to check. In the example above chatbot will check the $user_age attribute (acquired somewhere else with the block) to branch conversation depending on its value.

Each condition in the SWITCH block has it’s own “button” which can be used to trigger other block flows (just connect it to another block with an arrow).

If none of the conditions are met, the conversation will proceed to the next block that is connected to the bottom of the SWITCH block.

You can build complex conditions with AND/OR – just click the dropdown list on the right.

Possible checks are:

  • > (greater than)

  • < (less than)

  • >= (greater or equal)

  • <= (less or equal)

  • == (equals)

  • != (not equals)

  • ∈ (contains)

  • ∉ (does not contain)

Keyword detection

You can add up to 10 different conditions in a single SWITCH block. If you need more, just connect another SWITCH block to the bottom exit of the first one.

Please keep in mind that different conditions are evaluated top to bottom, in the order they appear in the SWITCH block editor. It means that if you want to check for “car” and “cart” separately and use ∈ (contains), put “cart” first. Otherwise, both keywords will trigger the “car” check since “car” is contained within “cart”.

“Contains” and “does not contain” checks are great for keyword detection. Here is another example of the , checking the value of $_last_user_input to trigger different when the user is typing specific keywords. Notice the use of blocks to trigger and launch .

Keyword detection with the SWITCH block
“default” chatbot skill
system attribute
chatbot skills
SEND
chatbot events
skills
user attribute
LISTEN