Real-time Interception
Intercept user actions in real-time before they’re processed
Custom Rules
Build custom validation and moderation logic tailored to your needs
Webhook Integration
Receive events via webhooks and respond with custom actions
Event Catalog
Complete list of interceptable events and their data
Overview
Pre-hook events enable you to create sophisticated moderation and control systems by intercepting user actions before they’re executed. This allows for:Custom Moderation
Custom Moderation
- Content Filtering: Analyze and modify content before publication
- User Behavior Control: Restrict access based on custom criteria
- Real-time Validation: Validate data against business rules
- Automated Responses: Implement graduated response systems
Advanced Use Cases
Advanced Use Cases
- Spam Prevention: Block suspicious posting patterns
- Content Enhancement: Auto-correct or enrich user content
- Access Control: Implement channel-specific permission systems
- Analytics Injection: Add tracking data to user actions
Enterprise Feature: Pre-hook events are available for customers on the Max plan. Contact our sales team to upgrade your plan.
How It Works
Pre-hook events create a validation layer between user actions and their execution:Response Types
Your webhook endpoint must respond with one of these actions:Allow
Allow
Allow with Modification
Allow with Modification
Deny
Deny
Getting Started
1
Enable Pre-Hook Events
Configure pre-hook events through the Network Settings API.
2
Set Up Webhook Endpoint
Create an HTTPS endpoint to receive and process pre-hook events.
3
Configure Event Types
Specify which events you want to intercept and process.
4
Test & Monitor
Test your webhook with sample events and monitor response times.
Configuration
Supported Events
Message Events
Message Events
Event | Triggered When | Available Data |
---|---|---|
message.shouldCreate | User sends a message | Message content, channel ID, sender |
message.shouldUpdate | User edits a message | Updated content, original message |
message.shouldFlag | User flags a message | Message data, flag reason |
message.shouldUnflag | User removes flag | Message data, flag count |
Channel Events
Channel Events
Event | Triggered When | Available Data |
---|---|---|
channel.shouldCreate | User creates channel | Channel data, creator |
channel.shouldJoin | User joins channel | Channel ID, user data |
channel.shouldLeave | User leaves channel | Channel ID, user data |
channel.shouldUpdate | Channel is updated | Updated channel data |
Post Events
Post Events
Event | Triggered When | Available Data |
---|---|---|
post.shouldCreate | User creates post | Post content, community |
post.shouldUpdate | User edits post | Updated content |
post.shouldDelete | User deletes post | Post ID, deletion reason |
post.shouldFlag | User flags post | Post data, flag details |
Best Practices
Performance & Reliability
Performance & Reliability
- Fast Response Times: Keep webhook processing under 2 seconds
- Fail-Safe Design: Default to “allow” on errors to prevent user disruption
- Async Processing: For complex logic, respond quickly and process asynchronously
- Monitoring: Track webhook response times and error rates
- Retry Logic: Implement exponential backoff for external service calls
Security & Validation
Security & Validation
- Signature Verification: Always verify webhook signatures
- HTTPS Only: Use secure HTTPS endpoints for webhook URLs
- Input Validation: Validate all incoming event data
- Rate Limiting: Implement rate limiting on your webhook endpoint
- Logging: Log all events for debugging and audit purposes
User Experience
User Experience
- Clear Error Messages: Provide helpful feedback when denying actions
- Consistent Policies: Apply rules consistently across all users
- Graceful Degradation: Handle service outages gracefully
- Documentation: Document your custom rules for transparency
- Appeal Process: Provide ways for users to appeal automated decisions
Troubleshooting
Common Issues
Common Issues
Timeout Errors
- Ensure webhook responds within 3 seconds
- Implement async processing for complex operations
- Use caching for frequently accessed data
- Verify webhook URL configuration
- Check secret key configuration
- Ensure payload is parsed correctly
- Check default action configuration
- Verify event type filtering
- Review webhook response format
Testing & Debugging
Testing & Debugging
Local TestingMonitoring Tools
- Set up alerts for webhook failures
- Monitor response time metrics
- Track action distribution (allow/deny/modify)
- Use structured logging for better debugging
Production Considerations: Always test pre-hook events thoroughly in a staging environment before deploying to production. Failed or slow webhook responses can impact user experience.