> ## Documentation Index
> Fetch the complete documentation index at: https://docs.blueberry.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Automated Rules Engine

> Automate comment responses with AI and custom rules

## Overview

The Rules Engine automates comment moderation and responses using AI-powered rules or traditional keyword-based conditions.

Choose between letting AI understand context and intent, or create specific keyword rules for exact scenarios.

<Note>
  Rules execute automatically without manual review, saving hours of repetitive work while
  maintaining brand consistency.
</Note>

## Rule Types

<Tabs>
  <Tab title="LLM Rules (Recommended)">
    AI-powered rules that understand context, intent, and nuance rather than exact keywords.

    **How it works:**

    * Describe what you want in plain English
    * AI analyzes comment meaning and context
    * Handles variations and edge cases automatically
    * Learns from your brand voice and guidelines

    **Example:**

    > "Reply to any comment asking about pricing with product information"

    The AI understands "how much?", "what's the cost", "price check", etc. without needing to list every variation.

    <Check>
      LLM rules are more flexible and require less maintenance than traditional keyword rules.
    </Check>
  </Tab>

  <Tab title="Category Rules (Recommended)">
    Rules based on Blueberry's automatic comment categorization (Positive, Product Qs, Brand Risk, Negative, Spam, Other).

    **How it works:**

    * AI automatically categorizes every comment
    * Set actions for specific categories
    * Perfect for handling spam and sentiment
    * No keyword configuration needed

    **Example:**

    > IF category is "Spam"
    > THEN hide comment

    <Tip>
      Use category rules to automatically hide spam or prioritize positive comments without managing keyword lists.
    </Tip>
  </Tab>

  <Tab title="Traditional Rules">
    Keyword-based rules that match exact text patterns and conditions.

    **How it works:**

    * Define specific keywords or phrases
    * Set exact matching conditions
    * Add user-based or context filters
    * Execute predefined actions

    **Example:**

    > IF comment contains "price" OR "cost" OR "how much"
    > THEN reply with template

    <Tip>
      Use traditional rules for very specific scenarios where you want exact control over matching.
    </Tip>
  </Tab>
</Tabs>

## Accessing Rules

<Steps>
  <Step title="Navigate to Rules">
    Click **Rules** in the sidebar navigation
  </Step>

  <Step title="Create New Rule">Click **+ New Rule** and choose LLM or Traditional rule type</Step>

  <Step title="Configure & Activate">
    Set your conditions and actions, then toggle to enable
  </Step>
</Steps>

## Rule Configuration

<AccordionGroup>
  <Accordion title="Conditions (When to Trigger)" icon="filter">
    Define when the rule should activate:

    **For LLM Rules:**

    * Describe the scenario in plain English
    * Example: "When someone asks about shipping or delivery"

    **For Category Rules:**

    * Select from AI-detected categories:
      * Positive, Product Qs, Brand Risk, Negative, Spam, Other
    * Example: "When category is Spam" or "When category is Positive"

    **For Traditional Rules:**

    **Content-Based:**

    * Specific keywords (e.g., "price", "shipping")
    * Phrase matching with AND/OR logic

    **User-Based:**

    * Specific usernames
    * Follower count thresholds
    * Verified or business accounts

    **Context-Based:**

    * Specific posts or campaigns
    * Platform (Instagram vs Facebook)
    * Timing conditions
  </Accordion>

  <Accordion title="Actions (What Happens)" icon="bolt">
    Choose what happens when conditions match:

    **Automated Actions:**

    * **Use AI Suggestion** - Apply AI-recommended response
    * **Reply with Template** - Send predefined message
    * **Hide Comment** - Remove from public view
    * **Delete Comment** - Remove entirely
    * **Block User** - Prevent future comments

    **Review Actions:**

    * **High-Priority Review** - Flag for immediate attention

    <Warning>
      Auto-apply actions execute immediately. Start with manual review to validate accuracy.
    </Warning>
  </Accordion>
</AccordionGroup>

## Common Use Cases

<CardGroup cols={3}>
  <Card title="Hide Spam" icon="shield">
    Automatically hide spam comments using category rules. No keyword management needed.
  </Card>

  <Card title="Engage with Positive Comments" icon="heart">
    Auto-reply to positive comments to build community and show appreciation.
  </Card>

  <Card title="FAQ Automation" icon="question">
    Use LLM rules to automatically answer common questions about pricing, shipping, products, etc.
  </Card>
</CardGroup>

## Creating a Rule

