Workflow Components

Triggered Overview

The Workflow module in CX Genie enables teams to automate customer interactions across channels such as Facebook Messenger, Telegram, and Website. Each workflow is made up of blocks that determine how and when actions happen, based on triggers and logic.

Workflows are used to automate responses, collect information, escalate to agents, and personalize user journeys — all without manual intervention.

This documentation provides a full guide on how to configure a workflow, trigger conditions, and supported block types.


Steps to Use

Step 1: Create a Workflow

  1. Go to the Workflow section in the CX Genie dashboard.

  2. Click “Create New Workflow”.

  3. Enter a unique name for the workflow.

Step 2: Select Channels

Choose the channels where this workflow will be active:

  • Facebook Messenger

  • Telegram

  • Website

You can select only one channel at the same time.

Step 3: Define Trigger Condition

Each workflow must have only one trigger condition. It defines when the workflow will run. Available types:

  • When user chat – When user sends a message

  • When user intent – Based on detected intent

  • Contain keyword – Match predefined keywords

  • Trigger by tag – Based on tag applied

  • Trigger by action – Triggered by user or agent actions:

    • When the bot does not know the answer

    • When the agent closes the ticket

    • When the agent closes the customer's conversation

    • When a new conversation is created

    • When a conversation is closed

    • When the agent replies to the customer's message

Figure 1. Trigger by action

Only one condition is allowed per workflow, and cannot be duplicated across workflows.

Figure 2. How to create new workflow

Step 4: Build Workflow with Blocks

Use blocks to define the automation flow. You can:

  • Drag and drop blocks into the visual canvas

  • Connect them to define the flow logic

  • Click the Preview button to simulate the flow and see how blocks are arranged and executed

Step 5: Publish the Workflow

Once the flow is ready:

  1. Click the “Publish” button in the top right corner.

  2. A published workflow is now live and will be triggered when its condition is met.

Figure 3. An Example of workflow

Step 6: Export (Optional)

You can export the workflow as a .json file at any time — even if the workflow is still in draft mode.

This is useful for:

  • Reusing the workflow in other bots

  • Creating template libraries for your team

  • Backing up workflows for version control

✅ No need to publish before exporting. Drafts can be exported as well.Step 7: [Optional] Use Dynamic Variables

Figure 4. Export Available Workflow

Step 7: Use Dynamic Variables (Optional)

If your workflow requires data from external APIs (e.g., product name, price, etc.), you can define Dynamic Variables to fetch and reuse them inside blocks.

👉 See Dynamic Variable for full guide.

Dynamic Variables

Overview

Dynamic Variables allow your workflow to dynamically fetch and reuse external data (usually from APIs). You can inject them into blocks to personalize messages, make logic decisions, or display product results.

They can be created ahead of time or while configuring blocks.


How to Create

  1. Open the Create Dynamic Variable modal.

  2. Fill in the required fields:

    • Variable name

    • Code (snake_case)

    • Type – usually API Information

    • API URL

  3. Choose one of two return strategies:


🅐 Specified Result

Use when you want to extract a specific field from the API response.

Field
Description

Result data

e.g., data.product.name


🅑 Random Result

Use when the response is an array and you want a random item.


Field
Description

Random Target

e.g., data.items

Selected Attribute

e.g., price from each random object

Workflow version

Overview

The Version History feature in the CX Genie Workflow module allows users to view, track, and manage different published versions of each workflow. This is essential for teams working collaboratively or for users who need to roll back changes and maintain a history of chatbot flow modifications.


Steps to Use

Step 1: Open an existing Workflow

  • Go to the Workflow module from the left sidebar.

  • Click the edit icon ✏️ on any workflow in the list.

Step 2: Access the Version History panel

  • Inside the workflow editor, click the Version history button located in the top-left corner.

  • A side panel will open showing all the previously published versions.

Step 3: View available versions

  • If the workflow has been published before, each version will appear in a list with timestamp details.

  • If no versions are available, a “No data” message will be shown.

🔄 Version history is only created after a Publish action.


Notes

  • The version list only includes published versions.

  • The current version can be choosen.

  • Support for rollback or comparison between versions.


Blocks Reference

👉 See the detailed list in the Workflow Blocks Structured Documentation


Workflow Block Details

CX Genie – Workflow Blocks Documentation

1. Text & Image

Overview

Create a message that includes both text and an image to send to the user.

Steps to Use

  1. Add this block to your workflow using the visual editor.

  2. Configure its options as needed (e.g. message content, conditions, variables).

  3. Connect it to the previous and next blocks appropriately.

Notes

  • Has 2 connectors: receives logic and passes it forward.

  • Executes instantly without waiting or requiring user input.

Figure 1. Text & Image Block

2. Message with Actions

Overview

Send a message that contains interactive action buttons

Steps to Use

  1. Add this block to your workflow.

  2. Configure its options as needed (e.g. message content, conditions, variables).

  3. Connect it to the previous blocks appropriately.

Notes

  • Has only 1 connector (input) — cannot connect to next block.

  • Starts countdown only if the customer does not interact.

  • If the user responds, timeout is canceled. Otherwise, it ends silently.

  • This block supports “Require to continue” toggle:

If enabled: requires interaction to proceed

Figure 2. Message with actions block

3. Saved Flow

Overview

