Skip to Content
TutorialHow to Build an AI Content Classifier?

How to Build an AI Content Classifier?

https://editor.momen.app/tool/rmLyJ0Z0g6o/WEB?code=vOfYHu1Yu7tXe

Introduction

  • Goal: Automatically classify user feedback using AI and save the results to a database.
  • Applicable Scenario: Customer service automation, sentiment analysis for support tickets, or automated feedback sorting.
  • Core Logic: Capture user input through a Text Input -> Trigger a backend Actionflow -> Invoke an AI Agent with a structured output schema -> Insert the analyzed results (category, urgency, sentiment) into the database.

Steps

Data Storage

Create a table to store both the original feedback and the metadata generated by the AI.

  • Data Model (Table Name: ticket):
Field NameTypeNote
descriptionTextOriginal feedback provided by the user.
categoryTextAI-determined category (e.g., Billing Issue, Technical Support).
urgencyTextAI-determined priority level (High, Medium, Low).
is_positiveBooleanSentiment analysis (True for positive/neutral, False for negative).


Logic & State Configuration

AI Agent Configuration

Navigate to the AI tab and create an AI Agent to handle the classification logic.

  • Agent Name: Agent_feedback
  • Inputs: Add an input named description (Type: Text).
  • Prompt Template: Define clear rules to ensure the AI understands the business logic.
  • Outputs (Structured):

Tip: You must select Structured output mode. This ensures the AI fills out a predefined “form,” providing valid JSON that the backend can process directly.

Define the following fields:

  • category (Text, Required)
  • urgency (Text, Required)
  • is_positive (Boolean, Required)
AI Agent Configuration 1AI Agent Configuration 2

Actionflow Construction

Create an Actionflow to connect the UI, AI, and Database.

  • Actionflow Name: AI Content Classifier

  • Trigger/Input: Add a text input named description.

  • Execution Mode: Async (Required for running AI nodes effectively).

  • Action Steps:

    1. AI - Start Conversation:
      • Select Agent: Agent_feedback.
      • Binding: Map description to Actionflow data -> Input -> description.
    2. Database - Insert Data:
      • Table: ticket.
      • Field Bindings:
        • description: Actionflow data -> Input -> description.
        • category: AI node -> data -> category.
        • urgency: AI node -> data -> urgency.
        • is_positive: AI node -> data -> is_positive.


UI Construction & Interaction

Component Tree

  • Page
    • Text Input
    • Button

Configuration Details

  • Button Interaction:
    • Trigger: OnClick
    • Action: Run Actionflow -> AI Content Classifier.
    • Data Binding: Bind the description parameter of the Actionflow to Inputs -> Text Input -> Value.


Verification

  • Preview Checklist:
    1. Open Preview mode.
    2. Enter “The app keeps crashing” into the Text Input.
    3. Click the Button.
    4. Navigate to Data Source -> Database -> ticket table.
    5. Verify a new record exists:
      • category: “Technical Support”
      • urgency: “High”
      • is_positive: false

Last updated on