# config/initializers/avo.rb
Avo.configure do |config|
  # ... other config options ...
end

Rails.configuration.to_prepare do
  # For actions generated by watchers (property changes, status updates, etc.)
  Avo::Collaborate::Action.class_eval do
    after_create :slack_notification

    private

    def slack_notification
      SlackNotificationService.notify(message: "New action created: #{body}")
    end
  end

  # For user-authored comments in the collaboration timeline
  Avo::Collaborate::Comment.class_eval do
    validates :body, presence: true, length: { maximum: 5000 }

    before_validation :sanitize_body

    private

    def sanitize_body
      self.body = HtmlSanitizer.sanitize(body)
    end
  end

  # Wrapper entry that unifies both comments and actions via delegated_type :entryable
  Avo::Collaborate::Entry.class_eval do
    after_create :discord_notification

    private

    def discord_notification
      DiscordNotificationService.notify(message: "New action created: #{body}")
    end
  end
end
```

This approach lets you integrate collaboration events with your domain models while keeping the core Avo functionality intact. Add only the associations and callbacks that make sense for your application.

---