Redirect to a pre-built saved flow to continue the current conversation path.

Steps to Use

  1. Add this block to your workflow using the visual editor.

  2. Configure its options as needed.

  3. Connect it to the previous blocks appropriately.

Notes

  • Has only 1 connector (input) — does not pass logic forward.

  • Executes a standalone action and ends the path here.

Figure 3. Saved flow block

4. Collect Feedback

Overview

The Collect Feedback block allows you to request user ratings at the end of a conversation. It presents a visual scale (emoji-based, heart, or star) for customers to rate their experience. This helps you measure satisfaction and gather actionable insights.

You can customize:

  • The message content

  • The icon style (😍 / ❤️ / ⭐)

  • Whether completion is required before continuing

  • A timeout to proceed if the user doesn’t interact

Figure 4. Collect feedback block

Steps to Use

  1. Drag the Collect Feedback block into your workflow.

  2. Enter a message asking for feedback (e.g. “How was your experience?”).

  3. Choose an icon style (Emoji, Heart, or Star).

  4. Optionally configure:

    • Form completion is required before continuing — the user must rate before the flow continues.

    • Wait timeout — auto-continue after a set time if the customer doesn’t respond.

  5. Connect it to the next block in the flow.


Example / Use Case

  • After a live support session, collect customer satisfaction ratings.

  • Combine with tagging or analytics to track feedback trends and agent performance.


Notes

  • Connectors: 2 (input + output)

  • Timeout supported: Yes

    • If no interaction within the set time, the flow proceeds.

  • Require to continue toggle: Optional

    • If enabled: requires user to complete feedback to proceed.

    • If disabled: timeout can auto-advance the flow.


5. Notify Agent

Overview

The Notify Agent block sends a push notification to human agents when a customer message reaches this step in the workflow. This is useful to alert specific people or teams for immediate attention without interrupting the flow.

You can choose to:

  • Notify all agents (default)

  • Or target specific agents or teams manually

Figure 5. Notify agent

Steps to Use

  1. Drag the Notify Agent block into your workflow.

  2. (Optional) Enable the toggle “Allow selection of specific agents to get notification”.

  3. Choose one or more:

    • Individual agents

    • Teams (e.g., Sales team, Support team)

  4. Connect the block to the next step in the flow.

📌 If toggle is off, all available agents in the workspace will receive the notification.


Example / Use Case

  • Alert a live chat agent when the bot can’t answer a question.

  • Ping the order team when a customer completes a form.

  • Notify a dedicated support rep for VIP users.


Notes

  • Connectors: 2 (input + output)

  • Timeout supported: No

  • Flow continues immediately after the notification is sent.

  • The notification does not pause the workflow — it runs in parallel.


6. Form Submit

Overview

The Form Submit block is used to collect structured customer information during a workflow. You can either:

  • Use the default form with predefined customer properties (e.g. name, email), or

  • Use a custom form created in the Form Builder module

Submitted data can be sent to a backend endpoint via POST, saved as a variable, or both.

Figure 6. Form submit block

Steps to Use

  1. Drag the Form Submit block into your flow.

  2. Write a message content that will be shown when sending the form.

  3. Choose one of the two data collection options:

    • Use default:

      • Attach common customer fields (name, email, phone, etc.)

      • Specify a backend URL (optional) and security token

    • Use custom form:

      • Select an existing form created in Form Builder

  4. (Optional) Enable:

    • “Form completion required before continuing”: forces the customer to complete the form

    • “Save result as variable”: store submitted data for reuse later

    • “Wait” timeout: auto-continue after a defined period if the customer doesn't respond

  5. Connect this block to the next step in your workflow.


Example / Use Case

  • Collect customer's email and phone for follow-up

  • Send structured lead info to CRM via API

  • Display a tailored form based on prior answers (with conditional logic)


Notes

  • Connectors: 2 (input + output)

  • Timeout supported: Yes

    • If enabled, the system will wait for user input.

    • If no interaction after timeout, proceeds to next block.

  • Require to continue: Optional

    • When enabled, user must submit the form to move forward.

  • Supports both default fields and custom-designed forms.

  • Accepts dynamic variables in the message or API fields.

  • Only available when purchasing the add-on or LTD packages


7. Turn off Auto Reply

Overview

The Turn off Auto-reply block disables the bot’s auto-response for the current conversation.

Once this block is triggered, the bot will stop replying automatically, allowing agents to take over manually if needed.

⚠️ This block does not affect conversations where auto-reply has already been turned off earlier.

Figure 7. Turn off auto-reply block

Steps to Use

  1. Add the Turn off Auto-reply block into your workflow.

  2. Connect it after the point where you want the bot to stop responding.

  3. No further configuration is needed — it acts immediately when triggered.


Example / Use Case

  • Stop bot messages once a human agent is assigned

  • Disable auto-replies when the user asks for a live person

  • Use before transferring the conversation to an external channel

Notes

  • Connector: 1 (input only)

  • Once triggered, it turns off auto-reply for this conversation.

  • This block does not continue to the next step.

  • Auto-reply stays off for the remainder of the conversation unless re-enabled in Help Desk/Livechat.


8. Close Conversation

Overview

When triggered, the Close Conversation block automatically ends the current chat session or ticket. It is typically used at the end of a workflow to signal that no further interaction is needed.

