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
  • Live chat with the chatbot admin
  • Initiating the conversation
  • Checking the status of the admin user
  • Delaying the delivery if the admin is busy
  • Forwarding the message to the admin and waiting for the response
  • Displaying the response to the user
  • Next steps

Was this helpful?

  1. Help Guides
  2. Managing conversations

Notifications with the TRIGGER block

PreviousTriggering live chat sessions from the botNextManaging knowledge

Last updated 3 years ago

Was this helpful?

Since the can be used to trigger specific for any user of the chatbot, we can use it to send two-way chatbot notifications to other users or even perform some background tasks like affiliate tracking. Let’s look into a couple of simple examples.

Live chat with the chatbot admin

There is a number of use cases when one chatbot user would like to send a message to another. Think of match-making chatbots, for example, or a delivery service chatbot where couriers would like to send updates to customers.

We’ll look into a simple example, using a block to establish two-way communication between different chatbot users – a regular user and a chatbot admin.

When a chatbot user wants to send a message to the admin (asking a question, for example), we’ll do a number of simple tasks:

  1. Check if the admin is available (not engaged in conversation with another chatbot user already). If he’s not, we’ll send a message to the user and wait for a couple of minutes to try again.

  2. If the admin is available, we’ll forward him/her the message from the chatbot user and wait for the response. Once the admin replies, we’ll forward the response to the original user.

Here’s the list of that we’ll use to achieve this (we’ll be triggering them for admin and for the user with the block):

  • check_admin (triggered on admin’s side) – this skill will check if admin is available

  • admin_delay (triggered on user’s side) – this skill will display the “Admin busy…” message to the user and wait before re-trying the check again

  • ask_admin (triggered on admin’s side) – this skill will send the user’s message to the admin and wait for the admin’s response

  • admin_answer (triggered on the user’s side) – this skill will display the admin’s reply to the user.

We’ll use the $admin_state attribute to track the current state of the chatbot admin – it will be either “busy” (if admin is unavailable or busy with another conversation) or “free”.

Initiating the conversation

When the user wants to send a message to the chatbot admin, we’ll just start the “check_admin” skill for the user with admin’s ID:

Triggering “check_admin” skill on user’s request

Once this part is executed, the chatbot is set to idle for the user sending the message, but some action starts happening for the admin. Let’s look into it in detail.

Checking the status of the admin user

First of all, we need to check if the admin is already answering a message from another user (the admin can only be talking to a single user at the moment). We’ll check the value of the $admin_state attribute and if it’s not “free”, we’ll send back the “admin_delay” event to originating user, starting a delay skill for him/her.

Otherwise, we’ll proceed to the “ask_admin” skill to wait for the admin’s response to the user’s question.

Notice the use of the $uid attribute – it was set by the TRIGGER block above and holds the messenger ID of the user who sent the message to the admin.

Delaying the delivery if the admin is busy

If the admin is already communicating with another chatbot user, we’ll notify the user about it and re-try sending the message in a couple of minutes. This is done in the “admin_delay” skill triggered in the previous step.

Forwarding the message to the admin and waiting for the response

Once the admin is available, we’ll forward the user’s message to him/her and wait for the response, and then deliver that response back to the originating user.

We start this skill by setting the $admin_state attribute to “busy” so that if other users send messages to the admin while this skill is running, these messages will not interrupt it (due to the logic we implemented in the “check_admin” skill). Then we display a TEXT block, using attributes acquired from the TRIGGER block:

A question from $fname $lname ($uid): $message Type your answer below.

This is how the message is composed

$fname, $lname, $uid, and $message attributes were set by the TRIGGER block from the initiating user in the “default” skill before:

The result displayed to the admin will be something like this:

Finally, we’ll set $admin_state back to “free” to make this skill available for other chatbot users.

Displaying the response to the user

Finally, let’s see how these two-way chatbot notifications can be displayed back to the user who started the conversation.

We’re using some attributes here (set by the TRIGGER block from the admin’s side) to let the user know the name of the admin and what his/her response was.

Next steps

So, with less than 30 blocks we managed to build a powerful two-way chatbot notifications mechanics, allowing any chatbot user to send questions to the admin and receive his/her answers.

With some imagination, you can easily upgrade this to allow even more features:

  • multiple admins, assigned randomly or by user tags

  • expanding the conversation to multiple messages from each side

  • storing the conversation history in the Google Sheets

  • etc

The sky is the limit with Activechat, so explore your options today!

Notice that the block allows us to send a number of parameters together with the “check_admin” event. These parameters will become attributes for the admin user, and we’ll be using them to send the user’s name, message, and ID.

Sending the “admin_delay” event back to originating user
Delaying the delivery of user’s message if the admin is busy
Waiting for the admin’s answer to the user’s question
Setting multiple attributes for another chatbot user before triggering the event
Example of the user’s message delivered to the chatbot admin

Once the message is displayed to the admin, the bot will use the block to receive the response, and then trigger the “admin_answer” skill for the originating user to display that response.

Displaying admin’s response to the user
TRIGGER
LISTEN
TRIGGER block
TRIGGER
chatbot skills
TRIGGER
events