Triggers
Triggers enable you to automate critical security, moderation, and routing decisions by executing actions when specific conversation events occur. Unlike AI-powered actions that require the assistant to make decisions, triggers run immediately and deterministically based on rules you define - making them perfect for blocking spam, labeling conversations, and enforcing business policies.Why Triggers Matter
Without triggers, you would need to manually review every conversation for spam, policy violations, and routing requirements. Triggers provide immediate, automated protection and organization:Automated Security and Moderation
Stop unwanted conversations before they consume resources or reach your AI. Triggers can instantly block messages from known spam sources, suspicious email domains, or users who have violated your policies. This protects your AI from abuse and keeps your conversation analytics clean.Consistent Policy Enforcement
Your business rules should apply uniformly across all conversations. Triggers ensure that every message is evaluated against your criteria without exception. Whether you’re filtering marketplace notifications, enforcing regional restrictions, or implementing compliance requirements, triggers execute your policies reliably and instantly.Proactive Organization
Label and categorize conversations automatically as they arrive. Instead of manually tagging conversations after the fact, triggers can apply labels based on user attributes, message patterns, or conversation context - enabling better filtering, reporting, and team workflows.Resource Protection
By blocking spam and irrelevant messages before your AI processes them, triggers reduce computational costs and improve response times for legitimate users. They act as a first line of defense that operates before AI reasoning begins.Zero-Latency Decisions
Triggers execute synchronously during conversation creation, before your AI generates a response. This means blocking and labeling decisions happen instantly, with no delay or uncertainty in the user experience.How Triggers Work
Triggers follow a simple if-then model: When an event occurs and an audience matches, then execute one or more actions.The Trigger Lifecycle
- Event occurs: A user sends a message (currently the only supported event is “User Message Received”)
- Audience evaluation: The trigger checks if the conversation, user, and message match your defined criteria
- Action execution: If the audience matches, all configured actions execute immediately
- Conversation proceeds: If not blocked, the conversation continues to AI processing
Triggers are evaluated in priority order (top to bottom in your trigger list). All matching triggers execute their actions - triggers do not stop processing when one matches.
Event Types
Currently, botBrains supports one trigger event: User Message Received - Fires when a user sends a new message to you AI agent. This event occurs before the AI processes the message, allowing you to intercept and act on messages immediately.Defining Audience Criteria
Audiences determine which conversations match your trigger. You build audience rules using the same visual query builder available throughout botBrains.Building Audience Rules
The audience builder lets you combine multiple conditions with AND/OR logic:- Start with the root-level AND group
- Add individual rules based on user, conversation, channel, or time fields
- Nest groups within groups to create complex logic
- Use the NOT toggle to invert group conditions
- User attributes: Email, phone, timezone, labels, external IDs, platform-specific IDs
- Channel properties: Channel type (Browser, WhatsApp, Zendesk, Slack), subdomain, team ID
- Conversation context: Message count, created date, labels, external IDs
- Message properties: Content, sender type, timestamp
- Time conditions: Current date/time, hour, day of week, timezone
Audience Examples
Block email domain:Audience definitions use the same field structure as Audiences, but are evaluated in real-time as messages arrive rather than as stored segments.
Trigger Actions
When a trigger’s audience matches, it executes one or more actions. You can combine multiple actions in a single trigger to perform complex workflows.Available Actions
- Block
- Assign Label
- Unassign Label
Block prevents a conversation from continuing.Use cases:
- Stop spam conversations immediately
- Block messages from banned email domains
- Prevent automated bots from engaging with your AI
- Enforce regional or channel restrictions
- The conversation is marked as blocked
- No AI response is generated
- The conversation disappears from active lists
- Users receive no response (silent block)
- Entity type: Conversation (always)
- No additional parameters needed
Combining Multiple Actions
A single trigger can execute multiple actions in sequence. Common combinations: Spam handling:Creating Triggers
Using Quick Start Templates
botBrains provides pre-configured templates for common trigger scenarios. Templates automatically populate the trigger configuration with recommended settings.Block Spam Users
Automatically block conversations from users labeled as spam
Block Marketplace Emails
Block conversations from Amazon, eBay, and PayPal email domains
Label Non-Europe Timezone
Automatically label conversations from users outside Europe for review
- Navigate to Settings > Triggers
- Scroll to “Quick Start Templates”
- Click on a template card
- Review and customize the pre-filled configuration
- Save to activate the trigger
Creating Custom Triggers
1
Navigate to Triggers
Go to Settings > Triggers in your project
2
Create New Trigger
Click New Trigger button in the top right
3
Name Your Trigger
Enter a descriptive name like “Block marketplace notifications” or “Label weekend conversations”
4
Configure the When Section
Select the trigger event:
- User Message Received (currently the only option)
- Use the query builder to specify matching criteria
- Add rules for user attributes, conversation context, or channel properties
- Create nested groups for complex logic
5
Configure the Then Section
Add actions to execute:
- Click “Add Action” to add additional actions
- For each action, select the type (Block, Assign Label, Unassign Label)
- Configure action-specific settings (entity type, label name)
- Arrange actions in the desired execution order
6
Enable and Save
Toggle “Active” to enable the trigger, then click “Create Trigger”
New triggers are created in an inactive state by default. Enable them only after testing your audience criteria to avoid accidentally blocking legitimate conversations.
Managing Triggers
Viewing Active Triggers
The trigger list shows all configured triggers with key information:- Name: Your descriptive trigger name
- Event: Which event fires the trigger
- Action Types: Icons showing configured actions (Block, Assign Label, etc.)
- Enabled: Toggle switch to activate/deactivate
- Last Updated: When the trigger was last modified
Editing Triggers
- Click on any trigger row in the trigger list
- Modify the name, audience criteria, or actions
- Click “Save Changes” to update
Enabling and Disabling
Use the toggle switch in the trigger list to activate or deactivate triggers without deleting them:- Enabled: Trigger evaluates every matching event and executes actions
- Disabled: Trigger is ignored, no actions execute
- Testing new trigger configurations
- Temporary policy changes
- Investigating false positives
- Seasonal or time-limited rules
Trigger Priority
Triggers execute in the order they appear in your trigger list (top to bottom). While all matching triggers run, order can matter for label-based logic: Example scenario:Deleting Triggers
- Find the trigger in the trigger list
- Click the trash icon on the right side of the row
- Confirm deletion in the dialog
Practical Examples
Example 1: Comprehensive Spam Protection
Goal: Block known spam sources and flag potential spam for review Triggers to create: Trigger 1: Block Known Spam Users- Trigger 1 immediately blocks repeat offenders
- Trigger 2 blocks marketplace notifications before they waste AI resources
- Trigger 3 labels suspicious conversations for human review without blocking
Example 2: VIP Customer Routing
Goal: Label and prioritize conversations from important customers Trigger configuration:- Automatically categorizes VIP conversations
- Enables filtering in conversation lists
- Supports custom analytics and reporting
- Allows different escalation workflows for VIP users
Example 3: Channel-Specific Labeling
Goal: Organize conversations by channel and route appropriately Trigger configurations: Zendesk Conversations- Filter conversation lists by channel
- Track channel performance separately
- Apply channel-specific guidance or knowledge sources
- Route escalations to appropriate teams
Example 4: After-Hours Management
Goal: Label and handle conversations outside business hours Trigger configuration:- Identify conversations that need follow-up messaging
- Track support volume outside business hours
- Enable different AI guidance for after-hours users
- Support timezone-aware escalation policies
Example 5: User Lifecycle Labeling
Goal: Automatically categorize users based on conversation patterns Trigger configurations: First-Time Users- New users get onboarding labels
- Returning users are identified automatically
- Frequent users receive special recognition
- Enables user journey analytics
Best Practices
Designing Effective Triggers
- Start Simple
- Test Before Enabling
- Document Your Triggers
- Monitor False Positives
Begin with straightforward, single-condition triggers:As you gain confidence, add complexity incrementally.
- One clear audience criterion
- One or two actions maximum
- Easy to understand and test
Security Considerations
Limit blocking triggers to high-confidence criteria:- Known spam email domains
- Previously labeled spam users
- Clear policy violations
- Automated bot patterns
- Suspicious but not definitive patterns
- Borderline cases requiring review
- New moderation criteria being tested
- Regional or timezone-based filtering
- Only users with
trigger:writepermission can create/edit triggers - Review who has trigger access regularly
- Use custom roles to limit trigger management to security team
- Monitor audit logs for trigger changes
- Apply new triggers to test projects first
- Start with small audience segments
- Use AND logic to narrow criteria
- Gradually expand scope as confidence grows
Performance and Scalability
Keep audience criteria efficient:- Avoid overly complex nested groups
- Use specific field conditions rather than broad text searches
- Prefer exact matches over pattern matching when possible
- Test trigger evaluation time on high-volume projects
- Combine related triggers when possible
- Delete obsolete triggers promptly
- Regularly review trigger list and consolidate
- Typical projects need 5-10 triggers, not dozens
- Multiple labels can be assigned in one trigger
- Group related actions in single triggers
- Avoid redundant label assignments
- Clean up unused labels regularly
Organizational Workflows
Label naming conventions:- Share trigger documentation across teams
- Align trigger strategy with support workflows
- Review trigger effectiveness in team meetings
- Gather feedback from conversation reviewers
- Adjust triggers based on support team insights
- Use trigger labels in Audience definitions
- Filter Conversations by trigger-assigned labels
- Track trigger impact in Metrics
- Reference labels in Guidance conditions
- Create Topics around common trigger patterns
Troubleshooting
Trigger Not Firing
Symptom: Expected conversations are not being blocked or labeled Possible causes:- Trigger is disabled - Check the enabled toggle in trigger list
- Audience criteria too narrow - Review field names and operators
- Field values don’t match - Verify actual user/conversation data
- NOT logic inverting incorrectly - Check group NOT toggles
- Case sensitivity - Some text operators are case-sensitive
- Disable the trigger temporarily
- Find a test conversation that should have matched
- Review the user, conversation, and message fields
- Compare actual values to your audience criteria
- Test with a simpler audience rule
- Gradually add complexity until it works
Too Many False Positives
Symptom: Legitimate conversations are being blocked or mislabeled Solutions: Narrow your audience criteria:Trigger Executing Unexpectedly
Symptom: Trigger is matching conversations you didn’t intend Check these common issues:- OR logic too broad - OR conditions match if ANY criterion is true
- Root-level group behavior - Root group always uses AND with not: false
- JSON field access - Ensure JSON paths are correct for external attributes
- Date/time timezone - Current hour uses server timezone, not user timezone
- Empty field handling - Fields without values may match “is empty” unexpectedly
Actions Not Executing in Order
Symptom: Labels are applied but blocking doesn’t work, or vice versa Explanation: All actions in a single trigger execute sequentially. If blocking appears to prevent labeling, check if you have multiple triggers with conflicting logic. Solution: Ensure all desired actions are in a single trigger and ordered correctly:Can’t Delete or Edit Trigger
Symptom: UI doesn’t allow trigger modification Possible causes:- Permission issue - You need
trigger:writepermission - Browser cache - Clear cache or try incognito mode
- Active sessions - Sign out and back in
- Platform issue - Check status page or contact support
Related Documentation
Now that you understand triggers, explore these related security and automation features:- Roles and Permissions - Control who can create and manage triggers
- API Keys - Secure programmatic access for automation
- Audiences - Build audience segments used in triggers
- Actions - Configure AI-powered actions vs. trigger-based automation
- Labels - Organize and filter conversations with custom labels
- Conversations - Review conversations affected by triggers