Once this block is reached, the conversation will be marked as closed in the system.

Figure 8. Close conversation block

Steps to Use

  1. Add the Close Conversation block to the end of your workflow.

  2. No additional configuration is required.

  3. It will execute automatically and stop the flow when triggered.


Example / Use Case

  • End a conversation after feedback is submitted

  • Automatically close the conversation after an issue is resolved


Notes

  • Connector: 1 (input only)

  • This block does not continue to another step — it ends the flow.

  • Timeout is not supported

  • Closing is applied only to the current session


9. Conversation Language

Overview

The Conversation Language block determines the language used throughout the conversation. It supports two modes:

  • Auto-detect: Detects the customer's language based on location or browser settings.

  • Manual selection: Allows the customer to choose their preferred language from a predefined list.

This block is typically placed early in the workflow to ensure proper localization of all following messages.

Figure 9.1 Conversation language block (Auto-dectect language mode)
Figure 9.2 Conversation language block (Manual selection mode)

Steps to Use

  1. Drag the Conversation Language block into your workflow.

  2. Choose a language setting mode:

    • Auto-detect language: No user input is needed.

    • Manual selection:

      • Select available languages to show.

      • (Optional) Enable “Required to select to continue conversation” to force user selection.

  3. (Optional) Enable the Wait option to set a timeout duration. If the customer does not select a language within that time, the flow continues automatically.

  4. Connect this block to the next step in the conversation.


Example / Use Case

  • Automatically detect language for international customers

  • Offer a language picker (EN, VI, JA, etc.) at the beginning of a chatbot flow

  • Combine with translation logic to dynamically localize messages


Notes

  • Connectors: 2 (input + output)

  • Timeout supported: Yes

    • If the user doesn’t interact, the system continues after the timeout.

  • Require to continue (manual mode only): Optional

    • If enabled, it forces the user to select a language before proceeding.

  • Dynamic language selection may impact which message variations are sent later in the workflow.


10. Recap Chat Message

Overview

The Recap Chat Message block allows the system to generate a summary of the entire conversation and send it to the customer’s email. This is often used at the end of a support flow to give users a full record of their interaction.

The recap includes:

  • All relevant messages exchanged in the session

  • Agent and bot responses

Figure 10. Recap chat messsage block

Steps to Use

  1. Insert the Recap Chat Message block at the appropriate point in your flow (typically at the end).

  2. No manual configuration is needed — the system will:

    • Automatically collect the full conversation

    • Format it into a recap email

    • Send it to the customer’s email

  3. Connect it to a terminal block if needed (optional).


Example / Use Case

  • Send a summary of the conversation once it has been completed

  • Use in workflows that handle escalations or transactions


Notes

  • Connectors: 2 (input + output)

  • When triggered, this block generates a recap of the entire conversation and sends it to the customer’s email.

  • The flow will continue to the next block after the recap is sent.

  • Requires customer_email to be available in order to deliver the email.

  • Timeout is not supported


11. Frequent Question

Overview

The Frequent Question block displays up to 5 commonly asked questions from your knowledge base. This helps guide users toward quick answers without needing to ask the same thing repeatedly.

It’s useful in onboarding, troubleshooting, or as fallback when the bot isn’t sure how to respond.

Figure 11. Frequent question block

Steps to Use

  1. Drag the Frequent Question block into your flow.

  2. Enter a message prompt to ask users what they need help with.

  3. Use the dropdown to select up to 5 questions from your knowledge base.

  4. (Optional) Enable:

    • Require user select question to continue the flow: forces the user to click before proceeding.

    • Wait: auto-continue if no response within a set time.

  5. Connect this block to the rest of your workflow (note: only input is supported).


Example / Use Case

  • “How can I help you today?” → Offer top questions to let the user self-serve

  • Serve as a fallback when the bot doesn't understand the previous input

  • Pre-qualify customers before routing them to an agent


Notes

  • Connector: 1 (input only)

  • Output is not supported — this block does not continue the flow directly.

  • Timeout supported: Yes

    • If no interaction happens within the timeout, the flow continues if connected via external logic.

  • Require to continue: Optional

    • If enabled, the user must select a question to proceed.

  • Linked questions are displayed as quick replies and pulled from the knowledge base.


12. Capture Customer Info

Overview

The Capture Customer Info block allows you to collect key customer details directly in the flow. You can choose specific fields (e.g. name, phone number) and optionally update these into the customer profile automatically.

This block helps reduce manual data entry and keeps your CRM updated in real time.

Figure 12. Capture Customer Info

Steps to Use

  1. Drag the Capture Customer Info block into your workflow.

  2. Select which fields to collect:

    • name

    • email

    • phone number

    • address

    • gender

  3. (Optional) Configure the following:

    • Form completion required before continuing: ensures user submits info before proceeding

    • Wait timeout: proceeds automatically if user doesn't respond within set time

    • Save Customer Info toggle: enables auto-updating collected fields to the customer profile

  4. Connect this block to the next step in your flow.


Example / Use Case

  • Ask for missing user information before routing to support

  • Collect email or phone for follow-up

  • Update user records in real-time without manual syncing