<Steps>
  <Step title="Name Your Rule">
    Click **+ New Rule** and give it a descriptive name (e.g., "Auto-reply to shipping questions")
  </Step>

  <Step title="Choose Rule Type">
    Select **LLM Rule**, **Category Rule**, or **Traditional Rule**
  </Step>

  <Step title="Set Conditions">
    **For LLM Rules:** Describe the scenario in plain English

    **For Category Rules:** Select categories (Spam, Positive, Product Qs, etc.)

    **For Traditional Rules:** Add specific keywords, user filters, or context conditions
  </Step>

  <Step title="Define Action">
    Choose what happens when the rule triggers: - Use AI suggestion, reply with template, hide,
    delete, or flag for review
  </Step>

  <Step title="Test & Activate">
    Test with sample comments, then toggle the rule to **Active**

    <Check>
      Start with manual review mode to validate accuracy before enabling auto-apply.
    </Check>
  </Step>
</Steps>

## Rule Management

<AccordionGroup>
  <Accordion title="Edit Rules" icon="pen-to-square">
    (1) Click on any rule to open its settings

    (2) Modify conditions, actions, or status

    (3) Click **Save** to apply changes immediately

    <Warning>
      Rule changes apply to new comments only. Existing comments are not reprocessed.
    </Warning>
  </Accordion>

  <Accordion title="Reorder Priority" icon="arrows-up-down">
    Rules execute in order from top to bottom:

    (1) Drag and drop rules to change execution order

    (2) Specific rules should be higher priority than general rules

    (3) Once a rule matches, lower priority rules may be skipped

    <Note>
      Higher priority rules are evaluated first, so order matters.
    </Note>
  </Accordion>

  <Accordion title="Monitor Performance" icon="chart-line">
    Track rule effectiveness in the dashboard:

    * **Match Count** - How many times the rule has triggered
    * **Status** - Auto-apply or manual review mode
    * **Toggle** - Quick enable/disable switch
  </Accordion>
</AccordionGroup>

## AI Fallback

<AccordionGroup>
  <Accordion title="What is AI Fallback?" icon="brain">
    Controls what happens to comments that don't match any rules.

    **When Enabled:**

    * Comments automatically get AI-suggested responses applied
    * Reduces manual review queue
    * Maintains fast response times

    **When Disabled:**

    * All unmatched comments require manual review
    * Maximum control over every response
    * Best for strict brand guidelines

    <Tip>
      Start with fallback disabled. Create rules for common scenarios, then enable fallback once you trust the AI.
    </Tip>
  </Accordion>
</AccordionGroup>

## Best Practices

<CardGroup cols={2}>
  <Card title="Start with LLM Rules" icon="sparkles">
    LLM rules are more flexible and require less maintenance. Use them for most scenarios unless you need exact keyword control.
  </Card>

  <Card title="Test Before Auto-Apply" icon="flask">
    Start new rules in manual review mode. Once you verify accuracy, switch to auto-apply for
    automation.
  </Card>

  <Card title="Use Specific Rules First" icon="bullseye">
    Order matters. Put specific rules at the top so they execute before general catch-all rules.
  </Card>

  <Card title="Monitor Performance" icon="chart-line">
    Check match counts. Adjust rules that are triggering too often or not enough.
  </Card>
</CardGroup>

## Example Rules

<AccordionGroup>
  <Accordion title="Category Rule: Hide Spam" icon="shield">
    **Rule Type:** Category

    **Condition:**

    ```yaml theme={null}
    IF: Category is "Spam"
    THEN: Hide Comment
    Auto-apply: Enabled
    ```

    Automatically hides all spam comments detected by AI. No keyword management needed.
  </Accordion>

  <Accordion title="LLM Rule: Respond to Emoji-Based Positive Comments" icon="heart">
    **Rule Type:** LLM

    **Condition:** "Reply to positive comments that include emojis like fire, heart eyes, or celebration"

    **Action:** Use AI Suggestion

    The AI understands emoji context and sentiment to craft appropriate responses that match the enthusiasm.
  </Accordion>

  <Accordion title="LLM Rule: FAQ Automation" icon="question">
    **Rule Type:** LLM (Recommended)

    **Condition:** "Reply to any comment asking about pricing, shipping, or product availability"

    **Action:** Use AI Suggestion

    The AI understands all variations like "how much?", "when will it ship?", "in stock?", etc.
  </Accordion>

  <Accordion title="Traditional Rule: Block Specific Accounts" icon="ban">
    **Rule Type:** Traditional

    **Condition:**

    ```yaml theme={null}
    IF: Username matches @spamaccount1
      OR @spamaccount2
      OR @trollaccount3
    THEN: Block User
    Auto-apply: Enabled
    ```

    Automatically blocks specific problematic accounts from commenting on your posts.
  </Accordion>
</AccordionGroup>

## Related Pages

<CardGroup cols={2}>
  <Card title="Comments Inbox" icon="inbox" href="/inbox/comments">
    View and manually respond to comments across all platforms
  </Card>

  <Card title="Bulk Reply" icon="reply-all" href="/comments/inbox-bulk-reply">
    Reply to multiple comments at once with AI assistance
  </Card>
</CardGroup>