Notes

  • Connectors: 2 (input + output)

  • Timeout supported: Yes

    • If timeout is enabled, the block will proceed even if the customer doesn’t fill in the info.

  • Require to continue: Optional

    • When enabled, the flow only moves forward after form completion.

  • Save Customer Info: If enabled, all selected fields are saved directly to the customer profile (customer_name, customer_email, etc.)


13. Create Ticket

Overview

The Create Ticket block allows you to generate a new support ticket during the conversation. The ticket is submitted with a message and saved in your system for agents to review and resolve later.

You can optionally send a ticket link back to the customer after creation.

Figure 13. Create ticket

Steps to Use

  1. Add the Create Ticket block to your flow.

  2. Enter a ticket name (supports dynamic variables like {{customer_name}}).

  3. Write the message content that will be included in the ticket.

  4. (Optional) Enable "Send ticket link to customer" to let them view it directly.

  5. Connect to the next step in your flow.


Example / Use Case

  • Log unresolved bot questions for agents to follow up

  • Create support tickets for order issues, account problems, or special requests

  • Trigger human intervention while maintaining ticket history


Notes

  • Connectors: 2 (input + output)

  • Timeout supported: No

  • The ticket will be created instantly with the provided information.

  • If the “Send ticket link to customer” option is enabled, a clickable link will be sent to the chat.

  • Ticket data can be combined with dynamic variables like {{customer_email}} or {{last_message}}.


14. Auto-tagging

Overview

The Auto-tagging block allows the system to automatically assign predefined tags to the conversation based on detected intent or keyword matches. Tags help categorize, route, or track conversations more effectively.

Each tag can have an optional description to help the chatbot understand and assign them more accurately.

Figure 14. Auto-tagging block

Steps to Use

  1. Add the Auto-tagging block into your workflow.

  2. Define tags under the Tags list tab:

    • Give each tag a name (e.g., “New Customer”, “Order Issue”)

    • (Optional) Add a description to help improve classification logic

  3. Tags can be managed via:

    • 📝 Edit icon (pencil) to rename or update description

    • 🗑 Delete icon (trash) to remove the tag

  4. The system will evaluate the conversation and assign tags if matching logic is met.

  5. Connect this block to the next step in your flow.


Example / Use Case

  • Tag conversations with “New Customer” if the user asks about onboarding

  • Assign “Shipping Delay” if the user complains about delivery

  • Help agents filter or search by topic automatically


Notes

  • Connectors: 2 (input + output)

  • Timeout supported: No

  • Tag logic is handled automatically; no user interaction is required

  • Tagging does not interrupt the flow and continues immediately


15. Category

Overview

The Category block allows you to show a list of categorized choices to the user. Each choice (called a Selection) can trigger a different branch in the workflow. This is ideal for routing conversations based on user intent.

You can create up to 15 selections, and each one links to a specific category, allowing custom logic paths for each choice.

Figure 15. Category block

Steps to Use

  1. Drag the Category block into your workflow.

  2. Enter a message prompt to ask the user to make a selection.

  3. Add one or more Selections:

    • Each selection includes:

      • A Label (displayed to the user)

      • A mapped Category (used internally for routing)

  4. (Optional) Enable:

    • “Require user to select a category to continue the flow” — forces interaction

  5. For each category, connect the output dot to the next appropriate block.


Example / Use Case

  • Ask users what they need help with (e.g., “Product Support”, “Billing”)

  • Route leads based on interest type (e.g., “Book a Demo”, “View Pricing”)


Notes

  • Input connectors: 1 (left side, to receive flow)

  • Output connectors: 1 per category (right side of each selection)

  • Timeout supported: No

  • Required to continue: Optional

    • If enabled, the user must select one before the flow continues.

  • Maximum 15 selections supported


16. Auto-assign Agents

Overview

The Auto-assign Agents block automatically assigns the conversation to an agent using the Round Robin method. You can assign by team, or limit the assignment to specific team members.

This ensures a fair and automated distribution of workload across support agents.

Figure 16. Auto-assign agents block

Steps to Use

  1. Drag the Auto-assign Agents block into your workflow.

  2. Select a team from the dropdown to assign conversations to.

  3. (Optional) Enable “Select specific team members to assign”:

    • Choose which members will be eligible for auto-assignment.

    • If enabled, the system ignores max concurrent chat limits.

  4. Connect to the next block to continue the conversation after assignment.


Example / Use Case

  • Distribute live chats evenly across agents in a team

  • Assign onboarding conversations to a dedicated success team

  • Route VIP customers to a select group of experienced agents


Notes

  • Connectors: 2 (input + output)

  • Timeout supported: No

  • If no available agent in the selected group, the conversation stays unassigned.

  • Round Robin logic ensures even load balancing between available agents.

  • When specific members are selected, the maximum concurrent chat limit is bypassed.


17. Route

Overview

The Route block is used to conditionally route the conversation based on the value of a variable. You define a list of possible values, and each one can trigger a different path in the workflow.

This is ideal for branching logic based on previous answers, dynamic variables, or API responses.

Figure 17. Route

Steps to Use

  1. Add the Route block into your workflow.

  2. In the Input variable field, specify the variable to check (e.g. category_selected, customer_type).

  3. Define the possible Values that this variable can take.

    • Each value creates a separate output connector.

    • Click Add value to include more conditions.

  4. (Optional) Enable the “Other” toggle to handle all unmatched cases via a fallback path.

  5. Link each output to its respective next step in the workflow.


Example / Use Case

  • Route users based on subscription plan (free, pro, enterprise)

  • Create different flows for lead_type = hot vs cold

  • Use dynamic API return value to direct logic conditionally


Notes

  • Connector: 1 input (left side)

  • Output connectors: 1 per defined value, plus optional "Other"

  • Timeout supported: No

  • Supports both static and dynamic variable values (via {{variable_name}})

  • Flow will follow the first matching value


18. Smart Product Query

Overview

The Smart Product Query block uses the current conversation context to extract the top 5 products the customer is most interested in. It leverages AI to interpret the user's intent and automatically query your store database.

You can choose to send a default AI-generated product message, or customize your own format to control how the product is shown to the user.

Figure 18. Smart Product Query block

Steps to Use

  1. Insert the Smart Product Query block into your workflow.

  2. Select the Store source:

    • Supported platforms: Shopify and WooCommerce (see it how to integrate)

  3. Choose how to respond:

    • Auto send message: bot will immediately send call out results to the customer

    • Custom message: this field lets you format the result using dynamic variables (e.g. show name, price, image)

  4. (Optional) Enter a variable name to store the query result (used in later blocks).

  5. Connect the block to the next block in your flow.


Example / Use Case

  • Recommend relevant products after a customer asks “Do you have running shoes?”

  • Use custom format to embed product links and layout

  • Store results in a variable for filtering, routing, or tagging later


Notes

  • Connectors: 2 (input + output)

  • Timeout supported: No

  • The bot returns a list of up to 5 product objects matching the user’s request.

  • You can custom format the result message using the Custom message field.

  • Result variable can be used in later logic or display.

Result Variable Structure

[
  {
    "id": "string",
    "status": "string",
    "name": "string",
    "description": "string",
    "brand_name": "string",
    "category_name": "string",
    "tags": ["string"],
    "price": 0,
    "stock_quantity": 0,
    "image": "string",
    "images": ["string"],
    "link": "string",
    "currency": "string",
    "has_variant": true
  }
]

19. Follow-up Conversation

Overview

The Follow-up Conversation block allows the AI to proactively re-engage with customers by sending automated follow-up messages. This helps extend the conversation naturally, especially in cases where the user may have dropped off or not interacted for a while.

The message content is managed automatically by the system — this block does not require manual customization of the message.

Figure 19. Follow - up conversation block

Steps to Use

  1. Add the Follow-up Conversation block to your workflow.

  2. Place it after key interaction points where re-engagement may be useful.

  3. Connect this block to the next step in your flow to continue after the follow-up.


Example / Use Case

  • Gently prompt the customer to resume the chat if they paused too long

  • Boost lead conversion by re-engaging hesitant customers


Notes

  • Connectors: 2 (input + output)

  • Timeout supported: No

  • AI handles the follow-up content automatically — no message setup is required

  • Can be used multiple times in a long workflow to maintain engagement

  • Ideal for improving user retention in drop-off scenarios


20. Condition

Overview

The Condition block allows you to branch your workflow based on whether a condition is true or false. You can define logic manually using dynamic variables or choose from predefined options like agent availability.

This gives you fine-grained control over the direction of your customer flows.

Figure 20. Condition block

Steps to Use

  1. Drag the Condition block into your workflow.

  2. Choose how to define the condition:

    • Input condition: Manually enter a logic string using dynamic variables (e.g. {{customer.name}} is equal to John Smith).

    • Select condition: Pick from built-in options (e.g. “At least one human agent is online”).

  3. (Optional) Click the AI Generate button to receive logic suggestions based on your scenario.

  4. Connect the block:

    • TRUE output: Used when the condition is met.

    • FALSE output: Used when the condition is not met.


Example / Use Case

  • Route VIP users by checking if {{customer.type}} == vip

  • Show different flows based on user country or email domain

  • Only assign to an agent if at least one is available


Notes

  • Connectors:

    • 1 input

    • 2 outputs: TRUE and FALSE

  • Timeout supported: No

  • Conditions can reference variables set earlier in the workflow

  • “Input condition” mode supports AI-based logic suggestions

  • 🔹 Important: Conditions are only evaluated to control content logic (what users see or which block to go next). They do not apply to action execution (e.g. Assign Agent, Send Email).


21. AI Instruction

Overview

The AI Instruction block allows you to send a custom prompt to OpenAI. It uses the current chat context along with your prompt to generate a result from the AI.

This block is independent — it does not branch logic like Condition blocks. You simply collect and store the AI’s response for later use in the workflow.

Figure 21. AI Instruction block

Steps to Use

  1. Drag the AI Instruction block into your workflow.

  2. In the Prompt field, enter your instruction (e.g., “Summarize this message” or “Detect sentiment from customer input”).

  3. Under Select action with the result, choose Save as variable and enter a variable name (e.g., ai_result_summary).

  4. Connect to the next block using the output dot (→).


Example / Use Case

  • Use AI to extract key information from a message and store it

  • Ask AI to rephrase user input or translate text

  • Generate suggestions or options to display in future steps


Notes

  • This block does not support logic branching (no TRUE/FALSE outputs)

  • Must define a variable name to save the AI’s result

  • Output can be reused in future blocks like Send Message or Form

  • Connectors:

    • 1 input

    • 1 output


22. API Call

Overview

The API Call block allows you to fetch data from or send data to an external API (via GET or POST). It’s typically used to retrieve a result and either store it as a variable or send it directly to the customer during the conversation flow.

Figure 22. API Call block


Steps to Use

  1. Drag the API Call block into your workflow. A white block with 2 purple dots will appear.

  2. Configure the following fields:

    Step 1: Select Method

    • Choose between GET (retrieve data) or POST (send data).

    Step 2: Enter API URL

    • Example: https://api-staging.cxgenie.ai/api/v1/public-api/example

    Step 3: Add Header Object

    • Default includes:

      {
        "Authorization": "Bearer <your_token>",
        "Content-Type": "application/json"
      }
      
    • You can modify or add headers as needed.

    Step 4: Define Body (for POST)

    • Default:

      {
        "key": "string"
      }
      
    • Customize with dynamic data like {{customer.email}}.

  3. Choose how to process the Returned Result:

    • Specified Result: Extract a specific path from the response (e.g. data.purchase_history[0].items[0].product_name)

    • Random Result: Retrieve a random value from an array

    Example for Specified:

    • To extract the first product name in the first order:

      data.purchase_history[0].items[0].product_name
      

    Example for Random:

    • Random Target: purchase_history

    • Selected Attribute: order_id

    • Save as Variable: random_order

    The system will randomly return one order ID from the customer’s purchase history.

  4. Select action with the result:

    • ✅ Choose Save as variable

    • Enter a variable name (e.g. api_response or random_product)


Example / Use Case

  • Retrieve customer purchase history and show a product

  • Get shipping status from a third-party service

  • Check subscription level from CRM and store it for future logic

  • Randomly display one product from their previous purchases


Notes

  • Headers and body must follow a valid JSON structure

  • Dynamic variables (e.g., {{customer.email}}) are supported in both header and body

  • The API block does not control flow logic — use a Condition block if you need to act based on the returned value

  • Connectors:

    • 1 input (left dot)

    • 1 output (right dot)

  • Always click Save changes after configuration


23. Wait for chat

Overview

The Wait for chat block pauses the workflow until the customer sends a message. Once the message is received, the content will be saved into a variable and the workflow continues to the next block.

This block is useful for collecting user responses during a conversation, such as name, preferences, or other free-form input.

Figure 23. Wait for chat


Steps to Use

  1. Drag the Wait for chat block into your workflow.

  2. In the Settings panel, enter the variable name to store the customer’s reply.

    • Example: hi, user_input, product_choice

  3. Connect to the next step using the output dot (→) after this block.

  4. You can reuse the variable in any subsequent block by referencing {{your_variable_name}}.


Example / Use Case

  • Ask for the customer’s name and store it:

    • Message: “What’s your name?”

    • Wait for chat → store as: customer_name

    • Message: “Hello {{customer_name}}, how can I help you today?”

  • Gather product preference or free text reply from user


Notes

  • This block does not render any message on its own

  • It's commonly used after a message block, waiting for a reply

  • Internally, the system tracks if the user is at this block, and captures the next message into the defined variable

  • Connectors:

    • 1 input

    • 1 output (→ right side dot)


24. Smart DB Query

Overview

The Smart DB Query block allows the bot to connect to a database and automatically generate a SQL query based on the last 20 user messages.

Once connected, the system sends the generated SQL query to the selected database, executes it, and stores the result in a variable for later use.

The returned result is an array of rows from the database.

Figure 24. Smart DB Query


Steps to Use

  1. Drag the Smart DB Query block into your workflow.

  2. In the Settings panel:

    • Select database: Choose a configured PostgreSQL or MySQL database by setting up in Training Data

    • Save as variable: Enter a name for the variable where the results will be stored (e.g. query_result)

  3. Connect to the next block using the output dot (→).

  4. Use the result in subsequent blocks by referencing {{query_result}}.


Example / Use Case

  • Let the bot answer product-related questions by querying your inventory database

  • Let the user type “Show me my last 3 orders” → the bot generates a SQL query to fetch orders from MySQL/PostgreSQL

  • Display product stock level by querying inventory table automatically


Notes

  • Supports both PostgreSQL and MySQL

  • The query is auto-generated by the system based on user conversation — no need to manually write SQL

  • You only need to:

    • Select the database

    • Define a variable to hold the results

  • Returned data is an array of rows (objects)

  • Use this block in workflows where AI-driven SQL retrieval enhances dynamic user support

  • Connectors:

    • 1 input (left)

    • 1 output (→ right)


25. Connect to database

Overview

The Connect to database block allows you to run SQL statements on a selected database. You can either:

  • Write your own SQL manually (Type SQL), or

  • Use natural language to let the system auto-generate the query (Smart Query)

It supports both PostgreSQL and MySQL, and the result can be saved as a variable for use in following blocks.

Figure 25. Connect to database


Steps to Use

  1. Drag the Connect to database block into your workflow.

  2. In the Settings tab:

    • Select database: Choose from a list of pre-connected databases (PostgreSQL/MySQL).

    • Choose how you want to define the query:

      • 🔹 Type SQL:

        • Manually write your SQL statement in the editor provided.

        • Example:

          SELECT * FROM orders WHERE customer_id = {{customer.id}};
          
      • 🔹 Smart Query:

        • Type a natural language prompt (e.g. “Get the list of products in Europe”)

        • Click Generate Query to let the system convert it into a valid SQL statement.

  3. Set variable: Enter a variable name to store the result (required). This allows later blocks to use the query result via {{your_variable}}.


Example / Use Case

  • Manual SQL:

    • Insert a log:

      INSERT INTO logs (event, created_at) VALUES ('started_checkout', NOW());
      
  • Smart Query:

    • Prompt: “Get the name and price of all shoes in stock”

    • System generates:

      SELECT name, price FROM products WHERE category = 'shoes' AND stock > 0;
      

Notes

  • You must select a database before writing a query or using Smart Query

  • Smart Query is powered by AI and supports natural language input

  • Dynamic variables like {{customer.id}} are supported in SQL statements

  • Result is saved as an array of rows into the defined variable

  • Connectors:

    • 1 input (left)

    • 1 output (→ right)


27. JS Code

Overview

The JS Code block allows you to write and run custom JavaScript code that is executed on the client side. This is useful for manipulating data, performing calculations, or integrating with external services via API calls, parsing logic, or conditional handling.

It offers advanced customization for developers who need fine control over workflow logic.

Figure 27. JS Code block


Steps to Use

  1. Drag the JS Code block into your workflow.

  2. In the Settings tab:

    • Enter your JavaScript code into the editor field.

    • You can access dynamic variables from the conversation using {{variable_name}}, which are passed into the execution context.

  3. After execution, use standard JavaScript logic to:

    • Transform data and store it back into variables

    • Trigger or simulate actions

    • Prepare content for next steps

  4. Connect the output to the next block in the workflow using the right dot (→).


Example / Use Case

  • Format a phone number:

    const cleaned = input.replace(/\\D/g, '');
    return cleaned;
    
  • Calculate total from an array of prices:

    const total = prices.reduce((sum, p) => sum + p, 0);
    return total;
    
  • Send an API call using fetch (if supported by environment):

    fetch('<https://api.example.com/check>', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ email: user.email })
    }).then(res => res.json())
      .then(data => {
        return data.status;
      });
    

Notes

  • This block runs client-side JavaScript

  • You can read from and write to variables

  • Avoid long-running scripts or sensitive logic as it runs in the user's browser context (if client-side truly applies)

  • Best used for lightweight transformations, conditionals, or client integrations

  • Connectors:

    • 1 input

    • 1 output (→ right side dot)


28. Query to knowledge base

Overview

The Query to knowledge base block allows the bot to retrieve relevant answers from a connected knowledge base using semantic matching. It supports two modes:

  • Smart Query: Auto-generates a query from the last 20 messages in the conversation.

  • Query Value: Allows you to specify a query manually or via variable.

This block is used to enable AI-powered knowledge retrieval for FAQs, guides, and help articles.

Figure 28. Query to knowledge base block


Steps to Use

  1. Drag the Query to knowledge base block into your workflow.

  2. Choose your query mode:

    • 🔹 Use smart query: The system generates a query from the last 20 user messages.

    • 🔹 Use query value: Manually enter a query or a dynamic variable (e.g., {{user_question}}).

  3. In the Save as variable field, enter a variable name (e.g., kb_result) to store the matched results.

  4. Set maximum number of results (must be less than 10).

  5. Make sure a Knowledge Base is already trained in the bot; otherwise, this block will return no results.

  6. To display the result, use another block (e.g. Message block) and reference the result variable, like:

    Top answer: {{kb_result[0].answer}}
    

Example / Use Case

  • User says: “How do I reset my password?”

  • Smart Query detects intent and searches the knowledge base.

  • Top match (based on semantic distance) is saved into variable kb_result

  • Message block displays:

    Here's what I found: {{kb_result[0].answer}}
    

Notes

  • The returned result has the structure:

    {
      "question": "Question from user",
      "answer": "Answer from knowledge base",
      "distance": 0.95
    }
    
  • distance ranges from 0–1, where 1 is a perfect match

  • Results are returned as an array, even if there's only one

  • You must use another block to display or act on the result (e.g., Message or Condition)

  • The bot must have a Knowledge Base configured with content to search against

  • Connectors:

    • 1 input

    • 1 output (→ right side dot)


29. Branches

Overview

The Branches block is used to create conditional branches in your workflow. It allows you to define different execution paths based on the values of user attributes, message content, or other conditions.

This is useful when you want the bot to respond or behave differently depending on user data such as name, email, country, tags, etc.


Steps to Use

Step 1: Add the Branches block

  • In the Workflow builder, click the Branches icon from the left toolbar (flow control section).

  • A new Branches block will appear on the canvas.

Step 2: Define your conditions

  • Click on the block to open its settings panel.

  • Under Route list, click Add route and enter a name (e.g. "VIP User").

  • Define the condition using the dropdown fields:

    • Field: Name, Email, Phone, Country, etc.

    • Operator: is, is not, contains, starts with, is unknown, etc.

    • Value: The target value to match (e.g. Vietnam, John, etc.)

  • You can click + or / and to add alternative conditions within the same route.

Step 3: Add an Else path (optional)

  • The Else branch will be triggered when none of the specified conditions match.

Step 4: Connect each branch

  • Drag connection arrows from each branch (including Else) to the next block in the flow.


Example / Use Case

Scenario: You want to greet users differently based on their country:

  • Branch 1: If Country is Vietnam → Send Vietnamese greeting block

  • Branch 2: If Country is United States → Send English greeting block

  • Else: Send default greeting

This ensures personalized experiences based on known user information.


Notes

  • Conditions are evaluated top-down, and only the first matched condition will be triggered.

  • If multiple routes match, only the first route (by order) will execute.

  • The Else branch is optional but recommended as a fallback.

  • You can use tags, assigned team/agent, conversation categories, or even message content to route dynamically.


30. Remove Conversation Tag Block

Overview

The Remove Conversation Tag block allows you to automatically remove one or more existing tags from the current conversation. This is helpful for cleaning up tag-based logic, resetting conversation states, or managing user segmentation dynamically.

Tags are often used in automation, routing, and analytics — removing them at the right moment ensures clean and accurate data flow.


Steps to Use

Step 1: Add the Remove Conversation Tag block

  • In the Workflow builder, click the Remove Tag icon from the left toolbar.

  • A red-colored block will appear on the canvas with the label: Remove conversation tag.

Step 2: Configure tags to remove

  • Click on the block to open the Settings panel.

  • In the dropdown labeled Select tags, choose one or more tags you want to remove from the conversation.

    • Example tags: New Customers, Old customers, VIP, Chưa xử lý, etc.

📌 Only tags already attached to the conversation will be affected. Tags not present will be ignored silently.

Step 3: Connect to the next block

  • Drag a connection arrow to link this block to the next step in the flow.


Example / Use Case

Scenario: After a user completes onboarding, remove the New Customers tag so that future flows do not treat them as new users.

Workflow:

  1. Branch: If tag = New Customers

  2. Show Welcome Message

  3. Remove Conversation Tag: New Customers

This keeps the tag logic clean and avoids repeating onboarding content.


Notes

  • Tags removed by this block are conversation-level tags, not contact-level tags.

  • If the tag does not exist at the time of execution, the block still completes silently (no error).

  • You can remove multiple tags at once by selecting them in bulk.


31. Set customer tag

Overview

The Set Customer Tag block allows you to manually assign tags to a contact (not just the current conversation). These tags are persistent and remain even after a chat session ends, making them useful for long-term user profiling and segmentation.

This is especially helpful for CRM, marketing, or behavior-based automation workflows.


Steps to Use

Step 1: Add the Set Customer Tag block

  • In the Workflow builder, select the Set Customer Tag icon from the left toolbar.

  • A blue-colored block labeled Set customer tag will appear on the canvas.

Step 2: Choose or create tags

  • Click on the block to open the settings panel.

  • You'll see a list of existing Contact Tags.

  • Tick the checkbox next to any tag(s) you want to assign.

  • To add a new tag:

    • Click + Create Tag

    • Enter tag name and confirm.

🛠️ Tags are managed centrally under Contacts → Contact Tags in the main menu.

Step 3: Connect to next block

  • As with other blocks, drag the connector arrow to link this block to the next step in the flow.


Example / Use Case

Scenario: You want to label users who provide feedback as “Engaged Users”.

Workflow:

  1. User completes feedback form

  2. Trigger Set Customer Tag block → apply Engaged Users

  3. Move to thank-you message

The tag will remain on their profile permanently and can be reused for future targeting or logic.


Notes

  • These are Contact-level tags, not session/conversation tags.

  • Tags applied via this block will remain even after the chat ends.

  • Useful for long-term segmentation such as: VIP, Trial User, Has Purchased, Support Risk, etc.

  • You can manage the full list of contact tags via: Contacts → Contact Tags in the left navigation panel.


32. Remove Customer Tag

Overview

The Remove Customer Tag block allows you to remove one or more tags from the contact profile (not just from a conversation). This is useful for managing long-term segmentation and cleaning up outdated or temporary customer labels.

Unlike conversation tags, customer tags are persistent and stored at the contact level, so this block is used to manually unassign them when needed.


Steps to Use

Step 1: Add the Remove Customer Tag block

  • In the Workflow builder, click the Remove Customer Tag icon from the left toolbar.

  • A red-colored block labeled Remove customer tag will appear on the canvas.

Step 2: Choose tags to remove

  • Click on the block to open the Settings panel.

  • From the dropdown, select one or more customer tags you want to remove.

    • Examples: Feedback, Hoàn thành, Khách giao hàng, etc.

  • You can scroll or search through the list of tags.

Step 3: Connect to next block

  • As with other blocks, use the connector to link this block to the next action in the flow.

🧩 Tags listed here are created and managed in the Contacts → Contact Tags section.


Example / Use Case

Scenario: After a user finishes their second purchase, you may want to:

  • Remove the tag First-time Buyer

  • Assign a new tag Returning Customer

Your flow would include:

  1. Remove Customer Tag: First-time Buyer

  2. Set Customer Tag: Returning Customer

This keeps your contact segmentation up to date automatically.


Notes

  • These are contact-level tags, not session-specific.

  • Removing a tag does not delete the tag from the system — it only unassigns it from the specific contact.

  • If the selected tag is not currently applied to the user, the block simply skips without error.

  • Tags are managed centrally in the Contacts → Contact Tags module.


Last updated